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 <editeng/flstitem.hxx>
21 #include <svl/cjkoptions.hxx>
24 #include <swtypes.hxx>
29 #include <strings.hrc>
30 #include <chrdlgmodes.hxx>
31 #include <sfx2/filedlghelper.hxx>
33 #include <svx/svxdlg.hxx>
34 #include <svx/flagsdef.hxx>
35 #include <svx/dialogs.hrc>
37 using namespace ::com::sun::star::ui::dialogs
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::sfx2
;
41 SwCharDlg::SwCharDlg(weld::Window
* pParent
, SwView
& rVw
, const SfxItemSet
& rCoreSet
,
42 SwCharDlgMode nDialogMode
, const OUString
* pStr
)
43 : SfxTabDialogController(pParent
, u
"modules/swriter/ui/characterproperties.ui"_ustr
,
44 u
"CharacterPropertiesDialog"_ustr
, &rCoreSet
, pStr
!= nullptr)
46 , m_nDialogMode(nDialogMode
)
50 m_xDialog
->set_title(m_xDialog
->get_title() + SwResId(STR_TEXTCOLL_HEADER
) + *pStr
+ ")");
52 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
53 AddTabPage(u
"font"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_NAME
), nullptr);
54 AddTabPage(u
"fonteffects"_ustr
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_CHAR_EFFECTS
), nullptr);
55 AddTabPage(u
"position"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION
), nullptr );
56 AddTabPage(u
"asianlayout"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES
), nullptr );
57 AddTabPage(u
"background"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BKG
), nullptr );
58 AddTabPage(u
"borders"_ustr
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), nullptr );
60 if (m_nDialogMode
== SwCharDlgMode::Draw
|| m_nDialogMode
== SwCharDlgMode::Ann
)
62 RemoveTabPage(u
"asianlayout"_ustr
);
66 if (!SvtCJKOptions::IsDoubleLinesEnabled())
67 RemoveTabPage(u
"asianlayout"_ustr
);
70 if (m_nDialogMode
!= SwCharDlgMode::Std
)
71 RemoveTabPage(u
"borders"_ustr
);
74 SwCharDlg::~SwCharDlg()
79 void SwCharDlg::PageCreated(const OUString
& rId
, SfxTabPage
&rPage
)
81 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
84 SvxFontListItem
aFontListItem( *static_cast<const SvxFontListItem
*>(
85 ( m_rView
.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST
) ) ) );
86 aSet
.Put (SvxFontListItem( aFontListItem
.GetFontList(), SID_ATTR_CHAR_FONTLIST
));
87 if(m_nDialogMode
!= SwCharDlgMode::Draw
&& m_nDialogMode
!= SwCharDlgMode::Ann
)
88 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
,SVX_PREVIEW_CHARACTER
));
89 rPage
.PageCreated(aSet
);
91 else if (rId
== "fonteffects")
94 SfxUInt32Item(SID_FLAG_TYPE
, SVX_PREVIEW_CHARACTER
| SVX_ENABLE_CHAR_TRANSPARENCY
));
95 rPage
.PageCreated(aSet
);
97 else if (rId
== "position")
99 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
,SVX_PREVIEW_CHARACTER
));
100 rPage
.PageCreated(aSet
);
102 else if (rId
== "asianlayout")
104 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
,SVX_PREVIEW_CHARACTER
));
105 rPage
.PageCreated(aSet
);
107 else if (rId
== "background")
109 SvxBackgroundTabFlags
eFlags(SvxBackgroundTabFlags::SHOW_HIGHLIGHTING
);
110 if (m_nDialogMode
== SwCharDlgMode::Draw
|| m_nDialogMode
== SwCharDlgMode::Ann
)
111 eFlags
= SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR
;
112 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
,static_cast<sal_uInt32
>(eFlags
)));
113 rPage
.PageCreated(aSet
);
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */