26#include <com/sun/star/awt/PosSize.hpp>
27#include <com/sun/star/awt/XWindowPeer.hpp>
28#include <com/sun/star/drawing/XPresenterHelper.hpp>
29#include <com/sun/star/rendering/CompositeOperation.hpp>
30#include <com/sun/star/rendering/TextDirection.hpp>
42 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
43 const ::rtl::Reference<PresenterController>& rpPresenterController,
44 const std::shared_ptr<PresenterTheme>& rpTheme,
45 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
46 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
47 const OUString& rsConfigurationName)
51 rsConfigurationName));
60 if (rpTheme !=
nullptr)
61 pFont = rpTheme->GetFont(
"ButtonFont");
64 if (rpTheme !=
nullptr)
65 pMouseOverFont = rpTheme->GetFont(
"ButtonMouseOverFont");
70 rpPresenterController,
77 pButton->SetCanvas(rxParentCanvas, rxParentWindow);
85 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
87 std::shared_ptr<PresenterTheme> xTheme,
88 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
95 mpTheme(
std::move(xTheme)),
98 mpMouseOverFont(
std::move(xMouseOverFont)),
105 Reference<lang::XMultiComponentFactory>
xFactory (rxComponentContext->getServiceManager());
110 xFactory->createInstanceWithContext(
111 "com.sun.star.comp.Draw.PresenterHelper",
123 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY_THROW);
124 xPeer->setBackground(0xff000000);
143 Reference<lang::XComponent> xComponent (
mxCanvas, UNO_QUERY);
146 xComponent->dispose();
151 mxWindow->removePaintListener(
this);
152 mxWindow->removeMouseListener(
this);
153 Reference<lang::XComponent> xComponent =
mxWindow;
156 xComponent->dispose();
172 awt::PosSize::POSSIZE);
184 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
185 const css::uno::Reference<css::awt::XWindow>& rxParentWindow)
189 Reference<lang::XComponent> xComponent (
mxCanvas, UNO_QUERY);
192 xComponent->dispose();
199 Reference<rendering::XSpriteCanvas>(rxParentCanvas, UNO_QUERY),
226 Reference<rendering::XBitmap> xBitmap;
234 rendering::ViewState aViewState(
235 geometry::AffineMatrix2D(1,0,0, 0,1,0),
237 rendering::RenderState aRenderState(
238 geometry::AffineMatrix2D(1,0,0, 0,1,0),
241 rendering::CompositeOperation::SOURCE);
243 mxCanvas->drawBitmap(xBitmap, aViewState, aRenderState);
245 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
246 if (xSpriteCanvas.is())
247 xSpriteCanvas->updateScreen(
false);
300 return geometry::IntegerSize2D(-1,-1);
304 return geometry::IntegerSize2D (
310 const Reference<rendering::XCanvas>& rxCanvas,
311 const geometry::IntegerSize2D& rSize,
318 if ( ! rxCanvas.is())
321 const awt::Rectangle aBox(0,0, rSize.Width, rSize.Height);
331 if (!rpFont || ! rpFont->mxFont.is())
334 const rendering::StringContext aContext (
msText, 0,
msText.getLength());
335 const Reference<rendering::XTextLayout> xLayout (
336 rpFont->mxFont->createTextLayout(aContext,rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
337 const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
339 rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr,
340 Sequence<double>(4), rendering::CompositeOperation::SOURCE);
343 aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2;
344 aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1;
347 rxCanvas->drawTextLayout(
349 rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr),
389 Reference<rendering::XCanvas> xCanvas (
mxNormalBitmap, UNO_QUERY);
416 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
417 const OUString& rsConfigurationName)
423 return Reference<beans::XPropertySet>(
425 Reference<container::XNameAccess>(
428 [&rsConfigurationName](OUString
const&, uno::Reference<beans::XPropertySet>
const& xProps) ->
bool
430 return PresenterConfigurationAccess::IsStringPropertyEqual(
431 rsConfigurationName,
"Name", xProps);
438 if (rBHelper.bDisposed || rBHelper.bInDispose)
440 throw lang::DisposedException (
441 "PresenterButton object has already been disposed",
442 const_cast<uno::XWeak*
>(
static_cast<const uno::XWeak*
>(
this)));
PresenterTheme::SharedFontDescriptor mpFont
rtl::Reference< PresenterController > mpPresenterController
There is one bitmap for the normal state, one for a mouse over effect and one to show that a button h...
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 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...
static css::uno::Any Find(const css::uno::Reference< css::container::XNameAccess > &rxContainer, const Predicate &rPredicate)
static constexpr OUStringLiteral msPresenterScreenRootName
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
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)
Reference< XSingleServiceFactory > xFactory
::cppu::WeakComponentImplHelper< css::awt::XPaintListener, css::awt::XMouseListener > PresenterButtonInterfaceBase
const double gnHorizontalBorder(15)
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
const double gnVerticalBorder(5)