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/.
11 #include <sal/config.h>
12 #include <test/screenshot_test.hxx>
13 #include <com/sun/star/lang/XComponent.hpp>
14 #include <com/sun/star/presentation/AnimationEffect.hpp>
15 #include <com/sun/star/presentation/ClickAction.hpp>
17 #include <svl/intitem.hxx>
18 #include <svl/stritem.hxx>
19 #include <editeng/colritem.hxx>
20 #include <svx/xfillit0.hxx>
21 #include <vcl/svapp.hxx>
23 #include <drawdoc.hxx>
24 #include <DrawDocShell.hxx>
26 #include <sdabstdlg.hxx>
28 #include <unomodel.hxx>
29 #include <ViewShell.hxx>
30 #include <drawview.hxx>
32 #include <strings.hrc>
33 #include <sdresid.hxx>
36 using namespace ::com::sun::star
;
38 /// Test opening a dialog in sd
39 class SdDialogsTest
: public ScreenshotTest
42 /// Document and ComponentContext
43 uno::Reference
<lang::XComponent
> mxComponent
;
45 /// initially created SdAbstractDialogFactory and pointer to document
46 SdAbstractDialogFactory
* mpFact
;
47 SdXImpressDocument
* mpImpressDocument
;
49 /// on-demand created instances required for various dialogs to open
50 ::sd::DrawDocShell
* mpDocShell
;
51 ::sd::ViewShell
* mpViewShell
;
52 ::sd::DrawView
* mpDrawView
;
54 std::unique_ptr
<SfxItemSet
> mpSfxItemSetFromSdrObject
;
55 std::unique_ptr
<SfxItemSet
> mpEmptySfxItemSet
;
56 std::unique_ptr
<SfxItemSet
> mpEmptyFillStyleSfxItemSet
;
59 SdAbstractDialogFactory
* getSdAbstractDialogFactory();
60 SdXImpressDocument
* getSdXImpressDocument();
61 ::sd::DrawDocShell
* getDocShell();
62 ::sd::ViewShell
* getViewShell();
63 ::sd::DrawView
* getDrawView();
64 const SfxItemSet
& getSfxItemSetFromSdrObject();
65 const SfxItemSet
& getEmptySfxItemSet();
66 const SfxItemSet
& getEmptyFillStyleSfxItemSet();
68 /// helper method to populate KnownDialogs, called in setUp(). Needs to be
69 /// written and has to add entries to KnownDialogs
70 virtual void registerKnownDialogsByID(mapType
& rKnownDialogs
) override
;
72 /// dialog creation for known dialogs by ID. Has to be implemented for
73 /// each registered known dialog
74 virtual VclPtr
<VclAbstractDialog
> createDialogByID(sal_uInt32 nID
) override
;
79 virtual void setUp() override
;
81 void tearDown() override
;
83 // try to open a dialog
86 CPPUNIT_TEST_SUITE(SdDialogsTest
);
87 CPPUNIT_TEST(openAnyDialog
);
88 CPPUNIT_TEST_SUITE_END();
91 SdDialogsTest::SdDialogsTest()
94 mpImpressDocument(nullptr),
101 void SdDialogsTest::setUp()
103 ScreenshotTest::setUp();
105 mpFact
= SdAbstractDialogFactory::Create();
106 mxComponent
= loadFromDesktop("private:factory/simpress", "com.sun.star.presentation.PresentationDocument");
108 mpImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
109 CPPUNIT_ASSERT(mpImpressDocument
);
112 void SdDialogsTest::tearDown()
114 mpSfxItemSetFromSdrObject
.reset();
115 mpEmptySfxItemSet
.reset();
116 mpEmptyFillStyleSfxItemSet
.reset();
117 mxComponent
->dispose();
118 ScreenshotTest::tearDown();
121 SdAbstractDialogFactory
* SdDialogsTest::getSdAbstractDialogFactory()
126 SdXImpressDocument
* SdDialogsTest::getSdXImpressDocument()
128 return mpImpressDocument
;
131 ::sd::DrawDocShell
* SdDialogsTest::getDocShell()
135 mpDocShell
= getSdXImpressDocument()->GetDocShell();
136 CPPUNIT_ASSERT(mpDocShell
);
142 ::sd::ViewShell
* SdDialogsTest::getViewShell()
146 mpViewShell
= getDocShell()->GetViewShell();
147 CPPUNIT_ASSERT(mpViewShell
);
153 ::sd::DrawView
* SdDialogsTest::getDrawView()
157 mpDrawView
= dynamic_cast<::sd::DrawView
*>(getViewShell()->GetDrawView());
158 CPPUNIT_ASSERT(mpDrawView
);
164 const SfxItemSet
& SdDialogsTest::getSfxItemSetFromSdrObject()
166 if (!mpSfxItemSetFromSdrObject
)
168 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
169 CPPUNIT_ASSERT(pDrawDoc
);
170 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
171 CPPUNIT_ASSERT(pSdPage
);
172 SdrObject
* pSdrObj
= pSdPage
->GetObj(0);
173 CPPUNIT_ASSERT(pSdrObj
);
174 mpSfxItemSetFromSdrObject
.reset( new SfxItemSet( pSdrObj
->GetMergedItemSet() ) );
175 CPPUNIT_ASSERT(mpSfxItemSetFromSdrObject
);
178 return *mpSfxItemSetFromSdrObject
;
181 const SfxItemSet
& SdDialogsTest::getEmptySfxItemSet()
183 if (!mpEmptySfxItemSet
)
185 // needs an SfxItemSet, use the one from the 1st object
186 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
187 CPPUNIT_ASSERT(pDrawDoc
);
188 mpEmptySfxItemSet
.reset( new SfxItemSet(pDrawDoc
->GetItemPool()) );
189 CPPUNIT_ASSERT(mpEmptySfxItemSet
);
192 return *mpEmptySfxItemSet
;
195 const SfxItemSet
& SdDialogsTest::getEmptyFillStyleSfxItemSet()
197 if (!mpEmptyFillStyleSfxItemSet
)
199 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
200 CPPUNIT_ASSERT(pDrawDoc
);
201 mpEmptyFillStyleSfxItemSet
.reset( new SfxItemSet(pDrawDoc
->GetItemPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>) );
202 CPPUNIT_ASSERT(mpEmptyFillStyleSfxItemSet
);
203 mpEmptyFillStyleSfxItemSet
->Put(XFillStyleItem(drawing::FillStyle_NONE
));
206 return *mpEmptyFillStyleSfxItemSet
;
209 void SdDialogsTest::registerKnownDialogsByID(mapType
& rKnownDialogs
)
211 // fill map of known dialogs
212 rKnownDialogs
["modules/simpress/ui/publishingdialog.ui"] = 0;
213 rKnownDialogs
["modules/sdraw/ui/breakdialog.ui"] = 1;
214 rKnownDialogs
["modules/sdraw/ui/copydlg.ui"] = 2;
215 rKnownDialogs
["modules/simpress/ui/customslideshows.ui"] = 3;
216 rKnownDialogs
["modules/sdraw/ui/drawchardialog.ui"] = 4;
217 rKnownDialogs
["modules/sdraw/ui/drawpagedialog.ui"] = 5;
218 rKnownDialogs
["modules/simpress/ui/dlgfield.ui"] = 6;
219 rKnownDialogs
["modules/sdraw/ui/dlgsnap.ui"] = 7;
220 rKnownDialogs
["modules/sdraw/ui/insertlayer.ui"] = 8;
221 rKnownDialogs
["modules/sdraw/ui/insertslidesdialog.ui"] = 9;
222 rKnownDialogs
["modules/sdraw/ui/crossfadedialog.ui"] = 10;
223 rKnownDialogs
["modules/sdraw/ui/bulletsandnumbering.ui"] = 11;
224 rKnownDialogs
["modules/sdraw/ui/drawparadialog.ui"] = 12;
225 rKnownDialogs
["modules/simpress/ui/presentationdialog.ui"] = 13;
226 rKnownDialogs
["modules/simpress/ui/remotedialog.ui"] = 14;
227 rKnownDialogs
["modules/sdraw/ui/drawprtldialog.ui"] = 15;
228 rKnownDialogs
["modules/simpress/ui/slidedesigndialog.ui"] = 16;
229 rKnownDialogs
["modules/simpress/ui/templatedialog.ui"] = 17;
230 rKnownDialogs
["modules/simpress/ui/interactiondialog.ui"] = 18;
231 rKnownDialogs
["modules/sdraw/ui/vectorize.ui"] = 19;
232 rKnownDialogs
["modules/simpress/ui/photoalbum.ui"] = 20;
233 rKnownDialogs
["modules/simpress/ui/masterlayoutdlg.ui"] = 21;
234 rKnownDialogs
["modules/simpress/ui/headerfooterdialog.ui"] = 22;
237 VclPtr
<VclAbstractDialog
> SdDialogsTest::createDialogByID(sal_uInt32 nID
)
239 VclPtr
<VclAbstractDialog
> pRetval
;
241 if (getSdAbstractDialogFactory())
247 // CreateSdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType) override;
248 // this dialog does not need much, not even a SdDrawDocument. OTOH
249 // it is more a 'wizard' in that it has prev/next buttons and implicitly
250 // multiple pages. To make use of that it is necessary that the implementation
251 // supports the 'Screenshot interface'
252 pRetval
= getSdAbstractDialogFactory()->CreateSdPublishingDlg(
253 Application::GetDefDialogParent(),
254 DocumentType::Impress
);
259 // CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override;
260 // this dialog requires pDrawView. It does not show much when
261 // there is no object selected that can be broken up. For better
262 // results it might be necessary to add/select an object that
263 // delivers a good metafile (which is the base for breaking)
264 pRetval
= getSdAbstractDialogFactory()->CreateBreakDlg(
265 Application::GetDefDialogParent(),
274 // needs an SfxItemSet, use the one from the 1st object
275 pRetval
= getSdAbstractDialogFactory()->CreateCopyDlg(
276 getViewShell()->GetFrameWeld(),
277 getSfxItemSetFromSdrObject(),
283 // CreateSdCustomShowDlg(SdDrawDocument& rDrawDoc) = 0;
284 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
285 CPPUNIT_ASSERT(pDrawDoc
);
287 pRetval
= getSdAbstractDialogFactory()->CreateSdCustomShowDlg(
288 getViewShell()->GetFrameWeld(), *pDrawDoc
);
293 // CreateSdTabCharDialog(const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override;
294 // needs an SfxItemSet, use an empty constructed one
295 // needs a 'SfxObjectShell* pDocShell', crashes without
296 pRetval
= getSdAbstractDialogFactory()->CreateSdTabCharDialog(
297 getViewShell()->GetFrameWeld(),
298 &getEmptySfxItemSet(),
304 // CreateSdTabPageDialog(const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage = true, bool bIsImpressDoc) override;
305 // needs a special SfxItemSet with merged content from page and other stuff, crashes without that (2nd page)
306 // needs a 'SfxObjectShell* pDocShell', crashes without. Also sufficient: FillStyleItemSet with XFILL_NONE set
307 pRetval
= getSdAbstractDialogFactory()->CreateSdTabPageDialog(
308 getViewShell()->GetFrameWeld(),
309 &getEmptyFillStyleSfxItemSet(),
311 true, /*bIsImpressDoc=*/false, /*bIsImpressMaster=*/false);
316 // CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override;
317 pRetval
= getSdAbstractDialogFactory()->CreateSdModifyFieldDlg(
318 getViewShell()->GetFrameWeld(),
320 getEmptySfxItemSet());
325 // CreateSdSnapLineDlg(const SfxItemSet& rInAttrs, ::sd::View* pView) override;
326 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
327 CPPUNIT_ASSERT(pDrawDoc
);
328 SfxItemSet
aNewAttr(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_SNAPLINE_START
, ATTR_SNAPLINE_END
>);
329 aNewAttr
.Put(SfxInt32Item(ATTR_SNAPLINE_X
, 0));
330 aNewAttr
.Put(SfxInt32Item(ATTR_SNAPLINE_Y
, 0));
331 pRetval
= getSdAbstractDialogFactory()->CreateSdSnapLineDlg(
332 getViewShell()->GetFrameWeld(),
339 // CreateSdInsertLayerDlg(const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
340 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
341 CPPUNIT_ASSERT(pDrawDoc
);
342 SfxItemSet
aNewAttr(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_LAYER_START
, ATTR_LAYER_END
>);
343 const OUString aLayerName
= SdResId(STR_LAYER
); // + OUString::number(2);
344 aNewAttr
.Put(makeSdAttrLayerName(aLayerName
));
345 aNewAttr
.Put(makeSdAttrLayerTitle());
346 aNewAttr
.Put(makeSdAttrLayerDesc());
347 aNewAttr
.Put(makeSdAttrLayerVisible());
348 aNewAttr
.Put(makeSdAttrLayerPrintable());
349 aNewAttr
.Put(makeSdAttrLayerLocked());
350 aNewAttr
.Put(makeSdAttrLayerThisPage());
351 pRetval
= getSdAbstractDialogFactory()->CreateSdInsertLayerDlg(
352 getViewShell()->GetFrameWeld(),
354 true, // alternative: false
355 SdResId(STR_INSERTLAYER
) /* alternative: STR_MODIFYLAYER */);
360 // CreateSdInsertPagesObjsDlg(const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) override;
361 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
362 CPPUNIT_ASSERT(pDrawDoc
);
363 pRetval
= getSdAbstractDialogFactory()->CreateSdInsertPagesObjsDlg(
364 getViewShell()->GetFrameWeld(),
372 // CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
373 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
374 CPPUNIT_ASSERT(pDrawDoc
);
375 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
376 CPPUNIT_ASSERT(pSdPage
);
377 SdrObject
* pSdrObj
= pSdPage
->GetObj(0);
378 // using one SdrObject is okay, none crashes
379 CPPUNIT_ASSERT(pSdrObj
);
380 pRetval
= getSdAbstractDialogFactory()->CreateMorphDlg(
381 Application::GetDefDialogParent(),
388 // CreateSdOutlineBulletTabDlg(const SfxItemSet* pAttr, ::sd::View* pView = nullptr) override;
389 pRetval
= getSdAbstractDialogFactory()->CreateSdOutlineBulletTabDlg(
390 Application::GetDefDialogParent(),
391 &getEmptySfxItemSet(),
397 // CreateSdParagraphTabDlg(const SfxItemSet* pAttr) override;
398 pRetval
= getSdAbstractDialogFactory()->CreateSdParagraphTabDlg(
399 getViewShell()->GetFrameWeld(),
400 &getEmptySfxItemSet());
405 // CreateSdStartPresentationDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList) override;
406 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
407 CPPUNIT_ASSERT(pDrawDoc
);
408 SfxItemSet
aDlgSet(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_PRESENT_START
, ATTR_PRESENT_END
>);
409 ::sd::PresentationSettings
& rPresentationSettings
= pDrawDoc
->getPresentationSettings();
410 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ALL
, rPresentationSettings
.mbAll
));
411 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_CUSTOMSHOW
, rPresentationSettings
.mbCustomShow
));
412 aDlgSet
.Put(SfxStringItem(ATTR_PRESENT_DIANAME
, OUString()));
413 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ENDLESS
, rPresentationSettings
.mbEndless
));
414 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_MANUEL
, rPresentationSettings
.mbManual
));
415 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_MOUSE
, rPresentationSettings
.mbMouseVisible
));
416 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_PEN
, rPresentationSettings
.mbMouseAsPen
));
417 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ANIMATION_ALLOWED
, rPresentationSettings
.mbAnimationAllowed
));
418 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_CHANGE_PAGE
, !rPresentationSettings
.mbLockedPages
));
419 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ALWAYS_ON_TOP
, rPresentationSettings
.mbAlwaysOnTop
));
420 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_SHOW_NAVIGATION_BUTTONS
, rPresentationSettings
.mbUseNavigation
));
421 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_FULLSCREEN
, rPresentationSettings
.mbFullScreen
));
422 aDlgSet
.Put(SfxUInt32Item(ATTR_PRESENT_PAUSE_TIMEOUT
, rPresentationSettings
.mnPauseTimeout
));
423 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_SHOW_PAUSELOGO
, rPresentationSettings
.mbShowPauseLogo
));
424 //SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress);
425 aDlgSet
.Put(SfxInt32Item(ATTR_PRESENT_DISPLAY
, 0 /*pOptions->GetDisplay()*/));
426 pRetval
= getSdAbstractDialogFactory()->CreateSdStartPresentationDlg(
427 Application::GetDefDialogParent(),
429 std::vector
<OUString
>(),
435 // CreateRemoteDialog(vcl::Window* pWindow) override; // ad for RemoteDialog
436 pRetval
= getSdAbstractDialogFactory()->CreateRemoteDialog(
437 Application::GetDefDialogParent());
442 // CreateSdPresLayoutTemplateDlg(SfxObjectShell* pDocSh, weld::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool) override;
443 // use STR_PSEUDOSHEET_TITLE configuration, see futempl.cxx for more possible configurations
444 // may be nicer on the long run to take a configuration which represents a selected SdrObject
445 SfxStyleSheetBasePool
* pStyleSheetPool
= getDocShell()->GetStyleSheetPool();
446 CPPUNIT_ASSERT(pStyleSheetPool
);
447 SfxStyleSheetBase
* pStyleSheet
= pStyleSheetPool
->First(SfxStyleFamily::Page
);
448 CPPUNIT_ASSERT(pStyleSheet
);
449 pRetval
= getSdAbstractDialogFactory()->CreateSdPresLayoutTemplateDlg(
451 Application::GetDefDialogParent(),
454 PresentationObjects::Title
,
460 // CreateSdPresLayoutDlg(::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs) override;
461 pRetval
= getSdAbstractDialogFactory()->CreateSdPresLayoutDlg(
462 Application::GetDefDialogParent(),
464 getEmptySfxItemSet());
469 // CreateSdTabTemplateDlg(const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView) override;
470 // pretty similar to CreateSdPresLayoutTemplateDlg, see above
471 // may be nicer on the long run to take a configuration which represents a selected SdrObject
472 SfxStyleSheetBasePool
* pStyleSheetPool
= getDocShell()->GetStyleSheetPool();
473 CPPUNIT_ASSERT(pStyleSheetPool
);
474 SfxStyleSheetBase
* pStyleSheet
= pStyleSheetPool
->First(SfxStyleFamily::Pseudo
);
475 CPPUNIT_ASSERT(pStyleSheet
);
476 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
477 CPPUNIT_ASSERT(pDrawDoc
);
478 pRetval
= getSdAbstractDialogFactory()->CreateSdTabTemplateDlg(
479 getViewShell()->GetFrameWeld(),
488 // CreatSdActionDialog(const SfxItemSet* pAttr, ::sd::View* pView) override;
489 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
490 CPPUNIT_ASSERT(pDrawDoc
);
491 SfxItemSet
aSet(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_ANIMATION_START
, ATTR_ACTION_END
>);
492 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE
, false));
493 aSet
.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
494 aSet
.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
495 aSet
.InvalidateItem(ATTR_ANIMATION_SPEED
);
496 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT
, false));
497 aSet
.Put(SvxColorItem(COL_LIGHTGRAY
, ATTR_ANIMATION_COLOR
));
498 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE
, false));
499 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON
, false));
500 aSet
.InvalidateItem(ATTR_ANIMATION_SOUNDFILE
);
501 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL
, false));
502 aSet
.Put(SfxUInt16Item(ATTR_ACTION
, sal_uInt16(presentation::ClickAction_NONE
)));
503 aSet
.InvalidateItem(ATTR_ACTION_FILENAME
);
504 aSet
.Put(SfxUInt16Item(ATTR_ACTION_EFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
505 aSet
.InvalidateItem(ATTR_ACTION_EFFECTSPEED
);
506 aSet
.Put(SfxBoolItem(ATTR_ACTION_SOUNDON
, false));
507 aSet
.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL
, false));
508 pRetval
= getSdAbstractDialogFactory()->CreatSdActionDialog(
509 getViewShell()->GetFrameWeld(),
516 // CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) override;
517 // works well with empty Bitmap, but my be nicer with setting one
519 pRetval
= getSdAbstractDialogFactory()->CreateSdVectorizeDlg(
520 Application::GetDefDialogParent(),
527 // CreateSdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* pDoc) override;
528 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
529 CPPUNIT_ASSERT(pDrawDoc
);
530 pRetval
= getSdAbstractDialogFactory()->CreateSdPhotoAlbumDialog(
531 Application::GetDefDialogParent(),
537 // CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) override;
538 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
539 CPPUNIT_ASSERT(pDrawDoc
);
540 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
541 CPPUNIT_ASSERT(pSdPage
);
542 pRetval
= getSdAbstractDialogFactory()->CreateMasterLayoutDialog(
543 Application::GetDefDialogParent(),
550 // CreateHeaderFooterDialog(sd::ViewShell* pViewShell, weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage) override;
551 // This is a hard case, for two reasons:
552 // - It uses BaseClass TabPage which has a very sparse interface,
553 // need to add 'Screenshot interface' there and implement
554 // - The concrete dialog has two TabPages which use the *same*
555 // .ui file, so extended markup will be needed to differ these two
557 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
558 CPPUNIT_ASSERT(pDrawDoc
);
559 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
560 CPPUNIT_ASSERT(pSdPage
);
561 pRetval
= getSdAbstractDialogFactory()->CreateHeaderFooterDialog(
563 Application::GetDefDialogParent(),
576 void SdDialogsTest::openAnyDialog()
578 /// example how to process an input file containing the UXMLDescriptions of the dialogs
582 processDialogBatchFile(u
"sd/qa/unit/data/dialogs-test.txt");
585 /// example how to dump all known dialogs
588 processAllKnownDialogs();
591 /// example how to dump exactly one known dialog
594 // example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
595 // example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
596 // example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
597 ScopedVclPtr
<VclAbstractDialog
> pDlg(createDialogByID(5));
601 // known dialog, dump screenshot to path
602 dumpDialogToPath(*pDlg
);
606 // unknown dialog, should not happen in this basic loop.
607 // You have probably forgotten to add a case and
608 // implementation to createDialogByID, please do this
612 /// example how to dump a dialog using fallback functionality
615 // unknown dialog, try fallback to generic created
616 // VclBuilder-generated instance. Keep in mind that Dialogs
617 // using this mechanism will probably not be layouted well
618 // since the setup/initialization part is missing. Thus,
619 // only use for fallback when only the UI file is available.
621 // Take any example here, it's only for demonstration - using
622 // even a known one to demonstrate the fallback possibility
623 dumpDialogToPath("modules/sdraw/ui/breakdialog.ui");
627 CPPUNIT_TEST_SUITE_REGISTRATION(SdDialogsTest
);
629 CPPUNIT_PLUGIN_IMPLEMENT();
631 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */