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 : #ifndef INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
21 : #define INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
22 :
23 : #include <vector>
24 : #include <svx/tabline.hxx>
25 :
26 : class SvxLineTabDialog : public SfxTabDialog
27 : {
28 : sal_uInt16 m_nLineTabPage;
29 : sal_uInt16 m_nShadowTabPage;
30 : sal_uInt16 m_nStyleTabPage;
31 : sal_uInt16 m_nEndTabPage;
32 :
33 : private:
34 : SdrModel* pDrawModel;
35 : const SdrObject* pObj;
36 :
37 : const SfxItemSet& rOutAttrs;
38 :
39 : XColorListRef pColorList;
40 : XColorListRef mpNewColorList;
41 : XDashListRef pDashList;
42 : XDashListRef pNewDashList;
43 : XLineEndListRef pLineEndList;
44 : XLineEndListRef pNewLineEndList;
45 : sal_Bool bObjSelected;
46 :
47 : ChangeType nLineEndListState;
48 : ChangeType nDashListState;
49 : ChangeType mnColorListState;
50 :
51 : sal_uInt16 nPageType;
52 : sal_Int32 nPosDashLb;
53 : sal_Int32 nPosLineEndLb;
54 : sal_Bool mbAreaTP;
55 :
56 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
57 :
58 : protected:
59 : virtual short Ok() SAL_OVERRIDE;
60 : DECL_LINK( CancelHdlImpl, void * );
61 : void SavePalettes();
62 :
63 : public:
64 : SvxLineTabDialog( Window* pParent, const SfxItemSet* pAttr,
65 : SdrModel* pModel, const SdrObject* pObj = NULL,
66 : sal_Bool bHasObj = sal_True );
67 : virtual ~SvxLineTabDialog();
68 :
69 0 : void SetNewDashList( XDashListRef pInLst)
70 0 : { pNewDashList = pInLst; }
71 0 : XDashListRef GetNewDashList() const { return pNewDashList; }
72 : XDashListRef GetDashList() const { return pDashList; }
73 :
74 0 : void SetNewLineEndList( XLineEndListRef pInLst)
75 0 : { pNewLineEndList = pInLst; }
76 0 : XLineEndListRef GetNewLineEndList() const { return pNewLineEndList; }
77 : XLineEndListRef GetLineEndList() const { return pLineEndList; }
78 :
79 0 : void SetNewColorList( XColorListRef pColTab ) { mpNewColorList = pColTab; }
80 0 : XColorListRef GetNewColorList() const { return mpNewColorList; }
81 0 : XColorListRef GetColorList() const { return pColorList; }
82 : };
83 :
84 : /*************************************************************************/
85 :
86 : struct SvxBmpItemInfo;
87 : typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList;
88 :
89 : class SvxLineTabPage : public SvxTabPage
90 : {
91 : using TabPage::ActivatePage;
92 : using TabPage::DeactivatePage;
93 : private:
94 : VclBox* m_pBoxColor;
95 : LineLB* m_pLbLineStyle;
96 : ColorLB* m_pLbColor;
97 : VclBox* m_pBoxWidth;
98 : MetricField* m_pMtrLineWidth;
99 : VclBox* m_pBoxTransparency;
100 : MetricField* m_pMtrTransparent;
101 :
102 : VclFrame* m_pFlLineEnds;
103 : VclBox* m_pBoxArrowStyles;
104 : LineEndLB* m_pLbStartStyle;
105 : VclBox* m_pBoxStart;
106 : MetricField* m_pMtrStartWidth;
107 : TriStateBox* m_pTsbCenterStart;
108 : VclBox* m_pBoxEnd;
109 : LineEndLB* m_pLbEndStyle;
110 : MetricField* m_pMtrEndWidth;
111 : TriStateBox* m_pTsbCenterEnd;
112 : CheckBox* m_pCbxSynchronize;
113 : SvxXLinePreview* m_pCtlPreview;
114 :
115 : // #116827#
116 : VclFrame* m_pFLEdgeStyle;
117 : VclGrid* m_pGridEdgeCaps;
118 : ListBox* m_pLBEdgeStyle;
119 :
120 : // LineCaps
121 : ListBox* m_pLBCapStyle;
122 :
123 : //#58425# symbols on a line (e. g. StarChart) ->
124 : /** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview.
125 : The list position is to be used cyclic. */
126 : SdrObjList* pSymbolList;
127 : bool bNewSize;
128 : /// a graphic to be displayed in the preview in case that an automatic symbol is choosen
129 : Graphic aAutoSymbolGraphic;
130 : long nNumMenuGalleryItems;
131 : long nSymbolType;
132 : /// attributes for the shown symbols; only necessary if not equal to line properties
133 : SfxItemSet* pSymbolAttr;
134 : VclFrame* m_pFlSymbol;
135 : VclGrid* m_pGridIconSize;
136 : MenuButton* m_pSymbolMB;
137 : MetricField* m_pSymbolWidthMF;
138 : MetricField* m_pSymbolHeightMF;
139 : CheckBox* m_pSymbolRatioCB;
140 : std::vector<OUString> aGrfNames;
141 : SvxBmpItemInfoList aGrfBrushItems;
142 : sal_Bool bLastWidthModified;
143 : Size aSymbolLastSize;
144 : Graphic aSymbolGraphic;
145 : Size aSymbolSize;
146 : sal_Bool bSymbols;
147 :
148 : const SfxItemSet& rOutAttrs;
149 : RECT_POINT eRP;
150 : sal_Bool bObjSelected;
151 :
152 : XOutdevItemPool* pXPool;
153 : XLineStyleItem aXLStyle;
154 : XLineWidthItem aXWidth;
155 : XLineDashItem aXDash;
156 : XLineColorItem aXColor;
157 : XLineAttrSetItem aXLineAttr;
158 : SfxItemSet& rXLSet;
159 :
160 : XColorListRef pColorList;
161 : XDashListRef pDashList;
162 : XLineEndListRef pLineEndList;
163 :
164 : ChangeType* pnLineEndListState;
165 : ChangeType* pnDashListState;
166 : ChangeType* pnColorListState;
167 : sal_uInt16 nPageType;
168 : sal_uInt16 nDlgType;
169 : sal_Int32* pPosDashLb;
170 : sal_Int32* pPosLineEndLb;
171 :
172 : SfxMapUnit ePoolUnit;
173 :
174 : // #63083#
175 : sal_Int32 nActLineWidth;
176 :
177 : // handler for gallery popup menu button + size
178 : DECL_LINK( GraphicHdl_Impl, MenuButton * );
179 : DECL_LINK( MenuCreateHdl_Impl, MenuButton * );
180 : DECL_STATIC_LINK( SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
181 : DECL_LINK( SizeHdl_Impl, MetricField * );
182 : DECL_LINK( RatioHdl_Impl, CheckBox * );
183 :
184 : DECL_LINK( ClickInvisibleHdl_Impl, void * );
185 : DECL_LINK( ChangeStartHdl_Impl, void * );
186 : DECL_LINK( ChangeEndHdl_Impl, void * );
187 : DECL_LINK( ChangePreviewHdl_Impl, void * );
188 : DECL_LINK( ChangeTransparentHdl_Impl, void * );
189 :
190 : // #116827#
191 : DECL_LINK( ChangeEdgeStyleHdl_Impl, void * );
192 :
193 : // LineCaps
194 : DECL_LINK ( ChangeCapStyleHdl_Impl, void * );
195 :
196 : sal_Bool FillXLSet_Impl();
197 :
198 : void InitSymbols(MenuButton* pButton);
199 : void SymbolSelected(MenuButton* pButton);
200 : void FillListboxes();
201 : public:
202 :
203 : void ShowSymbolControls(sal_Bool bOn);
204 :
205 : SvxLineTabPage( Window* pParent, const SfxItemSet& rInAttrs );
206 : virtual ~SvxLineTabPage();
207 :
208 : void Construct();
209 :
210 : static SfxTabPage* Create( Window*, const SfxItemSet& );
211 : static sal_uInt16* GetRanges();
212 :
213 : virtual bool FillItemSet( SfxItemSet& ) SAL_OVERRIDE;
214 : virtual void Reset( const SfxItemSet& ) SAL_OVERRIDE;
215 :
216 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
217 : virtual int DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
218 :
219 : virtual void PointChanged( Window* pWindow, RECT_POINT eRP ) SAL_OVERRIDE;
220 :
221 : virtual void FillUserData() SAL_OVERRIDE;
222 :
223 0 : void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; }
224 0 : void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; }
225 0 : void SetLineEndList( XLineEndListRef pLneEndLst) { pLineEndList = pLneEndLst; }
226 0 : void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; }
227 :
228 0 : void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; }
229 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
230 0 : void SetPosDashLb( sal_Int32* pInPos ) { pPosDashLb = pInPos; }
231 0 : void SetPosLineEndLb( sal_Int32* pInPos ) { pPosLineEndLb = pInPos; }
232 :
233 0 : void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
234 0 : void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
235 0 : void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
236 :
237 : virtual void PageCreated (SfxAllItemSet aSet) SAL_OVERRIDE;
238 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
239 : };
240 :
241 : /*************************************************************************/
242 :
243 0 : class SvxLineDefTabPage : public SfxTabPage
244 : {
245 : using TabPage::ActivatePage;
246 : using TabPage::DeactivatePage;
247 : private:
248 : LineLB* m_pLbLineStyles;
249 : ListBox* m_pLbType1;
250 : ListBox* m_pLbType2;
251 : NumericField* m_pNumFldNumber1;
252 : NumericField* m_pNumFldNumber2;
253 : MetricField* m_pMtrLength1;
254 : MetricField* m_pMtrLength2;
255 : MetricField* m_pMtrDistance;
256 : CheckBox* m_pCbxSynchronize;
257 : PushButton* m_pBtnAdd;
258 : PushButton* m_pBtnModify;
259 : PushButton* m_pBtnDelete;
260 : PushButton* m_pBtnLoad;
261 : PushButton* m_pBtnSave;
262 : SvxXLinePreview* m_pCtlPreview;
263 :
264 : const SfxItemSet& rOutAttrs;
265 : XDash aDash;
266 : sal_Bool bObjSelected;
267 :
268 : XOutdevItemPool* pXPool;
269 : XLineStyleItem aXLStyle;
270 : XLineWidthItem aXWidth;
271 : XLineDashItem aXDash;
272 : XLineColorItem aXColor;
273 : XLineAttrSetItem aXLineAttr;
274 : SfxItemSet& rXLSet;
275 :
276 : XDashListRef pDashList;
277 :
278 : ChangeType* pnDashListState;
279 : sal_uInt16* pPageType;
280 : sal_uInt16 nDlgType;
281 : sal_Int32* pPosDashLb;
282 :
283 : SfxMapUnit ePoolUnit;
284 : FieldUnit eFUnit;
285 :
286 : void FillDash_Impl();
287 : void FillDialog_Impl();
288 :
289 : DECL_LINK( ClickAddHdl_Impl, void * );
290 : DECL_LINK( ClickModifyHdl_Impl, void * );
291 : DECL_LINK( ClickDeleteHdl_Impl, void * );
292 : DECL_LINK( SelectLinestyleHdl_Impl, void * );
293 : DECL_LINK( ChangePreviewHdl_Impl, void * );
294 : DECL_LINK( ChangeNumber1Hdl_Impl, void * );
295 : DECL_LINK( ChangeNumber2Hdl_Impl, void * );
296 : DECL_LINK( ClickLoadHdl_Impl, void * );
297 : DECL_LINK( ClickSaveHdl_Impl, void * );
298 : DECL_LINK( ChangeMetricHdl_Impl, void * );
299 : DECL_LINK( SelectTypeHdl_Impl, void * );
300 :
301 : void CheckChanges_Impl();
302 :
303 : public:
304 : SvxLineDefTabPage( Window* pParent, const SfxItemSet& rInAttrs );
305 :
306 : void Construct();
307 :
308 : static SfxTabPage* Create( Window*, const SfxItemSet& );
309 : virtual bool FillItemSet( SfxItemSet& ) SAL_OVERRIDE;
310 : virtual void Reset( const SfxItemSet & ) SAL_OVERRIDE;
311 :
312 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
313 : virtual int DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
314 :
315 0 : void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; }
316 0 : void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; }
317 :
318 0 : void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
319 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
320 0 : void SetPosDashLb( sal_Int32* pInPos ) { pPosDashLb = pInPos; }
321 :
322 0 : void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; }
323 :
324 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
325 : };
326 :
327 : /*************************************************************************/
328 :
329 : class SvxLineEndDefTabPage : public SfxTabPage
330 : {
331 : using TabPage::ActivatePage;
332 : using TabPage::DeactivatePage;
333 :
334 : private:
335 : Edit* m_pEdtName;
336 : LineEndLB* m_pLbLineEnds;
337 : PushButton* m_pBtnAdd;
338 : PushButton* m_pBtnModify;
339 : PushButton* m_pBtnDelete;
340 : PushButton* m_pBtnLoad;
341 : PushButton* m_pBtnSave;
342 : SvxXLinePreview* m_pCtlPreview;
343 :
344 : const SfxItemSet& rOutAttrs;
345 : const SdrObject* pPolyObj;
346 : sal_Bool bObjSelected;
347 :
348 : XOutdevItemPool* pXPool;
349 : XLineStyleItem aXLStyle;
350 : XLineWidthItem aXWidth;
351 : XLineColorItem aXColor;
352 : XLineAttrSetItem aXLineAttr;
353 : SfxItemSet& rXLSet;
354 :
355 : XLineEndListRef pLineEndList;
356 :
357 : ChangeType* pnLineEndListState;
358 : sal_uInt16* pPageType;
359 : sal_uInt16 nDlgType;
360 : sal_Int32* pPosLineEndLb;
361 :
362 : DECL_LINK( ClickAddHdl_Impl, void * );
363 : DECL_LINK( ClickModifyHdl_Impl, void * );
364 : DECL_LINK( ClickDeleteHdl_Impl, void * );
365 : DECL_LINK( ClickLoadHdl_Impl, void * );
366 : DECL_LINK( ClickSaveHdl_Impl, void * );
367 : DECL_LINK( SelectLineEndHdl_Impl, void * );
368 : long ChangePreviewHdl_Impl( void* p );
369 :
370 : void CheckChanges_Impl();
371 :
372 : public:
373 : SvxLineEndDefTabPage( Window* pParent, const SfxItemSet& rInAttrs );
374 : virtual ~SvxLineEndDefTabPage();
375 :
376 : void Construct();
377 :
378 : static SfxTabPage* Create( Window*, const SfxItemSet& );
379 : virtual bool FillItemSet( SfxItemSet& ) SAL_OVERRIDE;
380 : virtual void Reset( const SfxItemSet & ) SAL_OVERRIDE;
381 :
382 : virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE;
383 : virtual int DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
384 :
385 0 : void SetLineEndList( XLineEndListRef pInList ) { pLineEndList = pInList; }
386 0 : void SetPolyObj( const SdrObject* pObj ) { pPolyObj = pObj; }
387 0 : void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; }
388 :
389 0 : void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; }
390 0 : void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; }
391 0 : void SetPosLineEndLb( sal_Int32* pInPos ) { pPosLineEndLb = pInPos; }
392 :
393 0 : void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; }
394 :
395 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
396 : virtual void Resize() SAL_OVERRIDE;
397 : };
398 :
399 : #endif // INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
400 :
401 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|