31 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
32 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
33 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
34 #include <com/sun/star/rendering/CompositeOperation.hpp>
35 #include <com/sun/star/rendering/TextDirection.hpp>
44 const sal_Int32 gnVerticalGap (10);
46 const sal_Int32 gnHorizontalGap (10);
49 const double gnMinimalPreviewWidth (200);
50 const double gnPreferredPreviewWidth (300);
51 const double gnMaximalPreviewWidth (400);
52 const sal_Int32 gnPreferredColumnCount (6);
53 const double gnMinimalHorizontalPreviewGap(15);
54 const double gnPreferredHorizontalPreviewGap(25);
55 const double gnMaximalHorizontalPreviewGap(50);
56 const double gnPreferredVerticalPreviewGap(25);
58 const sal_Int32 gnHorizontalLabelBorder (3);
59 const sal_Int32 gnHorizontalLabelPadding (5);
61 const sal_Int32 gnVerticalButtonPadding (gnVerticalGap);
67 sal_Int32
round (
const double nValue) {
return sal::static_int_cast<sal_Int32>(0.5 + nValue); }
68 sal_Int32 floor (
const double nValue) {
return sal::static_int_cast<sal_Int32>(nValue); }
76 explicit Layout (const ::rtl::Reference<PresenterScrollBar>& rpVerticalScrollBar);
78 void Update (
const geometry::RealRectangle2D& rBoundingBox,
const double nSlideAspectRatio);
82 geometry::RealPoint2D
GetLocalPosition (
const geometry::RealPoint2D& rWindowPoint)
const;
83 geometry::RealPoint2D
GetWindowPosition(
const geometry::RealPoint2D& rLocalPoint)
const;
84 sal_Int32
GetColumn (
const geometry::RealPoint2D& rLocalPoint)
const;
85 sal_Int32
GetRow (
const geometry::RealPoint2D& rLocalPoint,
86 const bool bReturnInvalidValue =
false)
const;
88 css::geometry::RealPoint2D
GetPoint (
89 const sal_Int32 nSlideIndex,
90 const sal_Int32 nRelativeHorizontalPosition,
91 const sal_Int32 nRelativeVerticalPosition)
const;
92 css::awt::Rectangle
GetBoundingBox (
const sal_Int32 nSlideIndex)
const;
118 sal_Int32
GetIndex (
const sal_Int32 nRow,
const sal_Int32 nColumn)
const;
119 sal_Int32
GetRow (
const sal_Int32 nSlideIndex)
const;
120 sal_Int32
GetColumn (
const sal_Int32 nSlideIndex)
const;
129 const Reference<container::XIndexAccess>& rxSlides,
130 const std::shared_ptr<PresenterTheme>& rpTheme,
131 const Reference<awt::XWindow>& rxInvalidateTarget,
132 const std::shared_ptr<PresenterPaintManager>& rpPaintManager);
137 const sal_Int32 nSlideIndex,
138 const Reference<rendering::XCanvas>& rxCanvas,
139 const Reference<rendering::XPolyPolygon2D>& rxClip);
142 const sal_Int32 nSlideIndex,
143 const awt::Rectangle& rBox);
160 const Reference<rendering::XCanvas>& rxCanvas);
165 const OUString& rsText,
166 const sal_Int32 nMaximalWidth)
const;
169 const OUString& rsText)
const;
170 OUString
GetFittingText (
const OUString& rsText,
const double nMaximalWidth)
const;
172 const Reference<rendering::XCanvas>& rxCanvas,
173 const geometry::IntegerSize2D& rSize)
const;
182 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
183 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
186 const awt::Rectangle& rSlideBoundingBox,
187 const Reference<rendering::XCanvas>& rxCanvas,
188 const geometry::RealRectangle2D& rClipBox);
193 const awt::Rectangle& rSlideBoundingBox);
210 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
211 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
212 const Reference<rendering::XPolyPolygon2D>& rxClip,
216 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
217 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
218 const geometry::RealRectangle2D& rClipBox,
222 const double nHeight);
229 const Reference<XResourceId>& rxViewId,
230 const Reference<frame::XController>& rxController,
231 const ::rtl::Reference<PresenterController>& rpPresenterController)
237 mbIsLayoutPending(true),
238 mnSlideIndexMousePressed(-1),
239 mnCurrentSlideIndex(-1),
241 maSeparatorColor(0x00ffffff)
243 if ( ! rxContext.is()
245 || ! rxController.is()
246 || ! rpPresenterController)
248 throw lang::IllegalArgumentException();
257 Reference<XControllerManager> xCM (rxController, UNO_QUERY_THROW);
258 Reference<XConfigurationController> xCC (
259 xCM->getConfigurationController(), UNO_SET_THROW);
260 Reference<lang::XMultiComponentFactory>
xFactory (
263 mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW);
270 mxWindow->addMouseMotionListener(
this);
290 "SlideSorterCloser");
305 xFactory->createInstanceWithContext(
306 "com.sun.star.drawing.PresenterPreviewCache",
310 mxPreviewCache->setDocumentSlides(xSlides, rxController->getModel());
314 mpLayout->mnSlideCount = xSlides->getCount();
326 xControllerProperties->addPropertyChangeListener(
332 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
357 xComponent->dispose();
364 xComponent->dispose();
371 xComponent->removeEventListener(static_cast<awt::XWindowListener*>(
this));
386 xComponent->dispose();
391 mxWindow->removeWindowListener(
this);
392 mxWindow->removePaintListener(
this);
393 mxWindow->removeMouseListener(
this);
394 mxWindow->removeMouseMotionListener(
this);
402 if (rEventObject.Source ==
mxWindow)
412 else if (rEventObject.Source ==
mxCanvas)
455 Paint(rEvent.UpdateRect);
457 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
458 if (xSpriteCanvas.is())
459 xSpriteCanvas->updateScreen(
false);
466 css::awt::MouseEvent rTemp =rEvent;
469 awt::Rectangle aBox =
mxWindow->getPosSize();
470 rTemp.X=aBox.Width-rEvent.X;
472 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
478 css::awt::MouseEvent rTemp =rEvent;
481 awt::Rectangle aBox =
mxWindow->getPosSize();
482 rTemp.X=aBox.Width-rEvent.X;
484 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
485 const sal_Int32 nSlideIndex (
mpLayout->GetSlideIndexForPosition(aPosition));
490 switch (rEvent.ClickCount)
522 css::awt::MouseEvent rTemp =rEvent;
525 awt::Rectangle aBox =
mxWindow->getPosSize();
526 rTemp.X=aBox.Width-rEvent.X;
528 const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y);
529 sal_Int32 nSlideIndex (
mpLayout->GetSlideIndexForPosition(aPosition));
540 mpLayout->GetBoundingBox(nSlideIndex));
562 const css::beans::PropertyChangeEvent&)
568 sal_Int32 nSlideIndex)
572 awt::Rectangle aBBox (
mpLayout->GetBoundingBox(nSlideIndex));
581 ::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
621 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
622 sal_Int32 nLeftBorderWidth (aWindowBox.X);
632 if ( ! pPane->mxPane.is())
635 Reference<drawing::framework::XPaneBorderPainter> xBorderPainter (
636 pPane->mxPane->GetPaneBorderPainter());
637 if ( ! xBorderPainter.is())
639 xBorderPainter->addBorder (
640 mxViewId->getAnchor()->getResourceURL(),
641 awt::Rectangle(0, 0, aWindowBox.Width, aWindowBox.Height),
642 drawing::framework::BorderType_INNER_BORDER);
651 geometry::RealRectangle2D aUpperBox(
667 mpLayout->GetFirstVisibleSlideIndex(),
668 mpLayout->GetLastVisibleSlideIndex());
675 const geometry::RealRectangle2D& rUpperBox)
678 bool bIsScrollBarNeeded (
false);
680 bIsScrollBarNeeded =
mpLayout->IsScrollBarNeeded(xSlides->getCount());
683 if (bIsScrollBarNeeded)
695 return geometry::RealRectangle2D(
712 return geometry::RealRectangle2D(
727 const awt::Rectangle& rCenterBox,
728 const sal_Int32 nLeftBorderWidth)
733 sal_Int32 nCloseButtonCenter (rCenterBox.Width/2);
734 if (rpPane && rpPane->mxPane.is())
736 const sal_Int32 nCalloutCenter (-nLeftBorderWidth);
737 const sal_Int32 nDistanceFromWindowCenter (
abs(nCalloutCenter - rCenterBox.Width/2));
739 const static sal_Int32 nMaxDistanceForCalloutCentering (
nButtonWidth * 2);
740 if (nDistanceFromWindowCenter < nMaxDistanceForCalloutCentering)
744 else if (nCalloutCenter > rCenterBox.Width-
nButtonWidth/2)
747 nCloseButtonCenter = nCalloutCenter;
756 const Reference<rendering::XCanvas>& rxCanvas,
757 const awt::Rectangle& rUpdateBox)
759 OSL_ASSERT(rxCanvas.is());
761 const awt::Rectangle aWindowBox (
mxWindow->getPosSize());
766 awt::Rectangle(0,0,aWindowBox.Width,aWindowBox.Height),
772 double nSlideAspectRatio (28.0/21.0);
780 sal_Int32 nWidth (28000);
781 sal_Int32 nHeight (21000);
782 if ((xProperties->getPropertyValue(
"Width") >>= nWidth)
783 && (xProperties->getPropertyValue(
"Height") >>= nHeight)
786 nSlideAspectRatio = double(nWidth) / double(nHeight);
795 return nSlideAspectRatio;
800 if (nSlideIndex < 0 || nSlideIndex>=
mpLayout->mnSlideCount)
809 const Reference<rendering::XCanvas>& rxCanvas,
810 const css::awt::Rectangle& rUpdateBox,
811 const sal_Int32 nSlideIndex)
813 OSL_ASSERT(rxCanvas.is());
815 geometry::IntegerSize2D aSize (
mpLayout->maPreviewSize);
819 mpLayout->GetBoundingBox(nSlideIndex)))
824 Reference<rendering::XBitmap> xPreview (
GetPreview(nSlideIndex));
827 const geometry::RealPoint2D aTopLeft (
829 mpLayout->GetPoint(nSlideIndex, isRTL?1:-1, -1)));
832 "PresenterScreenSettings/ScrollBar/Bitmaps",
833 std::shared_ptr<PresenterBitmapContainer>(),
843 geometry::RealRectangle2D aBoundingBox (
mpLayout->maBoundingBox);
844 aBoundingBox.Y2 += 1;
845 const geometry::RealRectangle2D aClipBox (
849 Reference<rendering::XPolyPolygon2D> xClip (
852 const rendering::ViewState aViewState (geometry::AffineMatrix2D(1,0,0, 0,1,0), xClip);
854 rendering::RenderState aRenderState (
855 geometry::AffineMatrix2D(
860 rendering::CompositeOperation::SOURCE);
867 const awt::Rectangle aSlideBoundingBox(
868 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.X),
869 sal::static_int_cast<sal_Int32>(0.5 + aTopLeft.Y),
884 aSize = xPreview->getSize();
885 if (aSize.Width > 0 && aSize.Height > 0)
887 rxCanvas->drawBitmap(xPreview, aViewState, aRenderState);
888 if( bCustomAnimation )
890 const awt::Rectangle aAnimationPreviewBox(aTopLeft.X+3, aTopLeft.Y+aSize.Height-40, 0, 0);
892 Reference<rendering::XBitmap> xAnimationIcon (aAnimationDescriptor->GetNormalBitmap());
893 rendering::RenderState aAnimationRenderState (
894 geometry::AffineMatrix2D(
895 1, 0, aAnimationPreviewBox.X,
896 0, 1, aAnimationPreviewBox.Y),
899 rendering::CompositeOperation::SOURCE);
900 rxCanvas->drawBitmap(xAnimationIcon, aViewState, aAnimationRenderState);
904 const awt::Rectangle aTransitionPreviewBox(aTopLeft.X+3, aTopLeft.Y+aSize.Height-20, 0, 0);
906 Reference<rendering::XBitmap> xTransitionIcon (aTransitionDescriptor->GetNormalBitmap());
907 rendering::RenderState aTransitionRenderState (
908 geometry::AffineMatrix2D(
909 1, 0, aTransitionPreviewBox.X,
910 0, 1, aTransitionPreviewBox.Y),
913 rendering::CompositeOperation::SOURCE);
914 rxCanvas->drawBitmap(xTransitionIcon, aViewState, aTransitionRenderState);
923 awt::Rectangle(-1, -1, aSize.Width+2, aSize.Height+2),
924 rxCanvas->getDevice());
929 const util::Color aFrameColor (0x00000000);
931 rxCanvas->drawPolyPolygon(
mxPreviewFrame, aViewState, aRenderState);
940 const bool bCanvasChanged ( !
mxCanvas.is());
966 rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0),
967 nullptr, Sequence<double>(4), rendering::CompositeOperation::SOURCE);
972 rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr),
981 [
this, &rUpdateBox] (sal_Int32
const nIndex) {
986 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
987 if (xSpriteCanvas.is())
988 xSpriteCanvas->updateScreen(
false);
993 if (
mpLayout->SetHorizontalOffset(nXOffset))
996 mpLayout->GetFirstVisibleSlideIndex(),
997 mpLayout->GetLastVisibleSlideIndex());
1005 if (
mpLayout->SetVerticalOffset(nYOffset))
1008 mpLayout->GetFirstVisibleSlideIndex(),
1009 mpLayout->GetLastVisibleSlideIndex());
1030 if (xComponent.is())
1031 xComponent->addEventListener(static_cast<awt::XWindowListener*>(
this));
1041 if (rBHelper.bDisposed || rBHelper.bInDispose)
1043 throw lang::DisposedException (
1044 "PresenterSlideSorter has been already disposed",
1045 static_cast<uno::XWeak*>(
this));
1052 const ::rtl::Reference<PresenterScrollBar>& rpVerticalScrollBar)
1053 : mnHorizontalOffset(0),
1057 mnHorizontalBorder(0),
1058 mnVerticalBorder(0),
1062 mnFirstVisibleColumn(-1),
1063 mnLastVisibleColumn(-1),
1064 mnFirstVisibleRow(-1),
1065 mnLastVisibleRow(-1),
1066 mpVerticalScrollBar(rpVerticalScrollBar)
1071 const geometry::RealRectangle2D& rBoundingBox,
1072 const double nSlideAspectRatio)
1074 maBoundingBox = rBoundingBox;
1079 const double nWidth (rBoundingBox.X2 - rBoundingBox.X1 - 2*mnHorizontalBorder);
1080 const double nHeight (rBoundingBox.Y2 - rBoundingBox.Y1 - 2*mnVerticalBorder);
1081 if (nWidth<=0 || nHeight<=0)
1084 double nPreviewWidth;
1090 const double nElementWidth = nWidth / gnPreferredColumnCount;
1091 if (nElementWidth < gnMinimalPreviewWidth + gnMinimalHorizontalPreviewGap)
1095 if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
1098 nPreviewWidth = gnPreferredPreviewWidth;
1099 mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
1100 / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
1101 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1108 mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
1109 if (nWidth - gnMinimalHorizontalPreviewGap >= gnPreferredPreviewWidth)
1110 nPreviewWidth = nWidth - gnMinimalHorizontalPreviewGap;
1112 nPreviewWidth = ::std::max(gnMinimalPreviewWidth, nWidth-mnHorizontalGap);
1115 else if (nElementWidth > gnMaximalPreviewWidth + gnMaximalHorizontalPreviewGap)
1118 nPreviewWidth = gnPreferredPreviewWidth;
1119 mnColumnCount = floor((nWidth+gnPreferredHorizontalPreviewGap)
1120 / (nPreviewWidth+gnPreferredHorizontalPreviewGap));
1121 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1127 mnColumnCount = gnPreferredColumnCount;
1128 if (nElementWidth - gnPreferredPreviewWidth < gnMinimalHorizontalPreviewGap)
1131 mnHorizontalGap = floor(gnMinimalHorizontalPreviewGap);
1132 nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
1134 else if (nElementWidth - gnPreferredPreviewWidth <= gnMaximalHorizontalPreviewGap)
1137 mnHorizontalGap =
round(gnMaximalHorizontalPreviewGap);
1138 nPreviewWidth = (nWidth - mnColumnCount*mnHorizontalGap) / mnColumnCount;
1143 nPreviewWidth = gnPreferredPreviewWidth;
1144 mnHorizontalGap =
round((nWidth - mnColumnCount*nPreviewWidth) / mnColumnCount);
1149 const double nPreviewHeight = nPreviewWidth / nSlideAspectRatio;
1150 mnRowCount = ::std::max(
1152 sal_Int32(ceil((nHeight+gnPreferredVerticalPreviewGap)
1153 / (nPreviewHeight + gnPreferredVerticalPreviewGap))));
1154 mnVerticalGap =
round(gnPreferredVerticalPreviewGap);
1156 maPreviewSize = geometry::IntegerSize2D(floor(nPreviewWidth), floor(nPreviewHeight));
1160 mnHorizontalOffset =
round(-(nWidth
1161 - mnColumnCount*maPreviewSize.Width
1162 - (mnColumnCount-1)*mnHorizontalGap)
1168 geometry::RealPoint2D aPoint (GetLocalPosition(
1169 geometry::RealPoint2D(maBoundingBox.X1, maBoundingBox.Y1)));
1170 mnFirstVisibleColumn = 0;
1171 mnFirstVisibleRow = ::std::max(sal_Int32(0), GetRow(aPoint));
1173 aPoint = GetLocalPosition(geometry::RealPoint2D( maBoundingBox.X2, maBoundingBox.Y2));
1174 mnLastVisibleColumn = mnColumnCount - 1;
1175 mnLastVisibleRow = GetRow(aPoint,
true);
1180 geometry::RealPoint2D aBottomRight = GetPoint(
1181 mnColumnCount * (GetRow(nSlideCount)+1) - 1, +1, +1);
1182 return aBottomRight.X > maBoundingBox.X2-maBoundingBox.X1
1183 || aBottomRight.Y > maBoundingBox.Y2-maBoundingBox.Y1;
1187 const geometry::RealPoint2D& rWindowPoint)
const
1191 return css::geometry::RealPoint2D(
1192 -rWindowPoint.X + maBoundingBox.X2 + mnHorizontalOffset,
1197 return css::geometry::RealPoint2D(
1198 rWindowPoint.X - maBoundingBox.X1 + mnHorizontalOffset,
1204 const geometry::RealPoint2D& rLocalPoint)
const
1208 return css::geometry::RealPoint2D(
1209 -rLocalPoint.X + mnHorizontalOffset + maBoundingBox.X2,
1214 return css::geometry::RealPoint2D(
1215 rLocalPoint.X - mnHorizontalOffset + maBoundingBox.X1,
1221 const css::geometry::RealPoint2D& rLocalPoint)
const
1223 const sal_Int32 nColumn(floor(
1224 (rLocalPoint.X + mnHorizontalGap/2.0) / (maPreviewSize.Width+mnHorizontalGap)));
1225 if (nColumn>=mnFirstVisibleColumn && nColumn<=mnLastVisibleColumn)
1234 const css::geometry::RealPoint2D& rLocalPoint,
1235 const bool bReturnInvalidValue)
const
1237 const sal_Int32 nRow (floor(
1238 (rLocalPoint.Y + mnVerticalGap/2.0) / (maPreviewSize.Height+mnVerticalGap)));
1239 if (bReturnInvalidValue
1240 || (nRow>=mnFirstVisibleRow && nRow<=mnLastVisibleRow))
1249 const css::geometry::RealPoint2D& rWindowPoint)
const
1254 const css::geometry::RealPoint2D aLocalPosition (GetLocalPosition(rWindowPoint));
1255 const sal_Int32 nColumn (GetColumn(aLocalPosition));
1256 const sal_Int32 nRow (GetRow(aLocalPosition));
1258 if (nColumn < 0 || nRow < 0)
1262 sal_Int32
nIndex (GetIndex(nRow, nColumn));
1263 if (nIndex >= mnSlideCount)
1271 const sal_Int32 nSlideIndex,
1272 const sal_Int32 nRelativeHorizontalPosition,
1273 const sal_Int32 nRelativeVerticalPosition)
const
1275 sal_Int32 nColumn (GetColumn(nSlideIndex));
1276 sal_Int32 nRow (GetRow(nSlideIndex));
1278 geometry::RealPoint2D aPosition (
1279 mnHorizontalBorder + nColumn*(maPreviewSize.Width+mnHorizontalGap),
1280 mnVerticalBorder + nRow*(maPreviewSize.Height+mnVerticalGap));
1282 if (nRelativeHorizontalPosition >= 0)
1284 if (nRelativeHorizontalPosition > 0)
1285 aPosition.X += maPreviewSize.Width;
1287 aPosition.X += maPreviewSize.Width / 2.0;
1289 if (nRelativeVerticalPosition >= 0)
1291 if (nRelativeVerticalPosition > 0)
1292 aPosition.Y += maPreviewSize.Height;
1294 aPosition.Y += maPreviewSize.Height / 2.0;
1303 const geometry::RealPoint2D aWindowPosition(GetWindowPosition(GetPoint(nSlideIndex, isRTL?1:-1, -1)));
1305 geometry::RealRectangle2D(
1308 aWindowPosition.X + maPreviewSize.Width,
1309 aWindowPosition.Y + maPreviewSize.Height));
1313 const ::std::function<
void (sal_Int32)>& rAction)
1315 for (sal_Int32 nRow=mnFirstVisibleRow; nRow<=mnLastVisibleRow; ++nRow)
1317 for (sal_Int32 nColumn=mnFirstVisibleColumn; nColumn<=mnLastVisibleColumn; ++nColumn)
1319 const sal_Int32 nSlideIndex (GetIndex(nRow, nColumn));
1320 if (nSlideIndex >= mnSlideCount)
1322 rAction(nSlideIndex);
1329 return GetIndex(mnFirstVisibleRow, mnFirstVisibleColumn);
1335 GetIndex(mnLastVisibleRow, mnLastVisibleColumn),
1341 if (mnHorizontalOffset != nOffset)
1343 mnHorizontalOffset =
round(nOffset);
1367 sal_Int32 nTotalRowCount = sal_Int32(ceil(
double(mnSlideCount) /
double(mnColumnCount)));
1372 nTotalRowCount * maPreviewSize.Height
1373 + (nTotalRowCount-1) * mnVerticalGap
1384 const sal_Int32 nRow,
1385 const sal_Int32 nColumn)
const
1387 return nRow * mnColumnCount + nColumn;
1392 return nSlideIndex / mnColumnCount;
1397 return nSlideIndex % mnColumnCount;
1403 const Reference<container::XIndexAccess>& rxSlides,
1404 const std::shared_ptr<PresenterTheme>& rpTheme,
1405 const Reference<awt::XWindow>& rxInvalidateTarget,
1406 const std::shared_ptr<PresenterPaintManager>& rpPaintManager)
1407 : mxSlides(rxSlides),
1409 mxInvalidateTarget(rxInvalidateTarget),
1410 mpPaintManager(rpPaintManager)
1412 if (rpTheme !=
nullptr)
1414 std::shared_ptr<PresenterBitmapContainer> pBitmaps (rpTheme->GetBitmapContainer());
1415 if (pBitmaps !=
nullptr)
1422 mpFont = rpTheme->GetFont(
"SlideSorterLabelFont");
1427 const sal_Int32 nSlideIndex,
1428 const Reference<rendering::XCanvas>& rxCanvas,
1429 const Reference<rendering::XPolyPolygon2D>& rxClip)
1431 if (nSlideIndex != mnSlideIndex)
1435 SetCanvas(rxCanvas);
1436 if (rxCanvas ==
nullptr)
1444 geometry::IntegerSize2D aSize (
mxBitmap->getSize());
1445 const double nXOffset (maSlideBoundingBox.X
1446 + (maSlideBoundingBox.Width - aSize.Width) / 2.0);
1447 const double nYOffset (maSlideBoundingBox.Y
1448 + (maSlideBoundingBox.Height - aSize.Height) / 2.0);
1449 rxCanvas->drawBitmap(
1451 rendering::ViewState(
1452 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1454 rendering::RenderState(
1455 geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
1457 Sequence<double>(4),
1458 rendering::CompositeOperation::SOURCE));
1462 const Reference<rendering::XCanvas>& rxCanvas)
1470 const sal_Int32 nSlideIndex,
1471 const awt::Rectangle& rBox)
1473 if (mnSlideIndex == nSlideIndex)
1479 maSlideBoundingBox = rBox;
1480 mnSlideIndex = nSlideIndex;
1482 if (nSlideIndex >= 0)
1489 if (xSlideProperties.is())
1490 xSlideProperties->getPropertyValue(
"LinkDisplayName") >>=
msText;
1493 msText =
"Slide " + OUString::number(nSlideIndex + 1);
1506 const OUString& rsText,
1507 const sal_Int32 nMaximalWidth)
const
1516 const OUString sText (GetFittingText(rsText, nMaximalWidth
1517 - 2*gnHorizontalLabelBorder
1518 - 2*gnHorizontalLabelPadding));
1523 geometry::IntegerSize2D aLabelSize (CalculateLabelSize(sText));
1526 Reference<rendering::XBitmap> xBitmap (
1527 mxCanvas->getDevice()->createCompatibleAlphaBitmap(aLabelSize));
1529 if ( ! xBitmap.is())
1532 Reference<rendering::XBitmapCanvas> xBitmapCanvas (xBitmap, UNO_QUERY);
1533 if ( ! xBitmapCanvas.is())
1537 PaintButtonBackground(xBitmapCanvas, aLabelSize);
1540 if (!sText.isEmpty())
1543 const rendering::StringContext aContext (sText, 0, sText.getLength());
1544 const Reference<rendering::XTextLayout> xLayout (
mpFont->mxFont->createTextLayout(
1545 aContext, rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
1546 const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
1548 const double nXOffset = (aLabelSize.Width - aTextBBox.X2 + aTextBBox.X1) / 2;
1549 const double nYOffset = aLabelSize.Height
1550 - (aLabelSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y2;
1552 const rendering::ViewState aViewState(
1553 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1556 rendering::RenderState aRenderState (
1557 geometry::AffineMatrix2D(1,0,nXOffset, 0,1,nYOffset),
1559 Sequence<double>(4),
1560 rendering::CompositeOperation::SOURCE);
1563 xBitmapCanvas->drawTextLayout (
1573 const OUString& rsText,
1574 const double nMaximalWidth)
const
1576 const double nTextWidth (
1578 if (nTextWidth > nMaximalWidth)
1584 double nBestWidth (0);
1585 OUString sBestCandidate;
1586 sal_Int32
nLength (
round(rsText.getLength() * nMaximalWidth / nTextWidth));
1587 static const OUStringLiteral sEllipses (
u"...");
1590 const OUString sCandidate (rsText.subView(0,nLength) + sEllipses);
1591 const double nWidth (
1593 if (nWidth > nMaximalWidth)
1600 else if (nWidth < nMaximalWidth)
1603 if (nWidth > nBestWidth)
1606 sBestCandidate = sCandidate;
1607 nBestWidth = nWidth;
1609 if (nLength >= rsText.getLength())
1619 sBestCandidate = sCandidate;
1623 return sBestCandidate;
1630 const OUString& rsText)
const
1633 sal_Int32 nHeight (32);
1634 if (mpCenterLabelBitmap)
1636 Reference<rendering::XBitmap> xBitmap (mpCenterLabelBitmap->GetNormalBitmap());
1638 nHeight = xBitmap->getSize().Height;
1642 const geometry::RealSize2D aTextSize (
1645 const sal_Int32 nWidth (
round(aTextSize.Width + 2*gnHorizontalLabelPadding));
1647 return geometry::IntegerSize2D(nWidth, nHeight);
1651 const Reference<rendering::XCanvas>& rxCanvas,
1652 const geometry::IntegerSize2D& rSize)
const
1655 Reference<rendering::XBitmap> xLeftLabelBitmap;
1656 if (mpLeftLabelBitmap)
1657 xLeftLabelBitmap = mpLeftLabelBitmap->GetNormalBitmap();
1659 Reference<rendering::XBitmap> xCenterLabelBitmap;
1660 if (mpCenterLabelBitmap)
1661 xCenterLabelBitmap = mpCenterLabelBitmap->GetNormalBitmap();
1663 Reference<rendering::XBitmap> xRightLabelBitmap;
1664 if (mpRightLabelBitmap)
1665 xRightLabelBitmap = mpRightLabelBitmap->GetNormalBitmap();
1669 awt::Rectangle(0,0, rSize.Width,rSize.Height),
1670 awt::Rectangle(0,0, rSize.Width,rSize.Height),
1678 if (mpPaintManager !=
nullptr)
1679 mpPaintManager->Invalidate(mxInvalidateTarget, maSlideBoundingBox,
true);
1685 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
1686 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas)
1687 : mnTopFrameSize(0),
1689 mnRightFrameSize(0),
1690 mnBottomFrameSize(0)
1694 "/org.openoffice.Office.PresenterScreen/",
1696 Reference<container::XHierarchicalNameAccess> xBitmaps (
1698 "PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps"),
1700 if ( ! xBitmaps.is())
1704 "PresenterScreenSettings/SlideSorter/CurrentSlideBorderBitmaps",
1705 std::shared_ptr<PresenterBitmapContainer>(),
1751 const awt::Rectangle& rSlideBoundingBox,
1752 const Reference<rendering::XCanvas>& rxCanvas,
1753 const geometry::RealRectangle2D& rClipBox)
1755 if ( ! rxCanvas.is())
1758 const Reference<rendering::XPolyPolygon2D> xClip (
1764 mpTop->GetNormalBitmap(),
1767 rSlideBoundingBox.X,
1768 rSlideBoundingBox.Y -
mpTop->mnHeight,
1769 rSlideBoundingBox.Width,
1775 mpLeft->GetNormalBitmap(),
1778 rSlideBoundingBox.X -
mpLeft->mnWidth,
1779 rSlideBoundingBox.Y,
1781 rSlideBoundingBox.Height);
1789 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1790 rSlideBoundingBox.Y,
1792 rSlideBoundingBox.Height);
1800 rSlideBoundingBox.X,
1801 rSlideBoundingBox.Y + rSlideBoundingBox.Height,
1802 rSlideBoundingBox.Width,
1811 rSlideBoundingBox.X -
mpTopLeft->mnWidth,
1812 rSlideBoundingBox.Y -
mpTopLeft->mnHeight);
1820 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1821 rSlideBoundingBox.Y -
mpTopLeft->mnHeight);
1830 rSlideBoundingBox.Y + rSlideBoundingBox.Height);
1838 rSlideBoundingBox.X + rSlideBoundingBox.Width,
1839 rSlideBoundingBox.Y + rSlideBoundingBox.Height);
1844 const awt::Rectangle& rSlideBoundingBox)
1846 return awt::Rectangle(
1847 rSlideBoundingBox.X - mnLeftFrameSize,
1848 rSlideBoundingBox.Y - mnTopFrameSize,
1849 rSlideBoundingBox.Width + mnLeftFrameSize + mnRightFrameSize,
1850 rSlideBoundingBox.Height + mnTopFrameSize + mnBottomFrameSize);
1854 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
1855 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
1856 const Reference<rendering::XPolyPolygon2D>& rxClip,
1860 OSL_ASSERT(rxCanvas.is());
1861 if ( ! rxBitmap.is())
1864 const rendering::ViewState aViewState(
1865 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1868 const rendering::RenderState aRenderState (
1869 geometry::AffineMatrix2D(
1873 Sequence<double>(4),
1874 rendering::CompositeOperation::SOURCE);
1876 rxCanvas->drawBitmap(
1883 const css::uno::Reference<css::rendering::XBitmap>& rxBitmap,
1884 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
1885 const geometry::RealRectangle2D& rClipBox,
1888 const double nWidth,
1889 const double nHeight)
1891 OSL_ASSERT(rxCanvas.is());
1892 if ( ! rxBitmap.is())
1895 geometry::IntegerSize2D aSize (rxBitmap->getSize());
1897 const rendering::ViewState aViewState(
1898 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1902 geometry::RealRectangle2D(nX0,nY0,nX0+nWidth,nY0+nHeight)),
1903 rxCanvas->getDevice()));
1905 rendering::RenderState aRenderState (
1906 geometry::AffineMatrix2D(
1910 Sequence<double>(4),
1911 rendering::CompositeOperation::SOURCE);
1913 const double nX1 = nX0 + nWidth;
1914 const double nY1 = nY0 + nHeight;
1915 for (
double nY=nY0; nY<nY1; nY+=aSize.Height)
1916 for (
double nX=nX0; nX<nX1; nX+=aSize.Width)
1918 aRenderState.AffineTransform.m02 = nX;
1919 aRenderState.AffineTransform.m12 = nY;
1920 rxCanvas->drawBitmap(
std::shared_ptr< PresenterPaintManager > mpPaintManager
awt::Rectangle maSlideBoundingBox
geometry::IntegerSize2D CalculateLabelSize(const OUString &rsText) const
sal_Int32 GetIndex(const sal_Int32 nRow, const sal_Int32 nColumn) const
SharedBitmapDescriptor mpBottomRight
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
SharedBitmapDescriptor mpBottomLeft
std::shared_ptr< FontDescriptor > SharedFontDescriptor
void PaintPreview(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rUpdateBox, const sal_Int32 nSlideIndex)
double GetSlideAspectRatio() const
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
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...
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
sal_Int32 mnCurrentSlideIndex
static bool AreRectanglesDisjoint(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
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)
CurrentSlideFrameRenderer(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
virtual sal_Bool SAL_CALL isAnchorOnly() override
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
bool SetVerticalOffset(const double nOffset)
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
css::uno::Reference< css::drawing::XSlidePreviewCache > mxPreviewCache
sal_Int32 mnHorizontalGap
sal_Int32 GetFirstVisibleSlideIndex() const
css::uno::Reference< css::rendering::XBitmap > GetPreview(const sal_Int32 nSlideIndex)
sal_Int32 mnBottomFrameSize
SharedBitmapDescriptor mpRightLabelBitmap
static bool HasCustomAnimation(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
sal_Int32 GetRow(const geometry::RealPoint2D &rLocalPoint, const bool bReturnInvalidValue=false) const
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
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)
virtual ~PresenterSlideSorter() override
SharedBitmapDescriptor mpBottomLeft
SwNodeOffset abs(const SwNodeOffset &a)
::rtl::Reference< PresenterScrollBar > mpVerticalScrollBar
void Update(const geometry::RealRectangle2D &rBoundingBox, const double nSlideAspectRatio)
css::util::Color maSeparatorColor
css::awt::Rectangle GetBoundingBox(const sal_Int32 nSlideIndex) const
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
SharedBitmapDescriptor mpTopLeft
SharedBitmapDescriptor mpLeft
void PaintCurrentSlideFrame(const awt::Rectangle &rSlideBoundingBox, const Reference< rendering::XCanvas > &rxCanvas, const geometry::RealRectangle2D &rClipBox)
SharedBitmapDescriptor mpTop
void SetCanvas(const Reference< rendering::XCanvas > &rxCanvas)
::rtl::Reference< PresenterController > mpPresenterController
SharedBitmapDescriptor mpTopRight
This class gives access to the configuration.
sal_Int32 GetSlideIndexForPosition(const css::geometry::RealPoint2D &rPoint) const
SharedBitmapDescriptor mpCenterLabelBitmap
sal_Int32 mnHorizontalOffset
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
sal_Int32 mnLeftFrameSize
sal_Int32 mnVerticalBorder
virtual void SAL_CALL notifyPreviewCreation(sal_Int32 nSlideIndex) override
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)
MouseOverManager(const Reference< container::XIndexAccess > &rxSlides, const std::shared_ptr< PresenterTheme > &rpTheme, const Reference< awt::XWindow > &rxInvalidateTarget, const std::shared_ptr< PresenterPaintManager > &rpPaintManager)
void Paint(const sal_Int32 nSlideIndex, const Reference< rendering::XCanvas > &rxCanvas, const Reference< rendering::XPolyPolygon2D > &rxClip)
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
sal_Int32 mnLastVisibleColumn
SharedBitmapDescriptor mpTopRight
sal_Int32 mnVerticalOffset
css::uno::Reference< css::drawing::framework::XPane > mxPane
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
bool IsScrollBarNeeded(const sal_Int32 nSlideCount)
sal_Int32 mnHorizontalBorder
::rtl::Reference< PresenterScrollBar > mpVerticalScrollBar
css::uno::Reference< css::awt::XWindow > mxWindow
void PlaceCloseButton(const PresenterPaneContainer::SharedPaneDescriptor &rpPane, const css::awt::Rectangle &rCenterBox, const sal_Int32 nLeftFrameWidth)
Reference< rendering::XBitmap > mxBitmap
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...
sal_Int32 GetLastVisibleSlideIndex() const
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
virtual void SAL_CALL disposing() override
geometry::RealPoint2D GetWindowPosition(const geometry::RealPoint2D &rLocalPoint) const
static bool GetLayoutRTL()
void SetVerticalOffset(const double nYOffset)
sal_Int32 mnFirstVisibleRow
VclPtr< VirtualDevice > mxBitmap
void GotoSlide(const sal_Int32 nSlideIndex)
void ForAllVisibleSlides(const ::std::function< void(sal_Int32)> &rAction)
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
SharedBitmapDescriptor mpLeft
sal_Int32 mnLastVisibleRow
SharedBitmapDescriptor mpLeftLabelBitmap
SharedBitmapDescriptor mpRight
SharedBitmapDescriptor mpBottomRight
void SetSlide(const sal_Int32 nSlideIndex, const awt::Rectangle &rBox)
SharedBitmapDescriptor mpBottom
std::shared_ptr< BitmapDescriptor > GetBitmap(const OUString &rsName) const
Return the bitmap set that is associated with the given name.
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
css::geometry::RealPoint2D GetPoint(const sal_Int32 nSlideIndex, const sal_Int32 nRelativeHorizontalPosition, const sal_Int32 nRelativeVerticalPosition) const
std::shared_ptr< Layout > mpLayout
static css::awt::Rectangle ConvertRectangle(const css::geometry::RealRectangle2D &rBox)
Return the bounding box with integer coordinates of the given rectangle.
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
void ClearBackground(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const css::awt::Rectangle &rRedrawArea)
Layout(const ::rtl::Reference< PresenterScrollBar > &rpVerticalScrollBar)
css::uno::Reference< css::rendering::XCanvas > mxCanvas
css::uno::Reference< css::rendering::XPolyPolygon2D > mxPreviewFrame
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &rEvent) override
std::shared_ptr< CurrentSlideFrameRenderer > mpCurrentSlideFrameRenderer
void Paint(const css::awt::Rectangle &rUpdateBox)
Reference< awt::XWindow > mxInvalidateTarget
static css::awt::Rectangle Intersection(const css::awt::Rectangle &rBox1, const css::awt::Rectangle &rBox2)
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
PresenterTheme::SharedFontDescriptor mpFont
rtl::Reference< PresenterController > mpPresenterController
css::geometry::RealRectangle2D PlaceScrollBars(const css::geometry::RealRectangle2D &rUpperBox)
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
css::awt::Rectangle maCurrentSlideFrameBoundingBox
virtual void SAL_CALL mouseDragged(const css::awt::MouseEvent &rEvent) override
static void SetDeviceColor(css::rendering::RenderState &rRenderState, const css::util::Color aColor)
std::shared_ptr< PaneDescriptor > SharedPaneDescriptor
MouseOverManager & operator=(const MouseOverManager &)=delete
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
bool SetHorizontalOffset(const double nOffset)
sal_Int32 mnFirstVisibleColumn
static css::geometry::RealSize2D GetTextSize(const css::uno::Reference< css::rendering::XCanvasFont > &rxFont, const OUString &rsText)
PresenterSlideSorter(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)
OUString GetFittingText(const OUString &rsText, const double nMaximalWidth) const
SharedBitmapDescriptor mpTopLeft
const double gnHorizontalBorder(15)
::rtl::Reference< PresenterButton > mpCloseButton
const tools::Long nButtonWidth
void PaintButtonBackground(const Reference< rendering::XCanvas > &rxCanvas, const geometry::IntegerSize2D &rSize) const
awt::Rectangle GetBoundingBox(const awt::Rectangle &rSlideBoundingBox)
Enlarge the given rectangle to include the current slide indicator.
css::geometry::RealRectangle2D maBoundingBox
Reference< XSingleServiceFactory > xFactory
sal_Int32 mnSlideIndexMousePressed
SharedBitmapDescriptor mpRight
static bool IsInside(const css::geometry::RealRectangle2D &rBox, const css::geometry::RealPoint2D &rPoint)
const double gnVerticalBorder(5)
geometry::RealPoint2D GetLocalPosition(const geometry::RealPoint2D &rWindowPoint) const
Reference< rendering::XCanvas > mxCanvas
sal_Int32 GetColumn(const geometry::RealPoint2D &rLocalPoint) const
css::geometry::IntegerSize2D maPreviewSize
SharedBitmapDescriptor mpBottom
sal_Int32 mnRightFrameSize
static bool HasTransition(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
PresenterTheme::SharedFontDescriptor mpFont
virtual void SAL_CALL mouseMoved(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
SharedBitmapDescriptor mpTop
const Reference< container::XIndexAccess > mxSlides
bool mbIsPresenterViewActive
void SetHorizontalOffset(const double nXOffset)
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
Manage a set of bitmap groups as they are used for buttons: three bitmaps, one for the normal state...
std::unique_ptr< MouseOverManager > mpMouseOverManager