Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <editeng/flstitem.hxx>
21 :
22 : #include <svx/svxids.hrc>
23 :
24 : #include <svx/drawitem.hxx>
25 : #include <svl/intitem.hxx>
26 : #include <svx/ofaitem.hxx>
27 : #include <svx/svxgrahicitem.hxx>
28 : #include <svx/svdmodel.hxx>
29 : #include <svl/cjkoptions.hxx>
30 :
31 : #include <svx/dialogs.hrc>
32 :
33 : #include <svx/svxdlg.hxx>
34 : #include <svx/tabline.hxx>
35 : #include <svl/style.hxx>
36 : #include <svx/xtable.hxx>
37 :
38 : #include "DrawDocShell.hxx"
39 : #include "tabtempl.hxx"
40 : #include "sdresid.hxx"
41 : #include "dlg_char.hxx"
42 : #include "paragr.hxx"
43 : #include <svx/flagsdef.hxx>
44 :
45 : /**
46 : * Constructor of the Tab dialog: appends pages to the dialog
47 : */
48 0 : SdTabTemplateDlg::SdTabTemplateDlg( vcl::Window* pParent,
49 : const SfxObjectShell* pDocShell,
50 : SfxStyleSheetBase& rStyleBase,
51 : SdrModel* pModel,
52 : SdrView* pView )
53 : : SfxStyleDialog(pParent, "TemplateDialog",
54 : "modules/simpress/ui/templatedialog.ui",
55 : rStyleBase)
56 : , rDocShell(*pDocShell)
57 : , pSdrView(pView)
58 : , pColorList(pModel->GetColorList())
59 : , pGradientList(pModel->GetGradientList())
60 : , pHatchingList(pModel->GetHatchList())
61 : , pBitmapList(pModel->GetBitmapList())
62 : , pDashList(pModel->GetDashList())
63 : , pLineEndList(pModel->GetLineEndList())
64 : , m_nLineId(0)
65 : , m_nAreaId(0)
66 : , m_nShadowId(0)
67 : , m_nTransparencyId(0)
68 : , m_nFontId(0)
69 : , m_nFontEffectId(0)
70 : , m_nIndentsId(0)
71 : , m_nTextId(0)
72 : , m_nAnimationId(0)
73 : , m_nDimensionId(0)
74 : , m_nConnectorId(0)
75 : , m_nAlignId(0)
76 : , m_nTabId(0)
77 0 : , m_nAsianTypoId(0)
78 : {
79 : // fill Listbox and overload Select-Handler
80 :
81 0 : m_nLineId = AddTabPage("line", RID_SVXPAGE_LINE);
82 0 : m_nAreaId = AddTabPage("area", RID_SVXPAGE_AREA);
83 0 : m_nShadowId = AddTabPage("shadowing", RID_SVXPAGE_SHADOW);
84 0 : m_nTransparencyId = AddTabPage("transparency", RID_SVXPAGE_TRANSPARENCE);
85 0 : m_nFontId = AddTabPage("font", RID_SVXPAGE_CHAR_NAME);
86 0 : m_nFontEffectId = AddTabPage("fonteffect", RID_SVXPAGE_CHAR_EFFECTS);
87 0 : m_nIndentsId = AddTabPage("indents", RID_SVXPAGE_STD_PARAGRAPH);
88 0 : m_nTextId = AddTabPage("text", RID_SVXPAGE_TEXTATTR);
89 0 : m_nAnimationId = AddTabPage("animation", RID_SVXPAGE_TEXTANIMATION);
90 0 : m_nDimensionId = AddTabPage("dimensioning", RID_SVXPAGE_MEASURE);
91 0 : m_nConnectorId = AddTabPage("connector", RID_SVXPAGE_CONNECTION);
92 0 : m_nAlignId = AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH);
93 0 : m_nTabId = AddTabPage("tabs", RID_SVXPAGE_TABULATOR);
94 0 : SvtCJKOptions aCJKOptions;
95 0 : if( aCJKOptions.IsAsianTypographyEnabled() )
96 0 : m_nAsianTypoId = AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN);
97 : else
98 0 : RemoveTabPage("asiantypo");
99 :
100 0 : nDlgType = 1;
101 0 : nPageType = 0;
102 0 : nPos = 0;
103 :
104 0 : nColorTableState = CT_NONE;
105 0 : nBitmapListState = CT_NONE;
106 0 : nGradientListState = CT_NONE;
107 0 : nHatchingListState = CT_NONE;
108 0 : }
109 :
110 0 : void SdTabTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
111 : {
112 0 : SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
113 0 : if (nId == m_nLineId)
114 : {
115 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
116 0 : aSet.Put (SvxDashListItem(pDashList,SID_DASH_LIST));
117 0 : aSet.Put (SvxLineEndListItem(pLineEndList,SID_LINEEND_LIST));
118 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
119 0 : rPage.PageCreated(aSet);
120 : }
121 0 : else if (nId == m_nAreaId)
122 : {
123 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
124 0 : aSet.Put (SvxGradientListItem(pGradientList,SID_GRADIENT_LIST));
125 0 : aSet.Put (SvxHatchListItem(pHatchingList,SID_HATCH_LIST));
126 0 : aSet.Put (SvxBitmapListItem(pBitmapList,SID_BITMAP_LIST));
127 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
128 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
129 0 : aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
130 0 : rPage.PageCreated(aSet);
131 : }
132 0 : else if (nId == m_nShadowId)
133 : {
134 0 : aSet.Put (SvxColorListItem(pColorList,SID_COLOR_TABLE));
135 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
136 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
137 0 : rPage.PageCreated(aSet);
138 : }
139 0 : else if (nId == m_nTransparencyId)
140 : {
141 0 : aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
142 0 : aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
143 0 : rPage.PageCreated(aSet);
144 : }
145 0 : else if (nId == m_nFontId)
146 : {
147 : SvxFontListItem aItem(*( (const SvxFontListItem*)
148 0 : ( rDocShell.GetItem( SID_ATTR_CHAR_FONTLIST) ) ) );
149 :
150 0 : aSet.Put (SvxFontListItem( aItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
151 0 : rPage.PageCreated(aSet);
152 : }
153 0 : else if (nId == m_nFontEffectId)
154 : {
155 0 : aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
156 0 : rPage.PageCreated(aSet);
157 : }
158 0 : else if (nId == m_nTextId)
159 : {
160 0 : aSet.Put(OfaPtrItem(SID_SVXTEXTATTRPAGE_VIEW,pSdrView));
161 0 : rPage.PageCreated(aSet);
162 : }
163 0 : else if (nId == m_nDimensionId)
164 : {
165 0 : aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
166 0 : rPage.PageCreated(aSet);
167 : }
168 0 : else if (nId == m_nConnectorId)
169 : {
170 0 : aSet.Put (OfaPtrItem(SID_OBJECT_LIST,pSdrView));
171 0 : rPage.PageCreated(aSet);
172 0 : }
173 0 : }
174 :
175 0 : const SfxItemSet* SdTabTemplateDlg::GetRefreshedSet()
176 : {
177 0 : SfxItemSet* pRet = GetInputSetImpl();
178 :
179 0 : if( pRet )
180 : {
181 0 : pRet->ClearItem();
182 0 : pRet->SetParent( GetStyleSheet().GetItemSet().GetParent() );
183 : }
184 : else
185 0 : pRet = new SfxItemSet( GetStyleSheet().GetItemSet() );
186 :
187 0 : return pRet;
188 0 : }
189 :
190 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|