1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 // This code strongly inspired by Miguel / Federico's Gnome Canvas demo code.
22 #include <sal/config.h>
24 #include <basegfx/polygon/b2dpolygon.hxx>
25 #include <basegfx/polygon/b2dpolygontools.hxx>
26 #include <basegfx/utils/canvastools.hxx>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/rendering/CompositeOperation.hpp>
29 #include <com/sun/star/rendering/FillRule.hpp>
30 #include <com/sun/star/rendering/PathCapType.hpp>
31 #include <com/sun/star/rendering/PathJoinType.hpp>
32 #include <com/sun/star/rendering/RenderState.hpp>
33 #include <com/sun/star/rendering/ViewState.hpp>
34 #include <com/sun/star/rendering/XBitmap.hpp>
35 #include <com/sun/star/rendering/XCanvas.hpp>
36 #include <com/sun/star/rendering/XGraphicDevice.hpp>
37 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
38 #include <com/sun/star/ucb/UniversalContentBroker.hpp>
39 #include <comphelper/processfactory.hxx>
40 #include <comphelper/random.hxx>
41 #include <cppuhelper/bootstrap.hxx>
42 #include <vcl/canvastools.hxx>
43 #include <vcl/svapp.hxx>
44 #include <vcl/vclmain.hxx>
45 #include <vcl/virdev.hxx>
46 #include <vcl/window.hxx>
47 #include <vcl/wrkwin.hxx>
49 using namespace ::com::sun::star
;
51 static void PrintHelp()
53 fprintf( stdout
, "canvasdemo - Exercise the new canvas impl\n" );
56 class TestWindow
: public WorkWindow
59 TestWindow() : WorkWindow(nullptr, WB_APP
| WB_STDWORK
)
61 SetText("Canvas test");
62 SetSizePixel( Size( 600, 450 ) );
66 virtual ~TestWindow() override
{}
67 virtual void MouseButtonUp( const MouseEvent
& /*rMEvt*/ ) override
69 //TODO: do something cool
72 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
80 rendering::ViewState maViewState
;
81 rendering::RenderState maRenderState
;
82 uno::Sequence
< double > maColorBlack
;
83 uno::Sequence
< double > maColorWhite
;
84 uno::Sequence
< double > maColorRed
;
85 uno::Reference
< rendering::XCanvas
> mxCanvas
;
86 uno::Reference
< rendering::XCanvasFont
> mxDefaultFont
;
87 uno::Reference
< rendering::XGraphicDevice
> mxDevice
;
89 DemoRenderer( uno::Reference
< rendering::XGraphicDevice
> xDevice
,
90 uno::Reference
< rendering::XCanvas
> xCanvas
,
96 maColorBlack( vcl::unotools::colorToStdColorSpaceSequence( COL_BLACK
) ),
97 maColorWhite( vcl::unotools::colorToStdColorSpaceSequence( COL_WHITE
) ),
98 maColorRed( vcl::unotools::colorToStdColorSpaceSequence( COL_RED
) ),
104 geometry::AffineMatrix2D
aUnit( 1,0, 0,
106 maViewState
.AffineTransform
= aUnit
;
107 maRenderState
.AffineTransform
= aUnit
;
108 maRenderState
.DeviceColor
= maColorBlack
;
110 //I can't figure out what the compositeoperation stuff does
111 //it doesn't seem to do anything in either VCL or cairocanvas
112 //I was hoping that CLEAR would clear the canvas before we paint,
113 //but nothing changes
114 maRenderState
.CompositeOperation
= rendering::CompositeOperation::OVER
;
116 maBox
.setWidth(aSize
.Width() / 3);
117 maBox
.setHeight(aSize
.Height() / 3);
119 lang::Locale aLocale
;
120 rendering::FontInfo aFontInfo
;
121 aFontInfo
.FamilyName
= "Swiss";
122 aFontInfo
.StyleName
= "SansSerif";
123 geometry::Matrix2D
aFontMatrix( 1, 0,
125 rendering::FontRequest
aFontRequest( aFontInfo
, 12.0, 0.0, aLocale
);
126 uno::Sequence
< beans::PropertyValue
> aExtraFontProperties
;
127 mxDefaultFont
= xCanvas
->createFont( aFontRequest
, aExtraFontProperties
, aFontMatrix
);
128 if( !mxDefaultFont
.is() )
129 fprintf( stderr
, "Failed to create font\n" );
134 long d
, dIncr
= maSize
.Width() / 3;
135 for ( d
= 0; d
<= maSize
.Width(); d
+= dIncr
)
136 mxCanvas
->drawLine( geometry::RealPoint2D( d
, 0 ),
137 geometry::RealPoint2D( d
, maSize
.Height() ),
138 maViewState
, maRenderState
);
139 dIncr
= maSize
.Height() / 3;
140 for ( d
= 0; d
<= maSize
.Height(); d
+= dIncr
)
141 mxCanvas
->drawLine( geometry::RealPoint2D( 0, d
),
142 geometry::RealPoint2D( maSize
.Width(), d
),
143 maViewState
, maRenderState
);
146 void drawStringAt( OString aString
, double x
, double y
)
148 rendering::StringContext aText
;
149 aText
.Text
= OStringToOUString( aString
, RTL_TEXTENCODING_UTF8
);
150 aText
.StartPosition
= 0;
151 aText
.Length
= aString
.getLength();
152 rendering::RenderState
aRenderState( maRenderState
);
153 aRenderState
.AffineTransform
.m02
+= x
;
154 aRenderState
.AffineTransform
.m12
+= y
;
156 mxCanvas
->drawText( aText
, mxDefaultFont
, maViewState
, aRenderState
, 0);
159 void drawRect( tools::Rectangle rRect
, const uno::Sequence
< double > &aColor
, int /*nWidth*/ )
161 uno::Sequence
< geometry::RealPoint2D
> aPoints(4);
162 uno::Reference
< rendering::XLinePolyPolygon2D
> xPoly
;
164 aPoints
[0] = geometry::RealPoint2D( rRect
.Left(), rRect
.Top() );
165 aPoints
[1] = geometry::RealPoint2D( rRect
.Left(), rRect
.Bottom() );
166 aPoints
[2] = geometry::RealPoint2D( rRect
.Right(), rRect
.Bottom() );
167 aPoints
[3] = geometry::RealPoint2D( rRect
.Right(), rRect
.Top() );
169 uno::Sequence
< uno::Sequence
< geometry::RealPoint2D
> > aPolys(1);
171 xPoly
= mxDevice
->createCompatibleLinePolyPolygon( aPolys
);
172 xPoly
->setClosed( 0, true );
174 rendering::RenderState
aRenderState( maRenderState
);
175 aRenderState
.DeviceColor
= aColor
;
176 mxCanvas
->drawPolyPolygon( xPoly
, maViewState
, aRenderState
);
179 void translate( double x
, double y
)
181 maRenderState
.AffineTransform
.m02
+= x
;
182 maRenderState
.AffineTransform
.m12
+= y
;
185 void drawPolishDiamond( double center_x
, double center_y
)
187 const int VERTICES
= 10;
188 const double RADIUS
= 60.0;
191 rendering::RenderState maOldRenderState
= maRenderState
; // push
192 translate( center_x
, center_y
);
194 for (i
= 0; i
< VERTICES
; i
++)
196 double a
= 2.0 * M_PI
* i
/ VERTICES
;
197 geometry::RealPoint2D
aSrc( RADIUS
* cos (a
), RADIUS
* sin (a
) );
199 for (j
= i
+ 1; j
< VERTICES
; j
++)
201 a
= 2.0 * M_PI
* j
/ VERTICES
;
203 // FIXME: set cap_style to 'ROUND'
204 mxCanvas
->drawLine( aSrc
,
205 geometry::RealPoint2D( RADIUS
* cos (a
),
207 maViewState
, maRenderState
);
211 maRenderState
= maOldRenderState
; // pop
214 void drawHilbert( double anchor_x
, double anchor_y
)
216 const double SCALE
=7.0;
217 const char hilbert
[] = "urdrrulurulldluuruluurdrurddldrrruluurdrurddldrddlulldrdldrrurd";
218 int nLength
= SAL_N_ELEMENTS( hilbert
);
220 uno::Sequence
< geometry::RealPoint2D
> aPoints( nLength
);
221 uno::Reference
< rendering::XLinePolyPolygon2D
> xPoly
;
223 aPoints
[0] = geometry::RealPoint2D( anchor_x
, anchor_y
);
224 for (int i
= 0; i
< nLength
; i
++ )
229 aPoints
[i
+1] = geometry::RealPoint2D( aPoints
[i
].X
,
230 aPoints
[i
].Y
- SCALE
);
233 aPoints
[i
+1] = geometry::RealPoint2D( aPoints
[i
].X
,
234 aPoints
[i
].Y
+ SCALE
);
237 aPoints
[i
+1] = geometry::RealPoint2D( aPoints
[i
].X
- SCALE
,
241 aPoints
[i
+1] = geometry::RealPoint2D( aPoints
[i
].X
+ SCALE
,
247 uno::Sequence
< uno::Sequence
< geometry::RealPoint2D
> > aPolys(1);
250 xPoly
= mxDevice
->createCompatibleLinePolyPolygon( aPolys
);
251 xPoly
->setClosed( 0, false );
253 rendering::RenderState
aRenderState( maRenderState
);
254 aRenderState
.DeviceColor
= maColorRed
;
255 // aRenderState.DeviceColor[3] = 0.5;
256 rendering::StrokeAttributes aStrokeAttrs
;
257 aStrokeAttrs
.StrokeWidth
= 4.0;
258 aStrokeAttrs
.MiterLimit
= 2.0; // ?
259 aStrokeAttrs
.StartCapType
= rendering::PathCapType::BUTT
;
260 aStrokeAttrs
.EndCapType
= rendering::PathCapType::BUTT
;
261 aStrokeAttrs
.JoinType
= rendering::PathJoinType::MITER
;
262 //fprintf( stderr, "FIXME: stroking a tools::PolyPolygon doesn't show up\n" );
264 mxCanvas
->strokePolyPolygon( xPoly
, maViewState
, aRenderState
, aStrokeAttrs
);
265 // FIXME: do this instead:
266 //mxCanvas->drawPolyPolygon( xPoly, maViewState, aRenderState );
269 void drawTitle( OString aTitle
)
271 // FIXME: text anchoring to be done
272 double nStringWidth
= aTitle
.getLength() * 8.0;
273 drawStringAt ( aTitle
, (maBox
.Width() - nStringWidth
) / 2, 15 );
276 void drawRectangles()
278 rendering::RenderState maOldRenderState
= maRenderState
; // push
280 drawTitle( OString( "Rectangles" ) );
282 drawRect( tools::Rectangle( 20, 30, 70, 60 ), maColorRed
, 8 );
283 // color mediumseagreen, stipple fill, outline black
284 drawRect( tools::Rectangle( 90, 40, 180, 100 ), maColorBlack
, 4 );
285 // color steelblue, filled, no outline
286 drawRect( tools::Rectangle( 10, 80, 80, 140 ), maColorBlack
, 1 );
288 maRenderState
= maOldRenderState
; // pop
293 rendering::RenderState maOldRenderState
= maRenderState
; // push
294 translate( maBox
.Width(), 0.0 );
296 drawTitle( OString( "Ellipses" ) );
298 const basegfx::B2DPoint
aCenter( maBox
.Width()*.5,
300 const basegfx::B2DPoint
aRadii( maBox
.Width()*.3,
302 const basegfx::B2DPolygon
& rEllipse(
303 basegfx::utils::createPolygonFromEllipse( aCenter
,
307 uno::Reference
< rendering::XPolyPolygon2D
> xPoly(
308 basegfx::unotools::xPolyPolygonFromB2DPolygon(mxDevice
,
311 rendering::StrokeAttributes aStrokeAttrs
;
312 aStrokeAttrs
.StrokeWidth
= 4.0;
313 aStrokeAttrs
.MiterLimit
= 2.0; // ?
314 aStrokeAttrs
.StartCapType
= rendering::PathCapType::BUTT
;
315 aStrokeAttrs
.EndCapType
= rendering::PathCapType::BUTT
;
316 aStrokeAttrs
.JoinType
= rendering::PathJoinType::MITER
;
317 mxCanvas
->strokePolyPolygon( xPoly
, maViewState
, maRenderState
, aStrokeAttrs
);
319 maRenderState
= maOldRenderState
; // pop
324 rendering::RenderState maOldRenderState
= maRenderState
; // push
325 translate( maBox
.Width() * 2.0, 0.0 );
327 drawTitle( OString( "Text" ) );
330 maBox
.Height() * .5 );
331 drawTitle( OString( "This is lame" ) );
333 maRenderState
= maOldRenderState
; // pop
338 rendering::RenderState maOldRenderState
= maRenderState
; // push
339 translate( 0.0, maBox
.Height() );
341 drawTitle( OString( "Images" ) );
343 uno::Reference
< rendering::XBitmap
> xBitmap(mxCanvas
, uno::UNO_QUERY
);
348 translate( maBox
.Width()*0.1, maBox
.Height()*0.2 );
349 maRenderState
.AffineTransform
.m00
*= 4.0/15;
350 maRenderState
.AffineTransform
.m11
*= 3.0/15;
352 mxCanvas
->drawBitmap(xBitmap
, maViewState
, maRenderState
);
354 // uno::Reference< rendering::XBitmap > xBitmap2( xBitmap->getScaledBitmap(geometry::RealSize2D(48, 48), false) );
355 // mxCanvas->drawBitmap(xBitmap2, maViewState, maRenderState); //yes, but where?
357 //called CanvasHelper::getScaledBitmap, we return NULL, TODO
358 //Exception 'BitmapEx vclcanvas::tools::bitmapExFromXBitmap(const css::uno::Reference<css::rendering::XBitmap>&),
359 //bitmapExFromXBitmap(): could not extract BitmapEx' thrown
362 //Exception 'BitmapEx vclcanvas::tools::bitmapExFromXBitmap(const css::uno::Reference<css::rendering::XBitmap>&),
363 //bitmapExFromXBitmap(): could not extract bitmap' thrown
364 // Thorsten says that this is a bug, and Thorsten never lies.
366 maRenderState
= maOldRenderState
; // pop
371 rendering::RenderState maOldRenderState
= maRenderState
; // push
372 translate( maBox
.Width(), maBox
.Height() );
374 drawTitle( OString( "Lines" ) );
376 drawPolishDiamond( 70.0, 80.0 );
377 drawHilbert( 140.0, 140.0 );
379 maRenderState
= maOldRenderState
; // pop
384 rendering::RenderState maOldRenderState
= maRenderState
; // push
385 translate( maBox
.Width() * 2.0, maBox
.Height() );
387 drawTitle( OString( "Curves" ) );
389 translate( maBox
.Width() * .5, maBox
.Height() * .5 );
391 const double r
= 30.0;
392 const int num_curves
= 3;
395 uno::Sequence
< geometry::RealBezierSegment2D
> aBeziers (num_curves
);
396 uno::Reference
< rendering::XBezierPolyPolygon2D
> xPoly
;
398 for (int i
= 0; i
< num_curves
; i
++)
399 aBeziers
[i
]= geometry::RealBezierSegment2D( r
* cos(i
*2*M_PI
/num_curves
), //Px
400 r
* sin(i
*2*M_PI
/num_curves
), //py
401 r
* 2 * cos((i
*2*M_PI
+ 2*M_PI
)/num_curves
), //C1x
402 r
* 2 * sin((i
*2*M_PI
+ 2*M_PI
)/num_curves
), //C1y
403 r
* 2 * cos((i
*2*M_PI
+ 2*M_PI
)/num_curves
), //C2x
404 r
* 2 * sin((i
*2*M_PI
+ 2*M_PI
)/num_curves
)); //C2y
405 uno::Sequence
< uno::Sequence
< geometry::RealBezierSegment2D
> > aPolys(1);
406 aPolys
[0] = aBeziers
;
407 xPoly
= mxDevice
->createCompatibleBezierPolyPolygon(aPolys
);
408 xPoly
->setClosed( 0, true );
409 //uno::Reference< rendering::XBezierPolyPolygon2D> xPP( xPoly, uno::UNO_QUERY );
410 //compiles, but totally screws up. I think it is interpreting the bezier as a line
412 rendering::StrokeAttributes aStrokeAttrs
;
413 aStrokeAttrs
.StrokeWidth
= 4.0;
414 aStrokeAttrs
.MiterLimit
= 2.0; // ?
415 aStrokeAttrs
.StartCapType
= rendering::PathCapType::BUTT
;
416 aStrokeAttrs
.EndCapType
= rendering::PathCapType::BUTT
;
417 aStrokeAttrs
.JoinType
= rendering::PathJoinType::MITER
;
418 mxCanvas
->strokePolyPolygon( xPoly
, maViewState
, maRenderState
, aStrokeAttrs
);
419 //you can't draw a BezierPolyPolygon2D with this, even though it is derived from it
420 //mxCanvas->drawPolyPolygon( xPoly, maViewState, maRenderState );
422 maRenderState
= maOldRenderState
; // pop
427 return comphelper::rng::uniform_real_distribution(0, 100);
432 rendering::RenderState maOldRenderState
= maRenderState
; // push
433 translate( 0.0, maBox
.Height() * 2.0 );
435 drawTitle( OString( "Arcs" ) );
439 //This stuff doesn't belong here, but probably in curves
440 //This stuff doesn't work in VCL b/c vcl doesn't do beziers
441 //Hah! Every time the window redraws, we do this
447 for (int i
= 0; i
< 1; i
++)
457 double c1x
= gimmerand();
458 double c1y
= gimmerand();
459 double c2x
= gimmerand();
460 double c2y
= gimmerand();
461 maRenderState
.DeviceColor
= maColorRed
;
462 mxCanvas
->drawLine(geometry::RealPoint2D(ax
, ay
), geometry::RealPoint2D(c1x
, c1y
), maViewState
, maRenderState
);
463 mxCanvas
->drawLine(geometry::RealPoint2D(c1x
, c1y
), geometry::RealPoint2D(c2x
, c2y
), maViewState
, maRenderState
);
464 mxCanvas
->drawLine(geometry::RealPoint2D(bx
, by
), geometry::RealPoint2D(c2x
, c2y
), maViewState
, maRenderState
);
466 geometry::RealBezierSegment2D
aBezierSegment(
474 geometry::RealPoint2D
aEndPoint(bx
, by
);
475 maRenderState
.DeviceColor
= maColorBlack
;
476 mxCanvas
->drawBezier(
479 maViewState
, maRenderState
);
481 maRenderState
= maOldRenderState
; // pop
485 void drawRegularPolygon(double centerx
, double centery
, int sides
, double r
)
488 uno::Sequence
< geometry::RealPoint2D
> aPoints (sides
);
489 uno::Reference
< rendering::XLinePolyPolygon2D
> xPoly
;
491 for (int i
= 0; i
< sides
; i
++)
493 aPoints
[i
]= geometry::RealPoint2D( centerx
+ r
* cos(i
*2 * M_PI
/sides
),
494 centery
+ r
* sin(i
*2 * M_PI
/sides
));
496 uno::Sequence
< uno::Sequence
< geometry::RealPoint2D
> > aPolys(1);
498 xPoly
= mxDevice
->createCompatibleLinePolyPolygon( aPolys
);
499 xPoly
->setClosed( 0, true );
500 rendering::RenderState
aRenderState( maRenderState
);
501 aRenderState
.DeviceColor
= maColorRed
;
502 mxCanvas
->drawPolyPolygon( xPoly
, maViewState
, aRenderState
);
503 mxCanvas
->fillPolyPolygon( xPoly
,
510 rendering::RenderState maOldRenderState
= maRenderState
; // push
511 translate( maBox
.Width() * 1.0, maBox
.Height() * 2.0 );
513 drawTitle( OString( "Polgyons" ) );
516 for (int i
= 1; i
<= 4; i
++)
518 drawRegularPolygon(35*i
, 35, sides
, 15);
522 maRenderState
= maOldRenderState
; // pop
525 void drawWidgets() // FIXME: prolly makes no sense
527 rendering::RenderState maOldRenderState
= maRenderState
; // push
528 translate( maBox
.Width() * 2.0, maBox
.Height() * 2.0 );
530 drawTitle( OString( "Widgets" ) );
532 maRenderState
= maOldRenderState
; // pop
537 void TestWindow::Paint(vcl::RenderContext
&, const tools::Rectangle
&)
541 uno::Reference
< rendering::XCanvas
> xVDevCanvas( GetCanvas(),
542 uno::UNO_SET_THROW
);
543 uno::Reference
< rendering::XGraphicDevice
> xVDevDevice( xVDevCanvas
->getDevice(),
544 uno::UNO_SET_THROW
);
545 DemoRenderer
aVDevRenderer( xVDevDevice
, xVDevCanvas
, GetSizePixel());
546 xVDevCanvas
->clear();
547 aVDevRenderer
.drawGrid();
548 aVDevRenderer
.drawRectangles();
549 aVDevRenderer
.drawEllipses();
550 aVDevRenderer
.drawText();
551 aVDevRenderer
.drawLines();
552 aVDevRenderer
.drawCurves();
553 aVDevRenderer
.drawArcs();
554 aVDevRenderer
.drawPolygons();
556 uno::Reference
< rendering::XCanvas
> xCanvas( GetSpriteCanvas(),
557 uno::UNO_QUERY_THROW
);
558 uno::Reference
< rendering::XGraphicDevice
> xDevice( xCanvas
->getDevice(),
559 uno::UNO_SET_THROW
);
561 DemoRenderer
aRenderer( xDevice
, xCanvas
, GetSizePixel() );
563 aRenderer
.drawGrid();
564 aRenderer
.drawRectangles();
565 aRenderer
.drawEllipses();
566 aRenderer
.drawText();
567 aRenderer
.drawLines();
568 aRenderer
.drawCurves();
569 aRenderer
.drawArcs();
570 aRenderer
.drawPolygons();
571 aRenderer
.drawWidgets();
572 aRenderer
.drawImages();
574 // check whether virdev actually contained something
575 uno::Reference
< rendering::XBitmap
> xBitmap(xVDevCanvas
, uno::UNO_QUERY
);
579 aRenderer
.maRenderState
.AffineTransform
.m02
+= 100;
580 aRenderer
.maRenderState
.AffineTransform
.m12
+= 100;
581 xCanvas
->drawBitmap(xBitmap
, aRenderer
.maViewState
, aRenderer
.maRenderState
);
583 uno::Reference
< rendering::XSpriteCanvas
> xSpriteCanvas( xCanvas
,
585 if( xSpriteCanvas
.is() )
586 xSpriteCanvas
->updateScreen( true ); // without
591 catch (const uno::Exception
&e
)
593 fprintf( stderr
, "Exception '%s' thrown\n" ,
594 OUStringToOString( e
.Message
, RTL_TEXTENCODING_UTF8
).getStr() );
598 class DemoApp
: public Application
601 virtual int Main() override
;
602 virtual void Exception(ExceptionCategory nCategory
) override
;
605 void Init() override
;
606 void DeInit() override
;
613 for( unsigned int i
= 0; i
< GetCommandLineParamCount(); i
++ )
615 OUString aParam
= GetCommandLineParam( i
);
617 if( aParam
== "--help" || aParam
== "-h" )
627 ScopedVclPtr
<TestWindow
> aWindow
= VclPtr
<TestWindow
>::Create();
630 Application::Execute();
634 void DemoApp::Exception( ExceptionCategory nCategory
)
638 case ExceptionCategory::ResourceNotLoaded
:
639 Abort( "Error: could not load language resources.\nPlease check your installation.\n" );
650 uno::Reference
<uno::XComponentContext
> xComponentContext
651 = ::cppu::defaultBootstrap_InitialComponentContext();
652 uno::Reference
<lang::XMultiServiceFactory
> xMSF
;
653 xMSF
.set(xComponentContext
->getServiceManager(), uno::UNO_QUERY
);
655 Application::Abort("Bootstrap failure - no service manager");
657 ::comphelper::setProcessServiceFactory(xMSF
);
659 catch (const uno::Exception
&e
)
661 Application::Abort("Bootstrap exception " + e
.Message
);
665 void DemoApp::DeInit()
667 uno::Reference
< lang::XComponent
>(
668 comphelper::getProcessComponentContext(),
669 uno::UNO_QUERY_THROW
)-> dispose();
670 ::comphelper::setProcessServiceFactory(nullptr);
673 void vclmain::createApplication()
679 // - bouncing clip-rectangle mode - bounce a clip-rect around the window...
680 // - complete all of pre-existing canvas bits
681 // - affine transform tweakage...
683 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */