33#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
34#include <com/sun/star/rendering/XBitmapCanvas.hpp>
35#include <com/sun/star/rendering/CompositeOperation.hpp>
36#include <com/sun/star/rendering/TextDirection.hpp>
45 const sal_Int32 gnVerticalGap (10);
47 const sal_Int32 gnHorizontalGap (10);
50 const double gnMinimalPreviewWidth (200);
51 const double gnPreferredPreviewWidth (300);
52 const double gnMaximalPreviewWidth (400);
53 const sal_Int32 gnPreferredColumnCount (6);
54 const double gnMinimalHorizontalPreviewGap(15);
55 const double gnPreferredHorizontalPreviewGap(25);
56 const double gnMaximalHorizontalPreviewGap(50);
57 const double gnPreferredVerticalPreviewGap(25);
59 const sal_Int32 gnHorizontalLabelBorder (3);
60 const sal_Int32 gnHorizontalLabelPadding (5);
62 const sal_Int32 gnVerticalButtonPadding (gnVerticalGap);
68 sal_Int32
round (
const double nValue) {
return sal::static_int_cast<sal_Int32>(0.5 + nValue); }
69 sal_Int32 floor (
const double nValue) {
return sal::static_int_cast<sal_Int32>(nValue); }
79 void Update (
const geometry::RealRectangle2D& rBoundingBox,
const double nSlideAspectRatio);
83 geometry::RealPoint2D
GetLocalPosition (
const geometry::RealPoint2D& rWindowPoint)
const;
84 geometry::RealPoint2D
GetWindowPosition(
const geometry::RealPoint2D& rLocalPoint)
const;
85 sal_Int32
GetColumn (
const geometry::RealPoint2D& rLocalPoint)
const;
86 sal_Int32
GetRow (
const geometry::RealPoint2D& rLocalPoint,
87 const bool bReturnInvalidValue =
false)
const;
89 css::geometry::RealPoint2D
GetPoint (
90 const sal_Int32 nSlideIndex,
91 const sal_Int32 nRelativeHorizontalPosition,
92 const sal_Int32 nRelativeVerticalPosition)
const;
93 css::awt::Rectangle
GetBoundingBox (
const sal_Int32 nSlideIndex)
const;
119 sal_Int32
GetIndex (
const sal_Int32 nRow,
const sal_Int32 nColumn)
const;
120 sal_Int32
GetRow (
const sal_Int32 nSlideIndex)
const;
121 sal_Int32
GetColumn (
const sal_Int32 nSlideIndex)
const;
130 const Reference<container::XIndexAccess>& rxSlides,
131 const std::shared_ptr<PresenterTheme>& rpTheme,
132 const Reference<awt::XWindow>& rxInvalidateTarget,
133 std::shared_ptr<PresenterPaintManager> xPaintManager);
138 const sal_Int32 nSlideIndex,
139 const Reference<rendering::XCanvas>& rxCanvas,
140 const Reference<rendering::XPolyPolygon2D>& rxClip);
143 const sal_Int32 nSlideIndex,
144 const awt::Rectangle& rBox);
161 const Reference<rendering::XCanvas>& rxCanvas);
166 const OUString& rsText,
167 const sal_Int32 nMaximalWidth)
const;
170 const OUString& rsText)
const;
171 OUString
GetFittingText (
const OUString& rsText,
const double nMaximalWidth)
const;
173 const Reference<rendering::XCanvas>& rxCanvas,
174 const geometry::IntegerSize2D& rSize)
const;
183 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
184 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
187 const awt::Rectangle& rSlideBoundingBox,
188 const Reference<rendering::XCanvas>& rxCanvas,
189 const geometry::RealRectangle2D& rClipBox);
194 const awt::Rectangle& rSlideBoundingBox);
211 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
212 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
213 const Reference<rendering::XPolyPolygon2D>& rxClip,
217 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
218 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
219 const geometry::RealRectangle2D& rClipBox,
223 const double nHeight);
229 const Reference<uno::XComponentContext>& rxContext,
230 const Reference<XResourceId>& rxViewId,
232 const ::rtl::Reference<PresenterController>& rpPresenterController)
238 mbIsLayoutPending(true),
239 mnSlideIndexMousePressed(-1),
240 mnCurrentSlideIndex(-1),
242 maSeparatorColor(0x00ffffff)
244 if ( ! rxContext.is()
246 || ! rxController.is()
247 || ! rpPresenterController)
249 throw lang::IllegalArgumentException();
258 Reference<XConfigurationController> xCC (
259 rxController->getConfigurationController(), UNO_SET_THROW);
260 Reference<lang::XMultiComponentFactory>
xFactory (
263 mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW);
270 mxWindow->addMouseMotionListener(
this);
282 [
this] (
double const offset) { return this->SetVerticalOffset(offset); }));
290 "SlideSorterCloser");
305 xFactory->createInstanceWithContext(
306 "com.sun.star.drawing.PresenterPreviewCache",
310 mxPreviewCache->setDocumentSlides(xSlides, rxController->getModel());
314 mpLayout->mnSlideCount = xSlides->getCount();
325 rxController->addPropertyChangeListener(
331 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
356 xComponent->dispose();
363 xComponent->dispose();
368 Reference<lang::XComponent> xComponent (
mxCanvas, UNO_QUERY);
370 xComponent->removeEventListener(
static_cast<awt::XWindowListener*
>(
this));
385 xComponent->dispose();
390 mxWindow->removeWindowListener(
this);
391 mxWindow->removePaintListener(
this);
392 mxWindow->removeMouseListener(
this);
393 mxWindow->removeMouseMotionListener(
this);
401 if (rEventObject.Source ==
mxWindow)
411 else if (rEventObject.Source ==
mxCanvas)
451 if ( ! mbIsPresenterViewActive)
454 Paint(rEvent.UpdateRect);
456 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
457 if (xSpriteCanvas.is())
458 xSpriteCanvas->updateScreen(
false);
465 css::awt::MouseEvent rTemp =rEvent;
468 awt::Rectangle aBox =
mxWindow->getPosSize();
469 rTemp.X=aBox.Width-rEvent.X;
471 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
477 css::awt::MouseEvent rTemp =rEvent;
480 awt::Rectangle aBox =
mxWindow->getPosSize();
481 rTemp.X=aBox.Width-rEvent.X;
483 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
484 const sal_Int32 nSlideIndex (
mpLayout->GetSlideIndexForPosition(aPosition));
489 switch (rEvent.ClickCount)
521 css::awt::MouseEvent rTemp =rEvent;
524 awt::Rectangle aBox =
mxWindow->getPosSize();
525 rTemp.X=aBox.Width-rEvent.X;
527 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
528 sal_Int32 nSlideIndex (
mpLayout->GetSlideIndexForPosition(aPosition));
539 mpLayout->GetBoundingBox(nSlideIndex));
561 const css::beans::PropertyChangeEvent&)
567 sal_Int32 nSlideIndex)
571 awt::Rectangle aBBox (
mpLayout->GetBoundingBox(nSlideIndex));
580 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
620 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
621 sal_Int32 nLeftBorderWidth (aWindowBox.X);
631 if ( ! pPane->mxPane.is())
634 Reference<drawing::framework::XPaneBorderPainter> xBorderPainter (
635 pPane->mxPane->GetPaneBorderPainter());
636 if ( ! xBorderPainter.is())
638 xBorderPainter->addBorder (
639 mxViewId->getAnchor()->getResourceURL(),
640 awt::Rectangle(0, 0, aWindowBox.Width, aWindowBox.Height),
641 drawing::framework::BorderType_INNER_BORDER);
650 geometry::RealRectangle2D aUpperBox(
666 mpLayout->GetFirstVisibleSlideIndex(),
667 mpLayout->GetLastVisibleSlideIndex());
674 const geometry::RealRectangle2D& rUpperBox)
677 bool bIsScrollBarNeeded (
false);
679 bIsScrollBarNeeded =
mpLayout->IsScrollBarNeeded(xSlides->getCount());
682 if (bIsScrollBarNeeded)
694 return geometry::RealRectangle2D(
711 return geometry::RealRectangle2D(
726 const awt::Rectangle& rCenterBox,
727 const sal_Int32 nLeftBorderWidth)
732 sal_Int32 nCloseButtonCenter (rCenterBox.Width/2);
733 if (rpPane && rpPane->mxPane.is())
735 const sal_Int32 nCalloutCenter (-nLeftBorderWidth);
736 const sal_Int32 nDistanceFromWindowCenter (
abs(nCalloutCenter - rCenterBox.Width/2));
738 const static sal_Int32 nMaxDistanceForCalloutCentering (
nButtonWidth * 2);
739 if (nDistanceFromWindowCenter < nMaxDistanceForCalloutCentering)
743 else if (nCalloutCenter > rCenterBox.Width-
nButtonWidth/2)
746 nCloseButtonCenter = nCalloutCenter;
755 const Reference<rendering::XCanvas>& rxCanvas,
756 const awt::Rectangle& rUpdateBox)
758 OSL_ASSERT(rxCanvas.is());
760 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
765 awt::Rectangle(0,0,aWindowBox.Width,aWindowBox.Height),
771 double nSlideAspectRatio (28.0/21.0);
778 Reference<beans::XPropertySet> xProperties(xSlides->getByIndex(0),UNO_QUERY_THROW);
779 sal_Int32 nWidth (28000);
780 sal_Int32 nHeight (21000);
781 if ((xProperties->getPropertyValue(
"Width") >>= nWidth)
782 && (xProperties->getPropertyValue(
"Height") >>= nHeight)
785 nSlideAspectRatio = double(nWidth) / double(nHeight);
794 return nSlideAspectRatio;
799 if (nSlideIndex < 0 || nSlideIndex>=
mpLayout->mnSlideCount)
808 const Reference<rendering::XCanvas>& rxCanvas,
809 const css::awt::Rectangle& rUpdateBox,
810 const sal_Int32 nSlideIndex)
812 OSL_ASSERT(rxCanvas.is());
814 geometry::IntegerSize2D aSize (
mpLayout->maPreviewSize);
818 mpLayout->GetBoundingBox(nSlideIndex)))
823 Reference<rendering::XBitmap> xPreview (
GetPreview(nSlideIndex));
826 const geometry::RealPoint2D aTopLeft (
828 mpLayout->GetPoint(nSlideIndex, isRTL?1:-1, -1)));
831 "PresenterScreenSettings/ScrollBar/Bitmaps",
832 std::shared_ptr<PresenterBitmapContainer>(),
836 Reference<drawing::XDrawPage> xPage( xIndexAccess->getByIndex(nSlideIndex), UNO_QUERY);
842 geometry::RealRectangle2D aBoundingBox (
mpLayout->maBoundingBox);
843 aBoundingBox.Y2 += 1;
844 const geometry::RealRectangle2D aClipBox (
848 Reference<rendering::XPolyPolygon2D> xClip (
851 const rendering::ViewState aViewState (geometry::AffineMatrix2D(1,0,0, 0,1,0), xClip);
853 rendering::RenderState aRenderState (
854 geometry::AffineMatrix2D(
859 rendering::CompositeOperation::SOURCE);
866 const awt::Rectangle aSlideBoundingBox(
867 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.X),
868 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.Y),
883 aSize = xPreview->getSize();
884 if (aSize.Width > 0 && aSize.Height > 0)
886 rxCanvas->drawBitmap(xPreview, aViewState, aRenderState);
887 if( bCustomAnimation )
889 const awt::Rectangle aAnimationPreviewBox(aTopLeft.X+3, aTopLeft.Y+aSize.Height-40, 0, 0);
891 Reference<rendering::XBitmap> xAnimationIcon (aAnimationDescriptor->GetNormalBitmap());
892 rendering::RenderState aAnimationRenderState (
893 geometry::AffineMatrix2D(
894 1, 0, aAnimationPreviewBox.X,
895 0, 1, aAnimationPreviewBox.Y),
898 rendering::CompositeOperation::SOURCE);
899 rxCanvas->drawBitmap(xAnimationIcon, aViewState, aAnimationRenderState);
903 const awt::Rectangle aTransitionPreviewBox(aTopLeft.X+3, aTopLeft.Y+aSize.Height-20, 0, 0);
905 Reference<rendering::XBitmap> xTransitionIcon (aTransitionDescriptor->GetNormalBitmap());
906 rendering::RenderState aTransitionRenderState (
907 geometry::AffineMatrix2D(
908 1, 0, aTransitionPreviewBox.X,
909 0, 1, aTransitionPreviewBox.Y),
912 rendering::CompositeOperation::SOURCE);
913 rxCanvas->drawBitmap(xTransitionIcon, aViewState, aTransitionRenderState);
922 awt::Rectangle(-1, -1, aSize.Width+2, aSize.Height+2),
923 rxCanvas->getDevice());
928 const util::Color aFrameColor (0x00000000);
930 rxCanvas->drawPolyPolygon(
mxPreviewFrame, aViewState, aRenderState);
939 const bool bCanvasChanged ( !
mxCanvas.is());
965 rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0),
966 nullptr, Sequence<double>(4), rendering::CompositeOperation::SOURCE);
971 rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr),
980 [
this, &rUpdateBox] (sal_Int32
const nIndex) {
985 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
986 if (xSpriteCanvas.is())
987 xSpriteCanvas->updateScreen(
false);
992 if (
mpLayout->SetHorizontalOffset(nXOffset))
995 mpLayout->GetFirstVisibleSlideIndex(),
996 mpLayout->GetLastVisibleSlideIndex());
1004 if (
mpLayout->SetVerticalOffset(nYOffset))
1007 mpLayout->GetFirstVisibleSlideIndex(),
1008 mpLayout->GetLastVisibleSlideIndex());
1028 Reference<lang::XComponent> xComponent (
mxCanvas, UNO_QUERY);
1029 if (xComponent.is())
1030 xComponent->addEventListener(
static_cast<awt::XWindowListener*
>(
this));
1040 if (rBHelper.bDisposed || rBHelper.bInDispose)
1042 throw lang::DisposedException (
1043 "PresenterSlideSorter has been already disposed",
1044 static_cast<uno::XWeak*
>(
this));
1052 : mnHorizontalOffset(0),
1056 mnHorizontalBorder(0),
1057 mnVerticalBorder(0),
1061 mnFirstVisibleColumn(-1),
1062 mnLastVisibleColumn(-1),
1063 mnFirstVisibleRow(-1),
1064 mnLastVisibleRow(-1),
1065 mpVerticalScrollBar(
std::move(xVerticalScrollBar))
1070 const geometry::RealRectangle2D& rBoundingBox,
1071 const double nSlideAspectRatio)
1073 maBoundingBox = rBoundingBox;
1078 const double nWidth (rBoundingBox.X2 - rBoundingBox.X1 - 2*mnHorizontalBorder);
1079 const double nHeight (rBoundingBox.Y2 - rBoundingBox.Y1 - 2*mnVerticalBorder);
1080 if (nWidth<=0 || nHeight<=0)
1083 double nPreviewWidth;
1089 const double nElementWidth = nWidth / gnPreferredColumnCount;
1090 if (nElementWidth < gnMinimalPreviewWidth + gnMinimalHorizontalPreviewGap)
1094 if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
1097 nPreviewWidth = gnPreferredPreviewWidth;
1098 mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
1099 / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
1100 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1107 mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
1108 if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
1109 nPreviewWidth = nWidth - gnMinimalHorizontalPreviewGap;
1111 nPreviewWidth = ::std::max(gnMinimalPreviewWidth, nWidth-mnHorizontalGap);
1114 else if (nElementWidth > gnMaximalPreviewWidth + gnMaximalHorizontalPreviewGap)
1117 nPreviewWidth = gnPreferredPreviewWidth;
1118 mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
1119 / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
1120 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1126 mnColumnCount = gnPreferredColumnCount;
1127 if (nElementWidth - gnPreferredPreviewWidth < gnMinimalHorizontalPreviewGap)
1130 mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
1131 nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
1133 else if (nElementWidth - gnPreferredPreviewWidth <= gnMaximalHorizontalPreviewGap)
1136 mnHorizontalGap =
round(gnMaximalHorizontalPreviewGap);
1137 nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
1142 nPreviewWidth = gnPreferredPreviewWidth;
1143 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1148 const double nPreviewHeight = nPreviewWidth / nSlideAspectRatio;
1149 mnRowCount = ::std::max(
1151 sal_Int32(ceil((nHeight+gnPreferredVerticalPreviewGap)
1152 / (nPreviewHeight + gnPreferredVerticalPreviewGap))));
1153 mnVerticalGap =
round(gnPreferredVerticalPreviewGap);
1155 maPreviewSize = geometry::IntegerSize2D(floor(nPreviewWidth), floor(nPreviewHeight));
1159 mnHorizontalOffset =
round(-(nWidth
1160 - mnColumnCount*maPreviewSize.Width
1161 - (mnColumnCount-1)*mnHorizontalGap)
1167 geometry::RealPoint2D aPoint (GetLocalPosition(
1168 geometry::RealPoint2D(maBoundingBox.X1, maBoundingBox.Y1)));
1169 mnFirstVisibleColumn = 0;
1170 mnFirstVisibleRow = ::std::max(sal_Int32(0), GetRow(aPoint));
1172 aPoint = GetLocalPosition(geometry::RealPoint2D( maBoundingBox.X2, maBoundingBox.Y2));
1173 mnLastVisibleColumn = mnColumnCount - 1;
1174 mnLastVisibleRow = GetRow(aPoint,
true);
1179 geometry::RealPoint2D aBottomRight = GetPoint(
1180 mnColumnCount * (GetRow(nSlideCount)+1) - 1, +1, +1);
1181 return aBottomRight.X > maBoundingBox.X2-maBoundingBox.X1
1182 || aBottomRight.Y > maBoundingBox.Y2-maBoundingBox.Y1;
1186 const geometry::RealPoint2D& rWindowPoint)
const
1190 return css::geometry::RealPoint2D(
1191 -rWindowPoint.X + maBoundingBox.X2 + mnHorizontalOffset,
1196 return css::geometry::RealPoint2D(
1197 rWindowPoint.X - maBoundingBox.X1 + mnHorizontalOffset,
1203 const geometry::RealPoint2D& rLocalPoint)
const
1207 return css::geometry::RealPoint2D(
1208 -rLocalPoint.X + mnHorizontalOffset + maBoundingBox.X2,
1213 return css::geometry::RealPoint2D(
1214 rLocalPoint.X - mnHorizontalOffset + maBoundingBox.X1,
1220 const css::geometry::RealPoint2D& rLocalPoint)
const
1222 const sal_Int32 nColumn(floor(
1223 (rLocalPoint.X + mnHorizontalGap/2.0) / (maPreviewSize.Width+mnHorizontalGap)));
1224 if (nColumn>=mnFirstVisibleColumn && nColumn<=mnLastVisibleColumn)
1233 const css::geometry::RealPoint2D& rLocalPoint,
1234 const bool bReturnInvalidValue)
const
1236 const sal_Int32 nRow (floor(
1237 (rLocalPoint.Y + mnVerticalGap/2.0) / (maPreviewSize.Height+mnVerticalGap)));
1238 if (bReturnInvalidValue
1239 || (nRow>=mnFirstVisibleRow && nRow<=mnLastVisibleRow))
1248 const css::geometry::RealPoint2D& rWindowPoint)
const
1253 const css::geometry::RealPoint2D aLocalPosition (GetLocalPosition(rWindowPoint));
1254 const sal_Int32 nColumn (GetColumn(aLocalPosition));
1255 const sal_Int32 nRow (GetRow(aLocalPosition));
1257 if (nColumn < 0 || nRow < 0)
1261 sal_Int32
nIndex (GetIndex(nRow, nColumn));
1262 if (
nIndex >= mnSlideCount)
1270 const sal_Int32 nSlideIndex,
1271 const sal_Int32 nRelativeHorizontalPosition,
1272 const sal_Int32 nRelativeVerticalPosition)
const
1274 sal_Int32 nColumn (GetColumn(nSlideIndex));
1275 sal_Int32 nRow (GetRow(nSlideIndex));
1277 geometry::RealPoint2D aPosition (
1278 mnHorizontalBorder + nColumn*(maPreviewSize.Width+mnHorizontalGap),
1279 mnVerticalBorder + nRow*(maPreviewSize.Height+mnVerticalGap));
1281 if (nRelativeHorizontalPosition >= 0)
1283 if (nRelativeHorizontalPosition > 0)
1284 aPosition.X += maPreviewSize.Width;
1286 aPosition.X += maPreviewSize.Width / 2.0;
1288 if (nRelativeVerticalPosition >= 0)
1290 if (nRelativeVerticalPosition > 0)
1291 aPosition.Y += maPreviewSize.Height;
1293 aPosition.Y += maPreviewSize.Height / 2.0;
1302 const geometry::RealPoint2D aWindowPosition(GetWindowPosition(GetPoint(nSlideIndex, isRTL?1:-1, -1)));
1304 geometry::RealRectangle2D(
1307 aWindowPosition.X + maPreviewSize.Width,
1308 aWindowPosition.Y + maPreviewSize.Height));
1312 const ::std::function<
void (sal_Int32)>& rAction)
1314 for (sal_Int32 nRow=mnFirstVisibleRow; nRow<=mnLastVisibleRow; ++nRow)
1316 for (sal_Int32 nColumn=mnFirstVisibleColumn; nColumn<=mnLastVisibleColumn; ++nColumn)
1318 const sal_Int32 nSlideIndex (GetIndex(nRow, nColumn));
1319 if (nSlideIndex >= mnSlideCount)
1321 rAction(nSlideIndex);
1328 return GetIndex(mnFirstVisibleRow, mnFirstVisibleColumn);
1334 GetIndex(mnLastVisibleRow, mnLastVisibleColumn),
1340 if (mnHorizontalOffset != nOffset)
1342 mnHorizontalOffset =
round(nOffset);
1366 sal_Int32 nTotalRowCount = sal_Int32(ceil(
double(mnSlideCount) /
double(mnColumnCount)));
1371 nTotalRowCount * maPreviewSize.Height
1372 + (nTotalRowCount-1) * mnVerticalGap
1383 const sal_Int32 nRow,
1384 const sal_Int32 nColumn)
const
1386 return nRow * mnColumnCount + nColumn;
1391 return nSlideIndex / mnColumnCount;
1396 return nSlideIndex % mnColumnCount;
1402 const Reference<container::XIndexAccess>& rxSlides,
1403 const std::shared_ptr<PresenterTheme>& rpTheme,
1404 const Reference<awt::XWindow>& rxInvalidateTarget,
1405 std::shared_ptr<PresenterPaintManager> xPaintManager)
1406 : mxSlides(rxSlides),
1408 mxInvalidateTarget(rxInvalidateTarget),
1409 mpPaintManager(
std::move(xPaintManager))
1411 if (rpTheme !=
nullptr)
1413 std::shared_ptr<PresenterBitmapContainer> pBitmaps (rpTheme->GetBitmapContainer());
1414 if (pBitmaps !=
nullptr)
1421 mpFont = rpTheme->GetFont(
"SlideSorterLabelFont");
1426 const sal_Int32 nSlideIndex,
1427 const Reference<rendering::XCanvas>& rxCanvas,
1428 const Reference<rendering::XPolyPolygon2D>& rxClip)
1430 if (nSlideIndex != mnSlideIndex)
1434 SetCanvas(rxCanvas);
1435 if (rxCanvas ==
nullptr)
1443 geometry::IntegerSize2D aSize (
mxBitmap->getSize());
1444 const double nXOffset (maSlideBoundingBox.X
1445 + (maSlideBoundingBox.Width - aSize.Width) / 2.0);
1446 const double nYOffset (maSlideBoundingBox.Y
1447 + (maSlideBoundingBox.Height - aSize.Height) / 2.0);
1448 rxCanvas->drawBitmap(
1450 rendering::ViewState(
1451 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1453 rendering::RenderState(
1454 geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
1456 Sequence<double>(4),
1457 rendering::CompositeOperation::SOURCE));
1461 const Reference<rendering::XCanvas>& rxCanvas)
1469 const sal_Int32 nSlideIndex,
1470 const awt::Rectangle& rBox)
1472 if (mnSlideIndex == nSlideIndex)
1478 maSlideBoundingBox = rBox;
1479 mnSlideIndex = nSlideIndex;
1481 if (nSlideIndex >= 0)
1487 Reference<beans::XPropertySet> xSlideProperties(mxSlides->getByIndex(nSlideIndex), UNO_QUERY);
1488 if (xSlideProperties.is())
1489 xSlideProperties->getPropertyValue(
"LinkDisplayName") >>=
msText;
1492 msText =
"Slide " + OUString::number(nSlideIndex + 1);
1505 const OUString& rsText,
1506 const sal_Int32 nMaximalWidth)
const
1515 const OUString sText (GetFittingText(rsText, nMaximalWidth
1516 - 2*gnHorizontalLabelBorder
1517 - 2*gnHorizontalLabelPadding));
1522 geometry::IntegerSize2D aLabelSize (CalculateLabelSize(sText));
1525 Reference<rendering::XBitmap> xBitmap (
1526 mxCanvas->getDevice()->createCompatibleAlphaBitmap(aLabelSize));
1528 if ( ! xBitmap.is())
1531 Reference<rendering::XBitmapCanvas> xBitmapCanvas (xBitmap, UNO_QUERY);
1532 if ( ! xBitmapCanvas.is())
1536 PaintButtonBackground(xBitmapCanvas, aLabelSize);
1539 if (!sText.isEmpty())
1542 const rendering::StringContext aContext (sText, 0, sText.getLength());
1543 const Reference<rendering::XTextLayout> xLayout (
mpFont->mxFont->createTextLayout(
1544 aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
1545 const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
1547 const double nXOffset = (aLabelSize.Width - aTextBBox.X2 + aTextBBox.X1) / 2;
1548 const double nYOffset = aLabelSize.Height
1549 - (aLabelSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y2;
1551 const rendering::ViewState aViewState(
1552 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1555 rendering::RenderState aRenderState (
1556 geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
1558 Sequence<double>(4),
1559 rendering::CompositeOperation::SOURCE);
1562 xBitmapCanvas->drawTextLayout (
1572 const OUString& rsText,
1573 const double nMaximalWidth)
const
1575 const double nTextWidth (
1577 if (nTextWidth > nMaximalWidth)
1583 double nBestWidth (0);
1584 OUString sBestCandidate;
1585 sal_Int32
nLength (
round(rsText.getLength() * nMaximalWidth / nTextWidth));
1586 static constexpr OUStringLiteral sEllipses (
u"...");
1589 const OUString sCandidate (rsText.subView(0,
nLength) + sEllipses);
1590 const double nWidth (
1592 if (nWidth > nMaximalWidth)
1599 else if (nWidth < nMaximalWidth)
1602 if (nWidth > nBestWidth)
1605 sBestCandidate = sCandidate;
1606 nBestWidth = nWidth;
1608 if (
nLength >= rsText.getLength())
1618 sBestCandidate = sCandidate;
1622 return sBestCandidate;
1629 const OUString& rsText)
const
1632 sal_Int32 nHeight (32);
1633 if (mpCenterLabelBitmap)
1635 Reference<rendering::XBitmap> xBitmap (mpCenterLabelBitmap->GetNormalBitmap());
1637 nHeight = xBitmap->getSize().Height;
1641 const geometry::RealSize2D aTextSize (
1644 const sal_Int32 nWidth (
round(aTextSize.Width + 2*gnHorizontalLabelPadding));
1646 return geometry::IntegerSize2D(nWidth, nHeight);
1650 const Reference<rendering::XCanvas>& rxCanvas,
1651 const geometry::IntegerSize2D& rSize)
const
1654 Reference<rendering::XBitmap> xLeftLabelBitmap;
1655 if (mpLeftLabelBitmap)
1656 xLeftLabelBitmap = mpLeftLabelBitmap->GetNormalBitmap();
1658 Reference<rendering::XBitmap> xCenterLabelBitmap;
1659 if (mpCenterLabelBitmap)
1660 xCenterLabelBitmap = mpCenterLabelBitmap->GetNormalBitmap();
1662 Reference<rendering::XBitmap> xRightLabelBitmap;
1663 if (mpRightLabelBitmap)
1664 xRightLabelBitmap = mpRightLabelBitmap->GetNormalBitmap();
1668 awt::Rectangle(0,0, rSize.Width,rSize.Height),
1669 awt::Rectangle(0,0, rSize.Width,rSize.Height),
1677 if (mpPaintManager !=
nullptr)
1678 mpPaintManager->Invalidate(mxInvalidateTarget, maSlideBoundingBox,
true);
1684 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
1685 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
1686 : mnTopFrameSize(0),
1688 mnRightFrameSize(0),
1689 mnBottomFrameSize(0)
1693 "/org.openoffice.Office.PresenterScreen/",
1695 Reference<container::XHierarchicalNameAccess> xBitmaps (
1697 "PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps"),
1699 if ( ! xBitmaps.is())
1703 "PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps",
1704 std::shared_ptr<PresenterBitmapContainer>(),
1750 const awt::Rectangle& rSlideBoundingBox,
1751 const Reference<rendering::XCanvas>& rxCanvas,
1752 const geometry::RealRectangle2D& rClipBox)
1754 if ( ! rxCanvas.is())
1757 const Reference<rendering::XPolyPolygon2D> xClip (
1763 mpTop->GetNormalBitmap(),
1766 rSlideBoundingBox.X,
1767 rSlideBoundingBox.Y -
mpTop->mnHeight,
1768 rSlideBoundingBox.Width,
1774 mpLeft->GetNormalBitmap(),
1777 rSlideBoundingBox.X -
mpLeft->mnWidth,
1778 rSlideBoundingBox.Y,
1780 rSlideBoundingBox.Height);
1788 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1789 rSlideBoundingBox.Y,
1791 rSlideBoundingBox.Height);
1799 rSlideBoundingBox.X,
1800 rSlideBoundingBox.Y + rSlideBoundingBox.Height,
1801 rSlideBoundingBox.Width,
1810 rSlideBoundingBox.X -
mpTopLeft->mnWidth,
1811 rSlideBoundingBox.Y -
mpTopLeft->mnHeight);
1819 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1829 rSlideBoundingBox.Y + rSlideBoundingBox.Height);
1837 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1838 rSlideBoundingBox.Y + rSlideBoundingBox.Height);
1843 const awt::Rectangle& rSlideBoundingBox)
1845 return awt::Rectangle(
1846 rSlideBoundingBox.X - mnLeftFrameSize,
1847 rSlideBoundingBox.Y - mnTopFrameSize,
1848 rSlideBoundingBox.Width + mnLeftFrameSize + mnRightFrameSize,
1849 rSlideBoundingBox.Height + mnTopFrameSize + mnBottomFrameSize);
1853 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
1854 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
1855 const Reference<rendering::XPolyPolygon2D>& rxClip,
1859 OSL_ASSERT(rxCanvas.is());
1860 if ( ! rxBitmap.is())
1863 const rendering::ViewState aViewState(
1864 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1867 const rendering::RenderState aRenderState (
1868 geometry::AffineMatrix2D(
1872 Sequence<double>(4),
1873 rendering::CompositeOperation::SOURCE);
1875 rxCanvas->drawBitmap(
1882 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
1883 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
1884 const geometry::RealRectangle2D& rClipBox,
1887 const double nWidth,
1888 const double nHeight)
1890 OSL_ASSERT(rxCanvas.is());
1891 if ( ! rxBitmap.is())
1894 geometry::IntegerSize2D aSize (rxBitmap->getSize());
1896 const rendering::ViewState aViewState(
1897 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1901 geometry::RealRectangle2D(nX0,nY0,nX0+nWidth,nY0+nHeight)),
1902 rxCanvas->getDevice()));
1904 rendering::RenderState aRenderState (
1905 geometry::AffineMatrix2D(
1909 Sequence<double>(4),
1910 rendering::CompositeOperation::SOURCE);
1912 const double nX1 = nX0 + nWidth;
1913 const double nY1 = nY0 + nHeight;
1914 for (
double nY=nY0; nY<nY1; nY+=aSize.Height)
1915 for (
double nX=nX0; nX<nX1; nX+=aSize.Width)
1917 aRenderState.AffineTransform.m02 = nX;
1918 aRenderState.AffineTransform.m12 = nY;
1919 rxCanvas->drawBitmap(
SharedBitmapDescriptor mpBottomRight
SharedBitmapDescriptor mpLeft
SharedBitmapDescriptor mpRight
SharedBitmapDescriptor mpTop
PresenterTheme::SharedFontDescriptor mpFont
SharedBitmapDescriptor mpTopRight
SharedBitmapDescriptor mpTopLeft
SharedBitmapDescriptor mpBottomLeft
SharedBitmapDescriptor mpBottom
rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
static bool GetLayoutRTL()
Manage a set of bitmap groups as they are used for buttons: three bitmaps, one for the normal state,...
std::shared_ptr< BitmapDescriptor > GetBitmap(const OUString &rsName) const
Return the bitmap set that is associated with the given name.
static css::geometry::RealSize2D GetTextSize(const css::uno::Reference< css::rendering::XCanvasFont > &rxFont, const OUString &rsText)
static void SetDeviceColor(css::rendering::RenderState &rRenderState, const css::util::Color aColor)
This class gives access to the configuration.
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
static bool HasTransition(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
static bool HasCustomAnimation(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
static bool AreRectanglesDisjoint(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
static bool IsInside(const css::geometry::RealRectangle2D &rBox, const css::geometry::RealPoint2D &rPoint)
static css::awt::Rectangle Intersection(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
static css::awt::Rectangle ConvertRectangle(const css::geometry::RealRectangle2D &rBox)
Return the bounding box with integer coordinates of the given rectangle.
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
SharedBitmapDescriptor mpTopLeft
SharedBitmapDescriptor mpRight
SharedBitmapDescriptor mpBottomRight
static void PaintBitmapTiled(const css::uno::Reference< css::rendering::XBitmap > &rxBitmap, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const geometry::RealRectangle2D &rClipBox, const double nX, const double nY, const double nWidth, const double nHeight)
sal_Int32 mnLeftFrameSize
awt::Rectangle GetBoundingBox(const awt::Rectangle &rSlideBoundingBox)
Enlarge the given rectangle to include the current slide indicator.
void PaintCurrentSlideFrame(const awt::Rectangle &rSlideBoundingBox, const Reference< rendering::XCanvas > &rxCanvas, const geometry::RealRectangle2D &rClipBox)
sal_Int32 mnBottomFrameSize
SharedBitmapDescriptor mpTopRight
SharedBitmapDescriptor mpLeft
static void PaintBitmapOnce(const css::uno::Reference< css::rendering::XBitmap > &rxBitmap, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const Reference< rendering::XPolyPolygon2D > &rxClip, const double nX, const double nY)
SharedBitmapDescriptor mpTop
sal_Int32 mnRightFrameSize
SharedBitmapDescriptor mpBottomLeft
SharedBitmapDescriptor mpBottom
CurrentSlideFrameRenderer(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
css::geometry::RealPoint2D GetPoint(const sal_Int32 nSlideIndex, const sal_Int32 nRelativeHorizontalPosition, const sal_Int32 nRelativeVerticalPosition) const
bool IsScrollBarNeeded(const sal_Int32 nSlideCount)
void Update(const geometry::RealRectangle2D &rBoundingBox, const double nSlideAspectRatio)
sal_Int32 GetIndex(const sal_Int32 nRow, const sal_Int32 nColumn) const
geometry::RealPoint2D GetLocalPosition(const geometry::RealPoint2D &rWindowPoint) const
void ForAllVisibleSlides(const ::std::function< void(sal_Int32)> &rAction)
bool SetHorizontalOffset(const double nOffset)
sal_Int32 GetColumn(const geometry::RealPoint2D &rLocalPoint) const
sal_Int32 mnFirstVisibleColumn
sal_Int32 GetLastVisibleSlideIndex() const
sal_Int32 mnLastVisibleColumn
sal_Int32 mnLastVisibleRow
::rtl::Reference< PresenterScrollBar > mpVerticalScrollBar
sal_Int32 mnVerticalOffset
geometry::RealPoint2D GetWindowPosition(const geometry::RealPoint2D &rLocalPoint) const
sal_Int32 GetSlideIndexForPosition(const css::geometry::RealPoint2D &rPoint) const
css::geometry::RealRectangle2D maBoundingBox
css::geometry::IntegerSize2D maPreviewSize
sal_Int32 GetRow(const geometry::RealPoint2D &rLocalPoint, const bool bReturnInvalidValue=false) const
bool SetVerticalOffset(const double nOffset)
sal_Int32 mnHorizontalOffset
Layout(::rtl::Reference< PresenterScrollBar > xVerticalScrollBar)
sal_Int32 mnFirstVisibleRow
sal_Int32 GetFirstVisibleSlideIndex() const
sal_Int32 mnVerticalBorder
sal_Int32 mnHorizontalBorder
css::awt::Rectangle GetBoundingBox(const sal_Int32 nSlideIndex) const
sal_Int32 mnHorizontalGap
Reference< awt::XWindow > mxInvalidateTarget
Reference< rendering::XCanvas > mxCanvas
MouseOverManager(const Reference< container::XIndexAccess > &rxSlides, const std::shared_ptr< PresenterTheme > &rpTheme, const Reference< awt::XWindow > &rxInvalidateTarget, std::shared_ptr< PresenterPaintManager > xPaintManager)
awt::Rectangle maSlideBoundingBox
MouseOverManager & operator=(const MouseOverManager &)=delete
void SetCanvas(const Reference< rendering::XCanvas > &rxCanvas)
Reference< rendering::XBitmap > CreateBitmap(const OUString &rsText, const sal_Int32 nMaximalWidth) const
Create a bitmap that shows the given text and is not wider than the given maximal width.
OUString GetFittingText(const OUString &rsText, const double nMaximalWidth) const
void SetSlide(const sal_Int32 nSlideIndex, const awt::Rectangle &rBox)
Reference< rendering::XBitmap > mxBitmap
SharedBitmapDescriptor mpLeftLabelBitmap
std::shared_ptr< PresenterPaintManager > mpPaintManager
SharedBitmapDescriptor mpRightLabelBitmap
const Reference< container::XIndexAccess > mxSlides
PresenterTheme::SharedFontDescriptor mpFont
void PaintButtonBackground(const Reference< rendering::XCanvas > &rxCanvas, const geometry::IntegerSize2D &rSize) const
geometry::IntegerSize2D CalculateLabelSize(const OUString &rsText) const
void Paint(const sal_Int32 nSlideIndex, const Reference< rendering::XCanvas > &rxCanvas, const Reference< rendering::XPolyPolygon2D > &rxClip)
SharedBitmapDescriptor mpCenterLabelBitmap
MouseOverManager(const MouseOverManager &)=delete
void PaintPreview(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rUpdateBox, const sal_Int32 nSlideIndex)
::rtl::Reference< PresenterController > mpPresenterController
std::shared_ptr< CurrentSlideFrameRenderer > mpCurrentSlideFrameRenderer
css::uno::Reference< css::rendering::XBitmap > GetPreview(const sal_Int32 nSlideIndex)
css::uno::Reference< css::rendering::XPolyPolygon2D > mxPreviewFrame
void Paint(const css::awt::Rectangle &rUpdateBox)
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
double GetSlideAspectRatio() const
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::util::Color maSeparatorColor
sal_Int32 mnCurrentSlideIndex
std::unique_ptr< MouseOverManager > mpMouseOverManager
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
sal_Int32 mnSlideIndexMousePressed
css::uno::Reference< css::drawing::XSlidePreviewCache > mxPreviewCache
virtual void SAL_CALL mouseDragged(const css::awt::MouseEvent &rEvent) override
void PlaceCloseButton(const PresenterPaneContainer::SharedPaneDescriptor &rpPane, const css::awt::Rectangle &rCenterBox, const sal_Int32 nLeftFrameWidth)
css::uno::Reference< css::drawing::framework::XPane > mxPane
css::uno::Reference< css::awt::XWindow > mxWindow
void ClearBackground(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rRedrawArea)
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
void SetVerticalOffset(const double nYOffset)
virtual void SAL_CALL mouseMoved(const css::awt::MouseEvent &rEvent) override
css::geometry::RealRectangle2D PlaceScrollBars(const css::geometry::RealRectangle2D &rUpperBox)
virtual sal_Bool SAL_CALL isAnchorOnly() override
virtual void SAL_CALL notifyPreviewCreation(sal_Int32 nSlideIndex) override
css::uno::Reference< css::rendering::XCanvas > mxCanvas
::rtl::Reference< PresenterButton > mpCloseButton
void GotoSlide(const sal_Int32 nSlideIndex)
virtual ~PresenterSlideSorter() override
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
void SetHorizontalOffset(const double nXOffset)
virtual void SAL_CALL disposing() override
::rtl::Reference< PresenterScrollBar > mpVerticalScrollBar
std::shared_ptr< Layout > mpLayout
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
css::awt::Rectangle maCurrentSlideFrameBoundingBox
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEvent) override
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
PresenterSlideSorter(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const rtl::Reference<::sd::DrawController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
std::shared_ptr< FontDescriptor > SharedFontDescriptor
static void PaintHorizontalBitmapComposite(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rRepaintBox, const css::awt::Rectangle &rBoundingBox, const css::uno::Reference< css::rendering::XBitmap > &rxLeftBitmap, const css::uno::Reference< css::rendering::XBitmap > &rxRepeatableCenterBitmap, const css::uno::Reference< css::rendering::XBitmap > &rxRightBitmap)
VclPtr< VirtualDevice > mxBitmap
Reference< XSingleServiceFactory > xFactory
css::uno::Reference< css::presentation::XSlideShowController > GetSlideShowController(const css::uno::Reference< css::frame::XController > &rxController)
Return the slide show controller of a running presentation that has the same document as the given fr...
cppu::WeakComponentImplHelper< css::drawing::framework::XView, css::awt::XWindowListener, css::awt::XPaintListener, css::beans::XPropertyChangeListener, css::drawing::XSlidePreviewCacheListener, css::awt::XMouseListener, css::awt::XMouseMotionListener, css::drawing::XDrawView > PresenterSlideSorterInterfaceBase
const double gnHorizontalBorder(15)
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
const double gnVerticalBorder(5)
SwNodeOffset abs(const SwNodeOffset &a)
const tools::Long nButtonWidth