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>
41 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
42 const ::rtl::Reference<PresenterController>& rpPresenterController,
43 const std::shared_ptr<PresenterTheme>& rpTheme,
44 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
45 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
46 const OUString& rsConfigurationName)
50 rsConfigurationName));
59 if (rpTheme !=
nullptr)
60 pFont = rpTheme->GetFont(
"ButtonFont");
63 if (rpTheme !=
nullptr)
64 pMouseOverFont = rpTheme->GetFont(
"ButtonMouseOverFont");
69 rpPresenterController,
76 pButton->SetCanvas(rxParentCanvas, rxParentWindow);
84 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
85 const ::rtl::Reference<PresenterController>& rpPresenterController,
86 const std::shared_ptr<PresenterTheme>& rpTheme,
87 const css::uno::Reference<css::awt::XWindow>& rxParentWindow,
90 const OUString& rsText,
91 const OUString& rsAction)
100 mpMouseOverFont(rpMouseOverFont),
110 Reference<lang::XMultiComponentFactory>
xFactory (rxComponentContext->getServiceManager());
115 xFactory->createInstanceWithContext(
116 "com.sun.star.comp.Draw.PresenterHelper",
128 Reference<awt::XWindowPeer> xPeer (
mxWindow, UNO_QUERY_THROW);
129 xPeer->setBackground(0xff000000);
151 xComponent->dispose();
156 mxWindow->removePaintListener(
this);
157 mxWindow->removeMouseListener(
this);
161 xComponent->dispose();
177 awt::PosSize::POSSIZE);
189 const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas,
190 const css::uno::Reference<css::awt::XWindow>& rxParentWindow)
197 xComponent->dispose();
204 Reference<rendering::XSpriteCanvas>(rxParentCanvas, UNO_QUERY),
231 Reference<rendering::XBitmap> xBitmap;
239 rendering::ViewState aViewState(
240 geometry::AffineMatrix2D(1,0,0, 0,1,0),
242 rendering::RenderState aRenderState(
243 geometry::AffineMatrix2D(1,0,0, 0,1,0),
246 rendering::CompositeOperation::SOURCE);
248 mxCanvas->drawBitmap(xBitmap, aViewState, aRenderState);
250 Reference<rendering::XSpriteCanvas> xSpriteCanvas (
mxCanvas, UNO_QUERY);
251 if (xSpriteCanvas.is())
252 xSpriteCanvas->updateScreen(
false);
305 return geometry::IntegerSize2D(-1,-1);
309 return geometry::IntegerSize2D (
315 const Reference<rendering::XCanvas>& rxCanvas,
316 const geometry::IntegerSize2D& rSize,
323 if ( ! rxCanvas.is())
326 const awt::Rectangle aBox(0,0, rSize.Width, rSize.Height);
336 if (!rpFont || ! rpFont->mxFont.is())
339 const rendering::StringContext aContext (
msText, 0,
msText.getLength());
340 const Reference<rendering::XTextLayout> xLayout (
341 rpFont->mxFont->createTextLayout(aContext,rendering::TextDirection::WEAK_LEFT_TO_RIGHT,0));
342 const geometry::RealRectangle2D aTextBBox (xLayout->queryTextBounds());
344 rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr,
345 Sequence<double>(4), rendering::CompositeOperation::SOURCE);
348 aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2;
349 aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1;
352 rxCanvas->drawTextLayout(
354 rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0),
nullptr),
368 return mpIcon->GetBitmap(eMode);
390 if (maButtonSize.Height<=0 && maButtonSize.Width<= 0)
394 Reference<rendering::XCanvas> xCanvas (
mxNormalBitmap, UNO_QUERY);
421 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
422 const OUString& rsConfigurationName)
433 [&rsConfigurationName](OUString
const&, uno::Reference<beans::XPropertySet>
const& xProps) ->
bool
436 rsConfigurationName,
"Name", xProps);
443 if (rBHelper.bDisposed || rBHelper.bInDispose)
445 throw lang::DisposedException (
446 "PresenterButton object has already been disposed",
447 const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(
this)));
Reference< rendering::XCanvas > mxCanvas
There is one bitmap for the normal state, one for a mouse over effect and one to show that a button h...
std::shared_ptr< FontDescriptor > SharedFontDescriptor
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 constexpr OUStringLiteral msPresenterScreenRootName
::cppu::WeakComponentImplHelper< css::awt::XPaintListener, css::awt::XMouseListener > PresenterButtonInterfaceBase
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
Reference< drawing::XPresenterHelper > mxPresenterHelper
This class gives access to the configuration.
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)
static css::uno::Any Find(const css::uno::Reference< css::container::XNameAccess > &rxContainer, const Predicate &rPredicate)
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
static bool IsStringPropertyEqual(std::u16string_view rsValue, const OUString &rsPropertyName, const css::uno::Reference< css::beans::XPropertySet > &rxNode)
static css::uno::Reference< css::rendering::XPolyPolygon2D > CreatePolygon(const css::awt::Rectangle &rBox, const css::uno::Reference< css::rendering::XGraphicDevice > &rxDevice)
PresenterTheme::SharedFontDescriptor mpFont
rtl::Reference< PresenterController > mpPresenterController
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)
const double gnHorizontalBorder(15)
Reference< XSingleServiceFactory > xFactory
const double gnVerticalBorder(5)