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>
22 #include <svx/svxids.hrc>
24 #include <svx/drawitem.hxx>
25 #include <svl/intitem.hxx>
26 #include <svx/ofaitem.hxx>
27 #include <svx/svdmark.hxx>
28 #include <svx/svdmodel.hxx>
29 #include <svx/svdview.hxx>
30 #include <svx/svxgrahicitem.hxx>
31 #include <svl/cjkoptions.hxx>
33 #include <svx/dialogs.hrc>
35 #include <svx/svxdlg.hxx>
36 #include <svx/tabline.hxx>
37 #include <svl/style.hxx>
38 #include <svx/xtable.hxx>
40 #include <DrawDocShell.hxx>
41 #include <tabtempl.hxx>
42 #include <dlg_char.hxx>
44 #include <svx/flagsdef.hxx>
47 * Constructor of the Tab dialog: appends pages to the dialog
49 SdTabTemplateDlg::SdTabTemplateDlg( vcl::Window
* pParent
,
50 const SfxObjectShell
* pDocShell
,
51 SfxStyleSheetBase
& rStyleBase
,
52 SdrModel
const * pModel
,
54 : SfxStyleDialog(pParent
, "TemplateDialog",
55 "modules/simpress/ui/templatedialog.ui",
57 , rDocShell(*pDocShell
)
59 , pColorList(pModel
->GetColorList())
60 , pGradientList(pModel
->GetGradientList())
61 , pHatchingList(pModel
->GetHatchList())
62 , pBitmapList(pModel
->GetBitmapList())
63 , pPatternList(pModel
->GetPatternList())
64 , pDashList(pModel
->GetDashList())
65 , pLineEndList(pModel
->GetLineEndList())
69 , m_nTransparencyId(0)
77 // fill Listbox and set Select-Handler
79 m_nLineId
= AddTabPage("line", RID_SVXPAGE_LINE
);
80 m_nAreaId
= AddTabPage("area", RID_SVXPAGE_AREA
);
81 m_nShadowId
= AddTabPage("shadowing", RID_SVXPAGE_SHADOW
);
82 m_nTransparencyId
= AddTabPage("transparency", RID_SVXPAGE_TRANSPARENCE
);
83 m_nFontId
= AddTabPage("font", RID_SVXPAGE_CHAR_NAME
);
84 m_nFontEffectId
= AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS
);
85 m_nBackgroundId
= AddTabPage("background", RID_SVXPAGE_BACKGROUND
);
86 AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH
);
87 m_nTextId
= AddTabPage("text", RID_SVXPAGE_TEXTATTR
);
88 AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION
);
89 m_nDimensionId
= AddTabPage("dimensioning", RID_SVXPAGE_MEASURE
);
90 m_nConnectorId
= AddTabPage("connector", RID_SVXPAGE_CONNECTION
);
91 AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH
);
92 AddTabPage("tabs", RID_SVXPAGE_TABULATOR
);
93 SvtCJKOptions aCJKOptions
;
94 if( aCJKOptions
.IsAsianTypographyEnabled() )
95 AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN
);
97 RemoveTabPage("asiantypo");
100 void SdTabTemplateDlg::PageCreated( sal_uInt16 nId
, SfxTabPage
&rPage
)
102 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
103 if (nId
== m_nLineId
)
105 aSet
.Put (SvxColorListItem(pColorList
,SID_COLOR_TABLE
));
106 aSet
.Put (SvxDashListItem(pDashList
,SID_DASH_LIST
));
107 aSet
.Put (SvxLineEndListItem(pLineEndList
,SID_LINEEND_LIST
));
108 aSet
.Put (SfxUInt16Item(SID_DLG_TYPE
,1));
109 rPage
.PageCreated(aSet
);
111 else if (nId
== m_nAreaId
)
113 aSet
.Put (SvxColorListItem(pColorList
,SID_COLOR_TABLE
));
114 aSet
.Put (SvxGradientListItem(pGradientList
,SID_GRADIENT_LIST
));
115 aSet
.Put (SvxHatchListItem(pHatchingList
,SID_HATCH_LIST
));
116 aSet
.Put (SvxBitmapListItem(pBitmapList
,SID_BITMAP_LIST
));
117 aSet
.Put (SfxUInt16Item(SID_PAGE_TYPE
,0));
118 aSet
.Put (SfxUInt16Item(SID_DLG_TYPE
,1));
119 aSet
.Put (SfxUInt16Item(SID_TABPAGE_POS
,0));
120 aSet
.Put (SvxPatternListItem(pPatternList
,SID_PATTERN_LIST
));
121 rPage
.PageCreated(aSet
);
123 else if (nId
== m_nShadowId
)
125 aSet
.Put (SvxColorListItem(pColorList
,SID_COLOR_TABLE
));
126 aSet
.Put (SfxUInt16Item(SID_PAGE_TYPE
,0));
127 aSet
.Put (SfxUInt16Item(SID_DLG_TYPE
,1));
128 rPage
.PageCreated(aSet
);
130 else if (nId
== m_nTransparencyId
)
132 aSet
.Put (SfxUInt16Item(SID_PAGE_TYPE
,0));
133 aSet
.Put (SfxUInt16Item(SID_DLG_TYPE
,1));
134 rPage
.PageCreated(aSet
);
136 else if (nId
== m_nFontId
)
138 SvxFontListItem
aItem(*static_cast<const SvxFontListItem
*>(
139 rDocShell
.GetItem( SID_ATTR_CHAR_FONTLIST
) ) );
141 aSet
.Put (SvxFontListItem( aItem
.GetFontList(), SID_ATTR_CHAR_FONTLIST
));
142 rPage
.PageCreated(aSet
);
144 else if (nId
== m_nFontEffectId
)
146 rPage
.PageCreated(aSet
);
148 else if (nId
== m_nBackgroundId
)
150 aSet
.Put(SfxUInt32Item(SID_FLAG_TYPE
,static_cast<sal_uInt32
>(SvxBackgroundTabFlags::SHOW_CHAR_BKGCOLOR
)));
151 rPage
.PageCreated(aSet
);
153 else if (nId
== m_nTextId
)
155 rPage
.PageCreated(aSet
);
157 else if (nId
== m_nDimensionId
)
159 aSet
.Put (OfaPtrItem(SID_OBJECT_LIST
,pSdrView
));
160 rPage
.PageCreated(aSet
);
162 else if (nId
== m_nConnectorId
)
164 aSet
.Put (OfaPtrItem(SID_OBJECT_LIST
,pSdrView
));
165 rPage
.PageCreated(aSet
);
169 void SdTabTemplateDlg::RefreshInputSet()
171 SfxItemSet
* pInputSet
= GetInputSetImpl();
175 pInputSet
->ClearItem();
176 pInputSet
->SetParent( GetStyleSheet().GetItemSet().GetParent() );
179 SetInputSet(&GetStyleSheet().GetItemSet());
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */