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 <sfx2/sfxdlg.hxx>
18 #include <svl/intitem.hxx>
19 #include <svl/stritem.hxx>
20 #include <svl/aeitem.hxx>
21 #include <editeng/colritem.hxx>
22 #include <svx/xfillit0.hxx>
23 #include <vcl/svapp.hxx>
25 #include <drawdoc.hxx>
26 #include <DrawDocShell.hxx>
28 #include <sdabstdlg.hxx>
30 #include <unomodel.hxx>
31 #include <ViewShell.hxx>
32 #include <drawview.hxx>
34 #include <strings.hrc>
35 #include <sdresid.hxx>
38 using namespace ::com::sun::star
;
40 /// Test opening a dialog in sd
41 class SdDialogsTest
: public ScreenshotTest
44 /// Document and ComponentContext
45 uno::Reference
<lang::XComponent
> mxComponent
;
47 /// initially created SdAbstractDialogFactory and pointer to document
48 SdAbstractDialogFactory
* mpFact
;
49 SdXImpressDocument
* mpImpressDocument
;
51 /// on-demand created instances required for various dialogs to open
52 ::sd::DrawDocShell
* mpDocShell
;
53 ::sd::ViewShell
* mpViewShell
;
54 ::sd::DrawView
* mpDrawView
;
56 std::unique_ptr
<SfxItemSet
> mpSfxItemSetFromSdrObject
;
57 std::unique_ptr
<SfxItemSet
> mpEmptySfxItemSet
;
58 std::unique_ptr
<SfxItemSet
> mpEmptyFillStyleSfxItemSet
;
61 SdAbstractDialogFactory
* getSdAbstractDialogFactory();
62 SdXImpressDocument
* getSdXImpressDocument();
63 ::sd::DrawDocShell
* getDocShell();
64 ::sd::ViewShell
* getViewShell();
65 ::sd::DrawView
* getDrawView();
66 const SfxItemSet
& getSfxItemSetFromSdrObject();
67 const SfxItemSet
& getEmptySfxItemSet();
68 const SfxItemSet
& getEmptyFillStyleSfxItemSet();
70 /// helper method to populate KnownDialogs, called in setUp(). Needs to be
71 /// written and has to add entries to KnownDialogs
72 virtual void registerKnownDialogsByID(mapType
& rKnownDialogs
) override
;
74 /// dialog creation for known dialogs by ID. Has to be implemented for
75 /// each registered known dialog
76 virtual VclPtr
<VclAbstractDialog
> createDialogByID(sal_uInt32 nID
) override
;
81 virtual void setUp() override
;
83 void tearDown() override
;
85 // try to open a dialog
88 CPPUNIT_TEST_SUITE(SdDialogsTest
);
89 CPPUNIT_TEST(openAnyDialog
);
90 CPPUNIT_TEST_SUITE_END();
93 SdDialogsTest::SdDialogsTest()
96 mpImpressDocument(nullptr),
103 void SdDialogsTest::setUp()
105 ScreenshotTest::setUp();
107 mpFact
= SdAbstractDialogFactory::Create();
108 mxComponent
= loadFromDesktop("private:factory/simpress", "com.sun.star.presentation.PresentationDocument");
109 CPPUNIT_ASSERT(mxComponent
.is());
111 mpImpressDocument
= dynamic_cast<SdXImpressDocument
*>(mxComponent
.get());
112 CPPUNIT_ASSERT(mpImpressDocument
);
115 void SdDialogsTest::tearDown()
117 mpSfxItemSetFromSdrObject
.reset();
118 mpEmptySfxItemSet
.reset();
119 mpEmptyFillStyleSfxItemSet
.reset();
120 mxComponent
->dispose();
121 ScreenshotTest::tearDown();
124 SdAbstractDialogFactory
* SdDialogsTest::getSdAbstractDialogFactory()
129 SdXImpressDocument
* SdDialogsTest::getSdXImpressDocument()
131 return mpImpressDocument
;
134 ::sd::DrawDocShell
* SdDialogsTest::getDocShell()
138 mpDocShell
= getSdXImpressDocument()->GetDocShell();
139 CPPUNIT_ASSERT(mpDocShell
);
145 ::sd::ViewShell
* SdDialogsTest::getViewShell()
149 mpViewShell
= getDocShell()->GetViewShell();
150 CPPUNIT_ASSERT(mpViewShell
);
156 ::sd::DrawView
* SdDialogsTest::getDrawView()
160 mpDrawView
= dynamic_cast<::sd::DrawView
*>(getViewShell()->GetDrawView());
161 CPPUNIT_ASSERT(mpDrawView
);
167 const SfxItemSet
& SdDialogsTest::getSfxItemSetFromSdrObject()
169 if (!mpSfxItemSetFromSdrObject
)
171 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
172 CPPUNIT_ASSERT(pDrawDoc
);
173 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
174 CPPUNIT_ASSERT(pSdPage
);
175 SdrObject
* pSdrObj
= pSdPage
->GetObj(0);
176 CPPUNIT_ASSERT(pSdrObj
);
177 mpSfxItemSetFromSdrObject
.reset( new SfxItemSet( pSdrObj
->GetMergedItemSet() ) );
178 CPPUNIT_ASSERT(mpSfxItemSetFromSdrObject
);
181 return *mpSfxItemSetFromSdrObject
;
184 const SfxItemSet
& SdDialogsTest::getEmptySfxItemSet()
186 if (!mpEmptySfxItemSet
)
188 // needs an SfxItemSet, use the one from the 1st object
189 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
190 CPPUNIT_ASSERT(pDrawDoc
);
191 mpEmptySfxItemSet
.reset( new SfxItemSet(pDrawDoc
->GetItemPool()) );
192 CPPUNIT_ASSERT(mpEmptySfxItemSet
);
195 return *mpEmptySfxItemSet
;
198 const SfxItemSet
& SdDialogsTest::getEmptyFillStyleSfxItemSet()
200 if (!mpEmptyFillStyleSfxItemSet
)
202 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
203 CPPUNIT_ASSERT(pDrawDoc
);
204 mpEmptyFillStyleSfxItemSet
.reset( new SfxItemSet(pDrawDoc
->GetItemPool(), svl::Items
<XATTR_FILL_FIRST
, XATTR_FILL_LAST
>{}) );
205 CPPUNIT_ASSERT(mpEmptyFillStyleSfxItemSet
);
206 mpEmptyFillStyleSfxItemSet
->Put(XFillStyleItem(drawing::FillStyle_NONE
));
209 return *mpEmptyFillStyleSfxItemSet
;
212 void SdDialogsTest::registerKnownDialogsByID(mapType
& rKnownDialogs
)
214 // fill map of known dialogs
215 rKnownDialogs
["modules/simpress/ui/publishingdialog.ui"] = 0;
216 rKnownDialogs
["modules/sdraw/ui/breakdialog.ui"] = 1;
217 rKnownDialogs
["modules/sdraw/ui/copydlg.ui"] = 2;
218 rKnownDialogs
["modules/simpress/ui/customslideshows.ui"] = 3;
219 rKnownDialogs
["modules/sdraw/ui/drawchardialog.ui"] = 4;
220 rKnownDialogs
["modules/sdraw/ui/drawpagedialog.ui"] = 5;
221 rKnownDialogs
["modules/simpress/ui/dlgfield.ui"] = 6;
222 rKnownDialogs
["modules/sdraw/ui/dlgsnap.ui"] = 7;
223 rKnownDialogs
["modules/sdraw/ui/insertlayer.ui"] = 8;
224 rKnownDialogs
["modules/sdraw/ui/insertslidesdialog.ui"] = 9;
225 rKnownDialogs
["modules/sdraw/ui/crossfadedialog.ui"] = 10;
226 rKnownDialogs
["modules/sdraw/ui/bulletsandnumbering.ui"] = 11;
227 rKnownDialogs
["modules/sdraw/ui/drawparadialog.ui"] = 12;
228 rKnownDialogs
["modules/simpress/ui/presentationdialog.ui"] = 13;
229 rKnownDialogs
["modules/simpress/ui/remotedialog.ui"] = 14;
230 rKnownDialogs
["modules/sdraw/ui/drawprtldialog.ui"] = 15;
231 rKnownDialogs
["modules/simpress/ui/slidedesigndialog.ui"] = 16;
232 rKnownDialogs
["modules/simpress/ui/templatedialog.ui"] = 17;
233 rKnownDialogs
["modules/simpress/ui/interactiondialog.ui"] = 18;
234 rKnownDialogs
["modules/sdraw/ui/vectorize.ui"] = 19;
235 rKnownDialogs
["modules/simpress/ui/photoalbum.ui"] = 20;
236 rKnownDialogs
["modules/simpress/ui/masterlayoutdlg.ui"] = 21;
237 rKnownDialogs
["modules/simpress/ui/headerfooterdialog.ui"] = 22;
240 VclPtr
<VclAbstractDialog
> SdDialogsTest::createDialogByID(sal_uInt32 nID
)
242 VclPtr
<VclAbstractDialog
> pRetval
;
244 if (getSdAbstractDialogFactory())
250 // CreateSdPublishingDlg(vcl::Window* pWindow, DocumentType eDocType) override;
251 // this dialog does not need much, not even a SdDrawDocument. OTOH
252 // it is more a 'wizard' in that it has prev/next buttons and implicitly
253 // multiple pages. To make use of that it is necessary that the implementation
254 // supports the 'Screenshot interface'
255 auto const parent
= Application::GetDefDialogParent();
256 pRetval
= getSdAbstractDialogFactory()->CreateSdPublishingDlg(
257 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
258 DocumentType::Impress
);
263 // CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override;
264 // this dialog requires pDrawView. It does not show much when
265 // there is no object selected that can be broken up. For better
266 // results it might be necessary to add/select an object that
267 // delivers a good metafile (which is the base for breaking)
268 auto const parent
= Application::GetDefDialogParent();
269 pRetval
= getSdAbstractDialogFactory()->CreateBreakDlg(
270 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
279 // needs an SfxItemSet, use the one from the 1st object
280 pRetval
= getSdAbstractDialogFactory()->CreateCopyDlg(
281 getViewShell()->GetFrameWeld(),
282 getSfxItemSetFromSdrObject(),
288 // CreateSdCustomShowDlg(SdDrawDocument& rDrawDoc) = 0;
289 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
290 CPPUNIT_ASSERT(pDrawDoc
);
292 pRetval
= getSdAbstractDialogFactory()->CreateSdCustomShowDlg(
293 getViewShell()->GetFrameWeld(), *pDrawDoc
);
298 // CreateSdTabCharDialog(const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override;
299 // needs an SfxItemSet, use an empty constructed one
300 // needs a 'SfxObjectShell* pDocShell', crashes without
301 pRetval
= getSdAbstractDialogFactory()->CreateSdTabCharDialog(
302 getViewShell()->GetFrameWeld(),
303 &getEmptySfxItemSet(),
309 // CreateSdTabPageDialog(const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage = true, bool bIsImpressDoc) override;
310 // needs a special SfxItemSet with merged content from page and other stuff, crashes without that (2nd page)
311 // needs a 'SfxObjectShell* pDocShell', crashes without. Also sufficient: FillStyleItemSet with XFILL_NONE set
312 pRetval
= getSdAbstractDialogFactory()->CreateSdTabPageDialog(
313 getViewShell()->GetFrameWeld(),
314 &getEmptyFillStyleSfxItemSet(),
321 // CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override;
322 pRetval
= getSdAbstractDialogFactory()->CreateSdModifyFieldDlg(
323 getViewShell()->GetFrameWeld(),
325 getEmptySfxItemSet());
330 // CreateSdSnapLineDlg(const SfxItemSet& rInAttrs, ::sd::View* pView) override;
331 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
332 CPPUNIT_ASSERT(pDrawDoc
);
333 SfxItemSet
aNewAttr(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_SNAPLINE_START
, ATTR_SNAPLINE_END
>{});
334 aNewAttr
.Put(SfxInt32Item(ATTR_SNAPLINE_X
, 0));
335 aNewAttr
.Put(SfxInt32Item(ATTR_SNAPLINE_Y
, 0));
336 pRetval
= getSdAbstractDialogFactory()->CreateSdSnapLineDlg(
337 getViewShell()->GetFrameWeld(),
344 // CreateSdInsertLayerDlg(const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override;
345 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
346 CPPUNIT_ASSERT(pDrawDoc
);
347 SfxItemSet
aNewAttr(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_LAYER_START
, ATTR_LAYER_END
>{});
348 const OUString aLayerName
= SdResId(STR_LAYER
); // + OUString::number(2);
349 aNewAttr
.Put(makeSdAttrLayerName(aLayerName
));
350 aNewAttr
.Put(makeSdAttrLayerTitle());
351 aNewAttr
.Put(makeSdAttrLayerDesc());
352 aNewAttr
.Put(makeSdAttrLayerVisible());
353 aNewAttr
.Put(makeSdAttrLayerPrintable());
354 aNewAttr
.Put(makeSdAttrLayerLocked());
355 aNewAttr
.Put(makeSdAttrLayerThisPage());
356 pRetval
= getSdAbstractDialogFactory()->CreateSdInsertLayerDlg(
357 getViewShell()->GetFrameWeld(),
359 true, // alternative: false
360 SdResId(STR_INSERTLAYER
) /* alternative: STR_MODIFYLAYER */);
365 // CreateSdInsertPagesObjsDlg(const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName) override;
366 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
367 CPPUNIT_ASSERT(pDrawDoc
);
368 const OUString
aFileName("foo");
369 pRetval
= getSdAbstractDialogFactory()->CreateSdInsertPagesObjsDlg(
370 getViewShell()->GetFrameWeld(),
378 // CreateMorphDlg(weld::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
379 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
380 CPPUNIT_ASSERT(pDrawDoc
);
381 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
382 CPPUNIT_ASSERT(pSdPage
);
383 SdrObject
* pSdrObj
= pSdPage
->GetObj(0);
384 // using one SdrObject is okay, none crashes
385 CPPUNIT_ASSERT(pSdrObj
);
386 auto const parent
= Application::GetDefDialogParent();
387 pRetval
= getSdAbstractDialogFactory()->CreateMorphDlg(
388 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
395 // CreateSdOutlineBulletTabDlg(const SfxItemSet* pAttr, ::sd::View* pView = nullptr) override;
396 auto const parent
= Application::GetDefDialogParent();
397 pRetval
= getSdAbstractDialogFactory()->CreateSdOutlineBulletTabDlg(
398 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
399 &getEmptySfxItemSet(),
405 // CreateSdParagraphTabDlg(const SfxItemSet* pAttr) override;
406 pRetval
= getSdAbstractDialogFactory()->CreateSdParagraphTabDlg(
407 getViewShell()->GetFrameWeld(),
408 &getEmptySfxItemSet());
413 // CreateSdStartPresentationDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, const std::vector<OUString> &rPageNames, SdCustomShowList* pCSList) override;
414 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
415 CPPUNIT_ASSERT(pDrawDoc
);
416 SfxItemSet
aDlgSet(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_PRESENT_START
, ATTR_PRESENT_END
>{});
417 ::sd::PresentationSettings
& rPresentationSettings
= pDrawDoc
->getPresentationSettings();
418 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ALL
, rPresentationSettings
.mbAll
));
419 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_CUSTOMSHOW
, rPresentationSettings
.mbCustomShow
));
420 aDlgSet
.Put(SfxStringItem(ATTR_PRESENT_DIANAME
, OUString()));
421 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ENDLESS
, rPresentationSettings
.mbEndless
));
422 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_MANUEL
, rPresentationSettings
.mbManual
));
423 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_MOUSE
, rPresentationSettings
.mbMouseVisible
));
424 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_PEN
, rPresentationSettings
.mbMouseAsPen
));
425 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ANIMATION_ALLOWED
, rPresentationSettings
.mbAnimationAllowed
));
426 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_CHANGE_PAGE
, !rPresentationSettings
.mbLockedPages
));
427 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_ALWAYS_ON_TOP
, rPresentationSettings
.mbAlwaysOnTop
));
428 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_FULLSCREEN
, rPresentationSettings
.mbFullScreen
));
429 aDlgSet
.Put(SfxUInt32Item(ATTR_PRESENT_PAUSE_TIMEOUT
, rPresentationSettings
.mnPauseTimeout
));
430 aDlgSet
.Put(SfxBoolItem(ATTR_PRESENT_SHOW_PAUSELOGO
, rPresentationSettings
.mbShowPauseLogo
));
431 //SdOptions* pOptions = SD_MOD()->GetSdOptions(DocumentType::Impress);
432 aDlgSet
.Put(SfxInt32Item(ATTR_PRESENT_DISPLAY
, 0 /*pOptions->GetDisplay()*/));
433 vcl::Window
* pWin
= Application::GetDefDialogParent();
434 pRetval
= getSdAbstractDialogFactory()->CreateSdStartPresentationDlg(
435 pWin
? pWin
->GetFrameWeld() : nullptr,
437 std::vector
<OUString
>(),
443 auto const parent
= Application::GetDefDialogParent();
444 // CreateRemoteDialog(vcl::Window* pWindow) override; // ad for RemoteDialog
445 pRetval
= getSdAbstractDialogFactory()->CreateRemoteDialog(
446 parent
== nullptr ? nullptr : parent
->GetFrameWeld());
451 // CreateSdPresLayoutTemplateDlg(SfxObjectShell* pDocSh, weld::Window* pParent, const SdResId& DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool) override;
452 // use STR_PSEUDOSHEET_TITLE configuration, see futempl.cxx for more possible configurations
453 // may be nicer on the long run to take a configuration which represents a selected SdrObject
454 SfxStyleSheetBasePool
* pStyleSheetPool
= getDocShell()->GetStyleSheetPool();
455 CPPUNIT_ASSERT(pStyleSheetPool
);
456 SfxStyleSheetBase
* pStyleSheet
= pStyleSheetPool
->First();
457 CPPUNIT_ASSERT(pStyleSheet
);
458 vcl::Window
* pWin
= Application::GetDefDialogParent();
459 pRetval
= getSdAbstractDialogFactory()->CreateSdPresLayoutTemplateDlg(
461 pWin
? pWin
->GetFrameWeld() : nullptr,
470 // CreateSdPresLayoutDlg(::sd::DrawDocShell* pDocShell, vcl::Window* pWindow, const SfxItemSet& rInAttrs) override;
471 auto const parent
= Application::GetDefDialogParent();
472 pRetval
= getSdAbstractDialogFactory()->CreateSdPresLayoutDlg(
473 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
475 getEmptySfxItemSet());
480 // CreateSdTabTemplateDlg(const SfxObjectShell* pDocShell, SfxStyleSheetBase& rStyleBase, SdrModel* pModel, SdrView* pView) override;
481 // pretty similar to CreateSdPresLayoutTemplateDlg, see above
482 // may be nicer on the long run to take a configuration which represents a selected SdrObject
483 SfxStyleSheetBasePool
* pStyleSheetPool
= getDocShell()->GetStyleSheetPool();
484 CPPUNIT_ASSERT(pStyleSheetPool
);
485 SfxStyleSheetBase
* pStyleSheet
= pStyleSheetPool
->First();
486 CPPUNIT_ASSERT(pStyleSheet
);
487 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
488 CPPUNIT_ASSERT(pDrawDoc
);
489 pRetval
= getSdAbstractDialogFactory()->CreateSdTabTemplateDlg(
490 getViewShell()->GetFrameWeld(),
499 // CreatSdActionDialog(const SfxItemSet* pAttr, ::sd::View* pView) override;
500 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
501 CPPUNIT_ASSERT(pDrawDoc
);
502 SfxItemSet
aSet(pDrawDoc
->GetItemPool(), svl::Items
<ATTR_ANIMATION_START
, ATTR_ACTION_END
>{});
503 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE
, false));
504 aSet
.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
505 aSet
.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
506 aSet
.InvalidateItem(ATTR_ANIMATION_SPEED
);
507 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT
, false));
508 aSet
.Put(SvxColorItem(COL_LIGHTGRAY
, ATTR_ANIMATION_COLOR
));
509 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE
, false));
510 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON
, false));
511 aSet
.InvalidateItem(ATTR_ANIMATION_SOUNDFILE
);
512 aSet
.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL
, false));
513 aSet
.Put(SfxUInt16Item(ATTR_ACTION
, sal_uInt16(presentation::ClickAction_NONE
)));
514 aSet
.InvalidateItem(ATTR_ACTION_FILENAME
);
515 aSet
.Put(SfxUInt16Item(ATTR_ACTION_EFFECT
, sal_uInt16(presentation::AnimationEffect_NONE
)));
516 aSet
.InvalidateItem(ATTR_ACTION_EFFECTSPEED
);
517 aSet
.Put(SfxBoolItem(ATTR_ACTION_SOUNDON
, false));
518 aSet
.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL
, false));
519 pRetval
= getSdAbstractDialogFactory()->CreatSdActionDialog(
520 getViewShell()->GetFrameWeld(),
527 // CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd::DrawDocShell* pDocShell) override;
528 // works well with empty Bitmap, but my be nicer with setting one
530 auto const parent
= Application::GetDefDialogParent();
531 pRetval
= getSdAbstractDialogFactory()->CreateSdVectorizeDlg(
532 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
539 // CreateSdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* pDoc) override;
540 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
541 CPPUNIT_ASSERT(pDrawDoc
);
542 auto const parent
= Application::GetDefDialogParent();
543 pRetval
= getSdAbstractDialogFactory()->CreateSdPhotoAlbumDialog(
544 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
550 // CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) override;
551 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
552 CPPUNIT_ASSERT(pDrawDoc
);
553 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
554 CPPUNIT_ASSERT(pSdPage
);
555 auto const parent
= Application::GetDefDialogParent();
556 pRetval
= getSdAbstractDialogFactory()->CreateMasterLayoutDialog(
557 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
564 // CreateHeaderFooterDialog(sd::ViewShell* pViewShell, weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage) override;
565 // This is a hard case, for two reasons:
566 // - It uses BaseClass TabPage which has a very sparse interface,
567 // need to add 'Screenshot interface' there and implement
568 // - The concrete dialog has two TabPages which use the *same*
569 // .ui file, so extended markup will be needed to differ these two
571 SdDrawDocument
* pDrawDoc
= getSdXImpressDocument()->GetDoc();
572 CPPUNIT_ASSERT(pDrawDoc
);
573 SdPage
* pSdPage
= pDrawDoc
->GetSdPage(0, PageKind::Standard
);
574 CPPUNIT_ASSERT(pSdPage
);
575 auto const parent
= Application::GetDefDialogParent();
576 pRetval
= getSdAbstractDialogFactory()->CreateHeaderFooterDialog(
578 parent
== nullptr ? nullptr : parent
->GetFrameWeld(),
591 void SdDialogsTest::openAnyDialog()
593 /// example how to process an input file containing the UXMLDescriptions of the dialogs
597 processDialogBatchFile("sd/qa/unit/data/dialogs-test.txt");
600 /// example how to dump all known dialogs
603 processAllKnownDialogs();
606 /// example how to dump exactly one known dialog
609 // example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
610 // example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
611 // example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
612 ScopedVclPtr
<VclAbstractDialog
> pDlg(createDialogByID(5));
616 // known dialog, dump screenshot to path
617 dumpDialogToPath(*pDlg
);
621 // unknown dialog, should not happen in this basic loop.
622 // You have probably forgotten to add a case and
623 // implementation to createDialogByID, please do this
627 /// example how to dump a dialog using fallback functionality
630 // unknown dialog, try fallback to generic created
631 // VclBuilder-generated instance. Keep in mind that Dialogs
632 // using this mechanism will probably not be layouted well
633 // since the setup/initialization part is missing. Thus,
634 // only use for fallback when only the UI file is available.
636 // Take any example here, it's only for demonstration - using
637 // even a known one to demonstrate the fallback possibility
638 const OString
aUIXMLDescription("modules/sdraw/ui/breakdialog.ui");
640 dumpDialogToPath(aUIXMLDescription
);
644 CPPUNIT_TEST_SUITE_REGISTRATION(SdDialogsTest
);
646 CPPUNIT_PLUGIN_IMPLEMENT();
648 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */