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 #include <svx/dialogs.hrc>
21 #include <editeng/flstitem.hxx>
22 #include <svx/flagsdef.hxx>
23 #include <sfx2/objsh.hxx>
24 #include <sfx2/sfxdlg.hxx>
26 #include <dlg_char.hxx>
27 #include <svx/svxids.hrc>
28 #include <svl/intitem.hxx>
31 * Constructor of tab dialog: append pages to dialog
33 SdCharDlg::SdCharDlg(weld::Window
* pParent
, const SfxItemSet
* pAttr
,
34 const SfxObjectShell
* pDocShell
)
35 : SfxTabDialogController(pParent
, u
"modules/sdraw/ui/drawchardialog.ui"_ustr
,
36 u
"DrawCharDialog"_ustr
, pAttr
)
37 , rDocShell(*pDocShell
)
39 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
41 AddTabPage(u
"RID_SVXPAGE_CHAR_NAME"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME
), nullptr);
42 AddTabPage(u
"RID_SVXPAGE_CHAR_EFFECTS"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS
), nullptr);
43 AddTabPage(u
"RID_SVXPAGE_CHAR_POSITION"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_POSITION
), nullptr);
44 AddTabPage(u
"RID_SVXPAGE_BKG"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_BKG
), nullptr);
47 void SdCharDlg::PageCreated(const OUString
& rId
, SfxTabPage
&rPage
)
49 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
50 if (rId
== "RID_SVXPAGE_CHAR_NAME")
52 SvxFontListItem
aItem(* static_cast<const SvxFontListItem
*>( rDocShell
.GetItem( SID_ATTR_CHAR_FONTLIST
) ) );
54 aSet
.Put (SvxFontListItem( aItem
.GetFontList(), SID_ATTR_CHAR_FONTLIST
));
55 rPage
.PageCreated(aSet
);
57 else if (rId
== "RID_SVXPAGE_CHAR_EFFECTS")
59 // Opt in for character transparency.
60 aSet
.Put(SfxUInt32Item(SID_FLAG_TYPE
, SVX_ENABLE_CHAR_TRANSPARENCY
));
61 rPage
.PageCreated(aSet
);
63 else if (rId
== "RID_SVXPAGE_BKG")
65 aSet
.Put(SfxUInt32Item(SID_FLAG_TYPE
,static_cast<sal_uInt32
>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR
)));
66 rPage
.PageCreated(aSet
);
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */