Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "DrawViewShell.hxx"
31 : : #include <vcl/wrkwin.hxx>
32 : : #include <svx/xgrad.hxx>
33 : : #include <svx/svdpagv.hxx>
34 : : #include <svx/xlnwtit.hxx>
35 : : #include <svx/xlndsit.hxx>
36 : : #include <svx/xflhtit.hxx>
37 : : #include <svx/xflgrit.hxx>
38 : : #include <svx/xlnclit.hxx>
39 : : #include <svx/xflclit.hxx>
40 : : #include <sfx2/bindings.hxx>
41 : :
42 : : #include <sfx2/dispatch.hxx>
43 : : #include <svl/intitem.hxx>
44 : : #include <sfx2/app.hxx>
45 : : #include <sfx2/request.hxx>
46 : : #include <svl/stritem.hxx>
47 : : #include <svx/svxids.hrc>
48 : : #include <svx/xtable.hxx>
49 : : #include <svx/gallery.hxx>
50 : : #include <vcl/graph.hxx>
51 : : #include <svx/svdograf.hxx>
52 : : #include <svx/svdoole2.hxx>
53 : : #include <sot/storage.hxx>
54 : : #include <svl/whiter.hxx>
55 : : #include <basic/sbstar.hxx>
56 : :
57 : : #include <sfx2/viewfrm.hxx>
58 : :
59 : :
60 : : #include "app.hrc"
61 : : #include "strings.hrc"
62 : : #include "Window.hxx"
63 : : #include "drawdoc.hxx"
64 : : #include "drawview.hxx"
65 : : #include "DrawDocShell.hxx"
66 : : #include "sdresid.hxx"
67 : : #include "fupoor.hxx"
68 : :
69 : : namespace sd {
70 : :
71 : : #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
72 : : #define SO2_DECL_SVINPLACEOBJECT_DEFINED
73 : : SO2_DECL_REF(SvInPlaceObject)
74 : : #endif
75 : : #ifndef SO2_DECL_SVSTORAGE_DEFINED
76 : : #define SO2_DECL_SVSTORAGE_DEFINED
77 : : SO2_DECL_REF(SvStorage)
78 : : #endif
79 : :
80 : :
81 : : /*************************************************************************
82 : : |*
83 : : |* SfxRequests fuer Gallery bearbeiten
84 : : |*
85 : : \************************************************************************/
86 : :
87 : 0 : void DrawViewShell::ExecGallery(SfxRequest& rReq)
88 : : {
89 : : // waehrend einer Diashow wird nichts ausgefuehrt!
90 [ # # ]: 0 : if(HasCurrentFunction(SID_PRESENTATION))
91 : 0 : return;
92 : :
93 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
94 : :
95 [ # # ]: 0 : if ( pArgs )
96 : : {
97 : 0 : const sal_uInt32 nFormats = ( (SfxUInt32Item&) pArgs->Get( SID_GALLERY_FORMATS ) ).GetValue();
98 : 0 : GalleryExplorer* pGal = SVX_GALLERY();
99 : :
100 [ # # ]: 0 : if ( pGal )
101 : : {
102 : 0 : GetDocSh()->SetWaitCursor( sal_True );
103 : :
104 : : // Graphik einfuegen
105 [ # # ]: 0 : if (nFormats & SGA_FORMAT_GRAPHIC)
106 : : {
107 [ # # ]: 0 : Graphic aGraphic = pGal->GetGraphic();
108 : :
109 : : // Ggf. Groesse reduzieren
110 [ # # ][ # # ]: 0 : Window aWindow (GetActiveWindow());
111 [ # # ][ # # ]: 0 : aWindow.SetMapMode(aGraphic.GetPrefMapMode());
[ # # ]
112 [ # # ][ # # ]: 0 : Size aSizePix = aWindow.LogicToPixel(aGraphic.GetPrefSize());
113 [ # # ][ # # ]: 0 : aWindow.SetMapMode( MapMode(MAP_100TH_MM) );
[ # # ]
114 [ # # ]: 0 : Size aSize = aWindow.PixelToLogic(aSizePix);
115 : :
116 : : // Groesse ggf. auf Seitengroesse begrenzen
117 : 0 : SdrPage* pPage = mpDrawView->GetSdrPageView()->GetPage();
118 [ # # ]: 0 : Size aPageSize = pPage->GetSize();
119 [ # # ][ # # ]: 0 : aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
120 [ # # ][ # # ]: 0 : aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
121 : :
122 : :
123 : : // Falls Grafik zu gross, wird die Grafik
124 : : // in die Seite eingepasst
125 [ # # # # : 0 : if ( ( ( aSize.Height() > aPageSize.Height() ) || ( aSize.Width() > aPageSize.Width() ) ) &&
# # ][ # # ]
[ # # ]
126 : 0 : aSize.Height() && aPageSize.Height() )
127 : : {
128 : 0 : float fGrfWH = (float)aSize.Width() /
129 : 0 : (float)aSize.Height();
130 : 0 : float fWinWH = (float)aPageSize.Width() /
131 : 0 : (float)aPageSize.Height();
132 : :
133 : : // Grafik an Pagesize anpassen (skaliert)
134 [ # # ][ # # ]: 0 : if ((fGrfWH != 0.F) && (fGrfWH < fWinWH))
135 : : {
136 : 0 : aSize.Width() = (long)(aPageSize.Height() * fGrfWH);
137 : 0 : aSize.Height()= aPageSize.Height();
138 : : }
139 : : else
140 : : {
141 : 0 : aSize.Width() = aPageSize.Width();
142 : 0 : aSize.Height()= (long)(aPageSize.Width() / fGrfWH);
143 : : }
144 : : }
145 : :
146 : :
147 : : // Ausgaberechteck fuer Grafik setzen
148 : 0 : Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
149 : 0 : (aPageSize.Height() - aSize.Height()) / 2);
150 [ # # ][ # # ]: 0 : aPnt += Point(pPage->GetLftBorder(), pPage->GetUppBorder());
151 [ # # ]: 0 : Rectangle aRect (aPnt, aSize);
152 : :
153 : 0 : SdrGrafObj* pGrafObj = NULL;
154 : :
155 : 0 : sal_Bool bInsertNewObject = sal_True;
156 : :
157 [ # # ]: 0 : if ( mpDrawView->AreObjectsMarked() )
158 : : {
159 : : /******************************************************
160 : : * Ist ein leeres Graphik-Objekt vorhanden?
161 : : ******************************************************/
162 : 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
163 : :
164 [ # # ]: 0 : if (rMarkList.GetMarkCount() == 1)
165 : : {
166 [ # # ]: 0 : SdrMark* pMark = rMarkList.GetMark(0);
167 [ # # ]: 0 : SdrObject* pObj = pMark->GetMarkedSdrObj();
168 : :
169 [ # # ][ # # ]: 0 : if (pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF)
[ # # ][ # # ]
[ # # ]
170 : : {
171 : 0 : pGrafObj = (SdrGrafObj*) pObj;
172 : :
173 [ # # ][ # # ]: 0 : if( pGrafObj->IsEmptyPresObj() )
174 : : {
175 : : /******************************************
176 : : * Das leere Graphik-Objekt bekommt eine neue
177 : : * Graphik
178 : : ******************************************/
179 : 0 : bInsertNewObject = sal_False;
180 : :
181 [ # # ]: 0 : SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pGrafObj->Clone();
182 [ # # ]: 0 : pNewGrafObj->SetEmptyPresObj(sal_False);
183 [ # # ]: 0 : pNewGrafObj->SetOutlinerParaObject(NULL);
184 [ # # ]: 0 : pNewGrafObj->SetGraphic(aGraphic);
185 : :
186 [ # # ]: 0 : String aStr(mpDrawView->GetDescriptionOfMarkedObjects());
187 [ # # ]: 0 : aStr += sal_Unicode(' ');
188 [ # # ][ # # ]: 0 : aStr += String(SdResId(STR_UNDO_REPLACE));
[ # # ][ # # ]
189 [ # # ]: 0 : mpDrawView->BegUndo(aStr);
190 : 0 : SdrPageView* pPV = mpDrawView->GetSdrPageView();
191 [ # # ]: 0 : mpDrawView->ReplaceObjectAtView(pGrafObj, *pPV, pNewGrafObj);
192 [ # # ][ # # ]: 0 : mpDrawView->EndUndo();
193 : : }
194 : : }
195 : : }
196 : : }
197 : :
198 : :
199 [ # # ]: 0 : if( bInsertNewObject )
200 : : {
201 [ # # ][ # # ]: 0 : pGrafObj = new SdrGrafObj(aGraphic, aRect);
202 : 0 : SdrPageView* pPV = mpDrawView->GetSdrPageView();
203 [ # # ]: 0 : mpDrawView->InsertObjectAtView(pGrafObj, *pPV, SDRINSERT_SETDEFLAYER);
204 : : }
205 : :
206 : : // Soll nur ein Link benutzt werden?
207 [ # # ][ # # ]: 0 : if( pGrafObj && pGal->IsLinkage() )
[ # # ][ # # ]
208 [ # # ][ # # ]: 0 : pGrafObj->SetGraphicLink( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ), pGal->GetFilterName() );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
209 : : }
210 : : // insert sound
211 [ # # ]: 0 : else if( nFormats & SGA_FORMAT_SOUND )
212 : : {
213 [ # # ][ # # ]: 0 : const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
[ # # ][ # # ]
214 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
[ # # ]
215 : : }
216 : :
217 : 0 : GetDocSh()->SetWaitCursor( sal_False );
218 : : }
219 : : }
220 : : }
221 : :
222 : :
223 : : /*************************************************************************
224 : : |*
225 : : |* Statuswerte fuer Gallery zurueckgeben
226 : : |*
227 : : \************************************************************************/
228 : :
229 : 0 : void DrawViewShell::GetGalleryState(SfxItemSet& )
230 : : {
231 : 0 : }
232 : :
233 : : /*************************************************************************
234 : : |*
235 : : |* Makros fuer die Attributeinstellungen bearbeiten
236 : : |*
237 : : \************************************************************************/
238 : :
239 : : //
240 : : // die vorgehensweise fuer die attributaenderung ist praktisch ueberall identisch
241 : : // 1. bisherige attribute auslesen
242 : : // 2. parameter aus dem basic-set auslesen
243 : : // 3. gewaehltes item aus dem attribut-set loeschen
244 : : // 4. neues attribut-item erzeugen
245 : : // 5. item in den set eintragen
246 : : //
247 : 0 : void DrawViewShell::AttrExec (SfxRequest &rReq)
248 : : {
249 : : // waehrend einer Diashow wird nichts ausgefuehrt!
250 [ # # ]: 0 : if(HasCurrentFunction(SID_PRESENTATION))
251 : 0 : return;
252 : :
253 : 0 : CheckLineTo (rReq);
254 : :
255 : 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
256 [ # # ]: 0 : SfxItemSet* pAttr = new SfxItemSet ( GetDoc()->GetPool() );
257 : :
258 : 0 : GetView()->GetAttributes( *pAttr );
259 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
260 : :
261 [ # # # # : 0 : switch (rReq.GetSlot ())
# # # # #
# # # # #
# ]
262 : : {
263 : : // neuen fuellstil setzen
264 : : case SID_SETFILLSTYLE :
265 [ # # ]: 0 : if (pArgs)
266 [ # # ]: 0 : if (pArgs->Count () == 1)
267 : : {
268 : 0 : SFX_REQUEST_ARG (rReq, pFillStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
269 [ # # ][ # # ]: 0 : if (CHECK_RANGE (XFILL_NONE, (sal_Int32)pFillStyle->GetValue (), XFILL_BITMAP))
[ # # ]
270 : : {
271 : 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
272 [ # # ]: 0 : pAttr->Put (XFillStyleItem ((XFillStyle) pFillStyle->GetValue ()), XATTR_FILLSTYLE);
273 : 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
274 : : }
275 : : #ifndef DISABLE_SCRIPTING
276 : 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
277 : : #endif
278 : 0 : break;
279 : : }
280 : : #ifndef DISABLE_SCRIPTING
281 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
282 : : #endif
283 : 0 : break;
284 : :
285 : : // linienstil neu bestimmen
286 : : case SID_SETLINESTYLE :
287 [ # # ]: 0 : if (pArgs)
288 [ # # ]: 0 : if (pArgs->Count () == 1)
289 : : {
290 : 0 : SFX_REQUEST_ARG (rReq, pLineStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
291 [ # # ][ # # ]: 0 : if (CHECK_RANGE (XLINE_NONE, (sal_Int32)pLineStyle->GetValue (), XLINE_DASH))
[ # # ]
292 : : {
293 : 0 : pAttr->ClearItem (XATTR_LINESTYLE);
294 [ # # ]: 0 : pAttr->Put (XLineStyleItem ((XLineStyle) pLineStyle->GetValue ()), XATTR_LINESTYLE);
295 : 0 : rBindings.Invalidate (SID_ATTR_LINE_STYLE);
296 : : }
297 : : #ifndef DISABLE_SCRIPTING
298 : 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
299 : : #endif
300 : 0 : break;
301 : : }
302 : : #ifndef DISABLE_SCRIPTING
303 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
304 : : #endif
305 : 0 : break;
306 : :
307 : : // linienbreite setzen
308 : : case SID_SETLINEWIDTH :
309 [ # # ]: 0 : if (pArgs)
310 [ # # ]: 0 : if (pArgs->Count () == 1)
311 : : {
312 : 0 : SFX_REQUEST_ARG (rReq, pLineWidth, SfxUInt32Item, ID_VAL_WIDTH, sal_False);
313 : 0 : pAttr->ClearItem (XATTR_LINEWIDTH);
314 [ # # ]: 0 : pAttr->Put (XLineWidthItem (pLineWidth->GetValue ()), XATTR_LINEWIDTH);
315 : 0 : rBindings.Invalidate (SID_ATTR_LINE_WIDTH);
316 : 0 : break;
317 : : }
318 : : #ifndef DISABLE_SCRIPTING
319 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
320 : : #endif
321 : 0 : break;
322 : :
323 : : case SID_SETFILLCOLOR :
324 [ # # ]: 0 : if (pArgs)
325 [ # # ]: 0 : if (pArgs->Count () == 3)
326 : : {
327 : 0 : SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
328 : 0 : SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
329 : 0 : SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
330 : :
331 : 0 : pAttr->ClearItem (XATTR_FILLCOLOR);
332 : 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
333 : 0 : pAttr->Put (XFillColorItem (-1, Color ((sal_uInt8) pRed->GetValue (),
334 : 0 : (sal_uInt8) pGreen->GetValue (),
335 : 0 : (sal_uInt8) pBlue->GetValue ())),
336 [ # # ][ # # ]: 0 : XATTR_FILLCOLOR);
[ # # ]
337 [ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_SOLID), XATTR_FILLSTYLE);
338 : 0 : rBindings.Invalidate (SID_ATTR_FILL_COLOR);
339 : 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
340 : 0 : break;
341 : : }
342 : : #ifndef DISABLE_SCRIPTING
343 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
344 : : #endif
345 : 0 : break;
346 : :
347 : : case SID_SETLINECOLOR :
348 [ # # ]: 0 : if (pArgs)
349 [ # # ]: 0 : if (pArgs->Count () == 3)
350 : : {
351 : 0 : SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
352 : 0 : SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
353 : 0 : SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
354 : :
355 : 0 : pAttr->ClearItem (XATTR_LINECOLOR);
356 : 0 : pAttr->Put (XLineColorItem (-1, Color ((sal_uInt8) pRed->GetValue (),
357 : 0 : (sal_uInt8) pGreen->GetValue (),
358 : 0 : (sal_uInt8) pBlue->GetValue ())),
359 [ # # ][ # # ]: 0 : XATTR_LINECOLOR);
[ # # ]
360 : 0 : rBindings.Invalidate (SID_ATTR_LINE_COLOR);
361 : 0 : break;
362 : : }
363 : : #ifndef DISABLE_SCRIPTING
364 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
365 : : #endif
366 : 0 : break;
367 : :
368 : : case SID_SETGRADSTARTCOLOR :
369 : : case SID_SETGRADENDCOLOR :
370 [ # # ]: 0 : if (pArgs)
371 [ # # ]: 0 : if (pArgs->Count () == 4)
372 : : {
373 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
374 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
375 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
376 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
377 : :
378 [ # # ][ # # ]: 0 : XGradientListRef pGradientList = GetDoc()->GetGradientList ();
379 [ # # ]: 0 : long nCounts = pGradientList->Count ();
380 : 0 : Color aColor ((sal_uInt8) pRed->GetValue (),
381 : 0 : (sal_uInt8) pGreen->GetValue (),
382 : 0 : (sal_uInt8) pBlue->GetValue ());
383 : : long i;
384 : :
385 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLGRADIENT);
386 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
387 : :
388 [ # # ]: 0 : for ( i = 0; i < nCounts; i ++)
389 : : {
390 [ # # ]: 0 : XGradientEntry *pEntry = pGradientList->GetGradient (i);
391 : :
392 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
393 : : {
394 : 0 : XGradient &rGradient = pEntry->GetGradient ();
395 : :
396 [ # # ]: 0 : if (rReq.GetSlot () == SID_SETGRADSTARTCOLOR) rGradient.SetStartColor (aColor);
397 : 0 : else rGradient.SetEndColor (aColor);
398 : :
399 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
[ # # ]
400 [ # # ][ # # ]: 0 : pAttr->Put (XFillGradientItem (pName->GetValue (), rGradient), XATTR_FILLGRADIENT);
[ # # ]
401 : 0 : break;
402 : : }
403 : : }
404 : :
405 [ # # ]: 0 : if (i >= nCounts)
406 : : {
407 : 0 : Color aBlack (0, 0, 0);
408 : 0 : XGradient aGradient ((rReq.GetSlot () == SID_SETGRADSTARTCOLOR)
409 : : ? aColor
410 : : : aBlack,
411 : 0 : (rReq.GetSlot () == SID_SETGRADENDCOLOR)
412 : : ? aColor
413 [ # # ][ # # ]: 0 : : aBlack);
[ # # ]
414 : :
415 [ # # ][ # # ]: 0 : GetDoc()->GetGradientList ()->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
[ # # ][ # # ]
[ # # ]
416 : :
417 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
[ # # ]
418 [ # # ][ # # ]: 0 : pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT);
[ # # ]
419 : : }
420 : :
421 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
422 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
423 : 0 : break;
424 : : }
425 : : #ifndef DISABLE_SCRIPTING
426 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
427 : : #endif
428 : 0 : break;
429 : :
430 : : case SID_SETHATCHCOLOR :
431 [ # # ]: 0 : if (pArgs)
432 [ # # ]: 0 : if (pArgs->Count () == 4)
433 : : {
434 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
435 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pRed, SfxUInt32Item, ID_VAL_RED, sal_False);
436 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pGreen, SfxUInt32Item, ID_VAL_GREEN, sal_False);
437 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pBlue, SfxUInt32Item, ID_VAL_BLUE, sal_False);
438 : :
439 [ # # ][ # # ]: 0 : XHatchListRef pHatchList = GetDoc()->GetHatchList ();
440 [ # # ]: 0 : long nCounts = pHatchList->Count ();
441 : 0 : Color aColor ((sal_uInt8) pRed->GetValue (),
442 : 0 : (sal_uInt8) pGreen->GetValue (),
443 : 0 : (sal_uInt8) pBlue->GetValue ());
444 : : long i;
445 : :
446 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLHATCH);
447 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
448 : :
449 [ # # ]: 0 : for ( i = 0; i < nCounts; i ++)
450 : : {
451 [ # # ]: 0 : XHatchEntry *pEntry = pHatchList->GetHatch (i);
452 : :
453 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
454 : : {
455 : 0 : XHatch &rHatch = pEntry->GetHatch ();
456 : :
457 : 0 : rHatch.SetColor (aColor);
458 : :
459 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
[ # # ]
460 [ # # ][ # # ]: 0 : pAttr->Put (XFillHatchItem (pName->GetValue (), rHatch), XATTR_FILLHATCH);
[ # # ]
461 : 0 : break;
462 : : }
463 : : }
464 : :
465 [ # # ]: 0 : if (i >= nCounts)
466 : : {
467 [ # # ]: 0 : XHatch aHatch (aColor);
468 : :
469 [ # # ][ # # ]: 0 : GetDoc()->GetHatchList ()->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
[ # # ][ # # ]
[ # # ]
470 : :
471 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
[ # # ]
472 [ # # ][ # # ]: 0 : pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH);
[ # # ]
473 : : }
474 : :
475 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_HATCH);
476 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
477 : 0 : break;
478 : : }
479 : : #ifndef DISABLE_SCRIPTING
480 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
481 : : #endif
482 : 0 : break;
483 : :
484 : : // einstellungen fuer liniendash
485 : : case SID_DASH :
486 [ # # ]: 0 : if (pArgs)
487 [ # # ]: 0 : if (pArgs->Count () == 7)
488 : : {
489 : 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
490 : 0 : SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
491 : 0 : SFX_REQUEST_ARG (rReq, pDots, SfxUInt32Item, ID_VAL_DOTS, sal_False);
492 : 0 : SFX_REQUEST_ARG (rReq, pDotLen, SfxUInt32Item, ID_VAL_DOTLEN, sal_False);
493 : 0 : SFX_REQUEST_ARG (rReq, pDashes, SfxUInt32Item, ID_VAL_DASHES, sal_False);
494 : 0 : SFX_REQUEST_ARG (rReq, pDashLen, SfxUInt32Item, ID_VAL_DASHLEN, sal_False);
495 : 0 : SFX_REQUEST_ARG (rReq, pDistance, SfxUInt32Item, ID_VAL_DISTANCE, sal_False);
496 : :
497 [ # # ][ # # ]: 0 : if (CHECK_RANGE (XDASH_RECT, (sal_Int32)pStyle->GetValue (), XDASH_ROUNDRELATIVE))
[ # # ]
498 : : {
499 : 0 : XDash aNewDash ((XDashStyle) pStyle->GetValue (), (short) pDots->GetValue (), pDotLen->GetValue (),
500 [ # # ]: 0 : (short) pDashes->GetValue (), pDashLen->GetValue (), pDistance->GetValue ());
501 : :
502 [ # # ]: 0 : pAttr->ClearItem (XATTR_LINEDASH);
503 [ # # ]: 0 : pAttr->ClearItem (XATTR_LINESTYLE);
504 : :
505 [ # # ][ # # ]: 0 : XDashListRef pDashList = GetDoc()->GetDashList();
506 [ # # ]: 0 : long nCounts = pDashList->Count ();
507 [ # # ][ # # ]: 0 : XDashEntry *pEntry = new XDashEntry (aNewDash, pName->GetValue ());
508 : : long i;
509 : :
510 [ # # ]: 0 : for ( i = 0; i < nCounts; i++ )
511 [ # # ][ # # ]: 0 : if (pDashList->GetDash (i)->GetName () == pName->GetValue ())
[ # # ]
512 : 0 : break;
513 : :
514 [ # # ]: 0 : if (i < nCounts)
515 [ # # ]: 0 : pDashList->Replace (pEntry, i);
516 : : else
517 [ # # ]: 0 : pDashList->Insert (pEntry);
518 : :
519 [ # # ][ # # ]: 0 : pAttr->Put (XLineDashItem (pName->GetValue (), aNewDash), XATTR_LINEDASH);
[ # # ]
520 [ # # ][ # # ]: 0 : pAttr->Put (XLineStyleItem (XLINE_DASH), XATTR_LINESTYLE);
[ # # ]
521 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_LINE_DASH);
522 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
523 : : }
524 : : #ifndef DISABLE_SCRIPTING
525 : 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
526 : : #endif
527 : 0 : break;
528 : : }
529 : : #ifndef DISABLE_SCRIPTING
530 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
531 : : #endif
532 : 0 : break;
533 : :
534 : : // einstellungen fuer farbverlauf
535 : : case SID_GRADIENT :
536 [ # # ]: 0 : if (pArgs)
537 [ # # ]: 0 : if (pArgs->Count () == 8)
538 : : {
539 : 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
540 : 0 : SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
541 : 0 : SFX_REQUEST_ARG (rReq, pAngle, SfxUInt32Item, ID_VAL_ANGLE, sal_False);
542 : 0 : SFX_REQUEST_ARG (rReq, pBorder, SfxUInt32Item, ID_VAL_BORDER, sal_False);
543 : 0 : SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, sal_False);
544 : 0 : SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, sal_False);
545 : 0 : SFX_REQUEST_ARG (rReq, pStart, SfxUInt32Item, ID_VAL_STARTINTENS, sal_False);
546 : 0 : SFX_REQUEST_ARG (rReq, pEnd, SfxUInt32Item, ID_VAL_ENDINTENS, sal_False);
547 : :
548 [ # # # # : 0 : if (CHECK_RANGE (XGRAD_LINEAR, (sal_Int32)pStyle->GetValue (), XGRAD_RECT) &&
# # # # #
# # # # #
# # # # #
# # # # #
# # ][ # # ]
[ # # ]
549 : 0 : CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360) &&
550 : 0 : CHECK_RANGE (0, (sal_Int32)pBorder->GetValue (), 100) &&
551 : 0 : CHECK_RANGE (0, (sal_Int32)pCenterX->GetValue (), 100) &&
552 : 0 : CHECK_RANGE (0, (sal_Int32)pCenterY->GetValue (), 100) &&
553 : 0 : CHECK_RANGE (0, (sal_Int32)pStart->GetValue (), 100) &&
554 : 0 : CHECK_RANGE (0, (sal_Int32)pEnd->GetValue (), 100))
555 : : {
556 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLGRADIENT);
557 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
558 : :
559 [ # # ][ # # ]: 0 : XGradientListRef pGradientList = GetDoc()->GetGradientList ();
560 [ # # ]: 0 : long nCounts = pGradientList->Count ();
561 : : long i;
562 : :
563 [ # # ]: 0 : for ( i = 0; i < nCounts; i++ )
564 : : {
565 [ # # ]: 0 : XGradientEntry *pEntry = pGradientList->GetGradient (i);
566 : :
567 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
568 : : {
569 : 0 : XGradient &rGradient = pEntry->GetGradient ();
570 : :
571 : 0 : rGradient.SetGradientStyle ((XGradientStyle) pStyle->GetValue ());
572 : 0 : rGradient.SetAngle (pAngle->GetValue () * 10);
573 : 0 : rGradient.SetBorder ((short) pBorder->GetValue ());
574 : 0 : rGradient.SetXOffset ((short) pCenterX->GetValue ());
575 : 0 : rGradient.SetYOffset ((short) pCenterY->GetValue ());
576 : 0 : rGradient.SetStartIntens ((short) pStart->GetValue ());
577 : 0 : rGradient.SetEndIntens ((short) pEnd->GetValue ());
578 : :
579 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
[ # # ]
580 [ # # ][ # # ]: 0 : pAttr->Put (XFillGradientItem (pName->GetValue (), rGradient), XATTR_FILLGRADIENT);
[ # # ]
581 : 0 : break;
582 : : }
583 : : }
584 : :
585 [ # # ]: 0 : if (i >= nCounts)
586 : : {
587 : 0 : Color aBlack (0, 0, 0);
588 : 0 : XGradient aGradient (aBlack, aBlack, (XGradientStyle) pStyle->GetValue (),
589 : 0 : pAngle->GetValue () * 10, (short) pCenterX->GetValue (),
590 : 0 : (short) pCenterY->GetValue (), (short) pBorder->GetValue (),
591 [ # # ]: 0 : (short) pStart->GetValue (), (short) pEnd->GetValue ());
592 : :
593 [ # # ][ # # ]: 0 : pGradientList->Insert (new XGradientEntry (aGradient, pName->GetValue ()));
[ # # ]
594 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
[ # # ]
595 [ # # ][ # # ]: 0 : pAttr->Put (XFillGradientItem (pName->GetValue (), aGradient), XATTR_FILLGRADIENT);
[ # # ]
596 : : }
597 : :
598 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
599 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
600 : : }
601 : : #ifndef DISABLE_SCRIPTING
602 : 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
603 : : #endif
604 : 0 : break;
605 : : }
606 : : #ifndef DISABLE_SCRIPTING
607 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
608 : : #endif
609 : 0 : break;
610 : :
611 : : // einstellungen fuer schraffur
612 : : case SID_HATCH :
613 [ # # ]: 0 : if (pArgs)
614 [ # # ]: 0 : if (pArgs->Count () == 4)
615 : : {
616 : 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
617 : 0 : SFX_REQUEST_ARG (rReq, pStyle, SfxUInt32Item, ID_VAL_STYLE, sal_False);
618 : 0 : SFX_REQUEST_ARG (rReq, pDistance, SfxUInt32Item, ID_VAL_DISTANCE, sal_False);
619 : 0 : SFX_REQUEST_ARG (rReq, pAngle, SfxUInt32Item, ID_VAL_ANGLE, sal_False);
620 : :
621 [ # # # # : 0 : if (CHECK_RANGE (XHATCH_SINGLE, (sal_Int32)pStyle->GetValue (), XHATCH_TRIPLE) &&
# # ][ # # ]
[ # # ]
622 : 0 : CHECK_RANGE (0, (sal_Int32)pAngle->GetValue (), 360))
623 : : {
624 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLHATCH);
625 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
626 : :
627 [ # # ][ # # ]: 0 : XHatchListRef pHatchList = GetDoc()->GetHatchList ();
628 [ # # ]: 0 : long nCounts = pHatchList->Count ();
629 : : long i;
630 : :
631 [ # # ]: 0 : for ( i = 0; i < nCounts; i++ )
632 : : {
633 [ # # ]: 0 : XHatchEntry *pEntry = pHatchList->GetHatch (i);
634 : :
635 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
636 : : {
637 : 0 : XHatch &rHatch = pEntry->GetHatch ();
638 : :
639 : 0 : rHatch.SetHatchStyle ((XHatchStyle) pStyle->GetValue ());
640 : 0 : rHatch.SetDistance (pDistance->GetValue ());
641 : 0 : rHatch.SetAngle (pAngle->GetValue () * 10);
642 : :
643 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
[ # # ]
644 [ # # ][ # # ]: 0 : pAttr->Put (XFillHatchItem (pName->GetValue (), rHatch), XATTR_FILLHATCH);
[ # # ]
645 : 0 : break;
646 : : }
647 : : }
648 : :
649 [ # # ]: 0 : if (i >= nCounts)
650 : : {
651 : 0 : Color aBlack (0, 0, 0);
652 : 0 : XHatch aHatch (aBlack, (XHatchStyle) pStyle->GetValue (), pDistance->GetValue (),
653 [ # # ]: 0 : pAngle->GetValue () * 10);
654 : :
655 [ # # ][ # # ]: 0 : pHatchList->Insert (new XHatchEntry (aHatch, pName->GetValue ()));
[ # # ]
656 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
[ # # ]
657 [ # # ][ # # ]: 0 : pAttr->Put (XFillHatchItem (pName->GetValue (), aHatch), XATTR_FILLHATCH);
[ # # ]
658 : : }
659 : :
660 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_HATCH);
661 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
662 : : }
663 : : #ifndef DISABLE_SCRIPTING
664 : 0 : else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE);
665 : : #endif
666 : 0 : break;
667 : : }
668 : : #ifndef DISABLE_SCRIPTING
669 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
670 : : #endif
671 : 0 : break;
672 : :
673 : : case SID_SELECTGRADIENT :
674 [ # # ]: 0 : if (pArgs)
675 [ # # ]: 0 : if (pArgs->Count () == 1)
676 : : {
677 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
678 : :
679 [ # # ][ # # ]: 0 : XGradientListRef pGradientList = GetDoc()->GetGradientList ();
680 [ # # ]: 0 : long nCounts = pGradientList->Count ();
681 : :
682 [ # # ]: 0 : for (long i = 0;
683 : : i < nCounts;
684 : : i ++)
685 : : {
686 [ # # ]: 0 : XGradientEntry *pEntry = pGradientList->GetGradient (i);
687 : :
688 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
689 : : {
690 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLGRADIENT);
691 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
692 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_GRADIENT), XATTR_FILLSTYLE);
[ # # ]
693 [ # # ][ # # ]: 0 : pAttr->Put (XFillGradientItem (pName->GetValue (), pEntry->GetGradient ()), XATTR_FILLGRADIENT);
[ # # ]
694 : :
695 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_GRADIENT);
696 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
697 : 0 : break;
698 : : }
699 : : }
700 : :
701 : 0 : break;
702 : : }
703 : : #ifndef DISABLE_SCRIPTING
704 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
705 : : #endif
706 : 0 : break;
707 : :
708 : : case SID_SELECTHATCH :
709 [ # # ]: 0 : if (pArgs)
710 [ # # ]: 0 : if (pArgs->Count () == 1)
711 : : {
712 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG (rReq, pName, SfxStringItem, ID_VAL_INDEX, sal_False);
713 : :
714 [ # # ][ # # ]: 0 : XHatchListRef pHatchList = GetDoc()->GetHatchList ();
715 [ # # ]: 0 : long nCounts = pHatchList->Count ();
716 : :
717 [ # # ]: 0 : for (long i = 0;
718 : : i < nCounts;
719 : : i ++)
720 : : {
721 [ # # ]: 0 : XHatchEntry *pEntry = pHatchList->GetHatch (i);
722 : :
723 [ # # ][ # # ]: 0 : if (pEntry->GetName () == pName->GetValue ())
724 : : {
725 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLHATCH);
726 [ # # ]: 0 : pAttr->ClearItem (XATTR_FILLSTYLE);
727 [ # # ][ # # ]: 0 : pAttr->Put (XFillStyleItem (XFILL_HATCH), XATTR_FILLSTYLE);
[ # # ]
728 [ # # ][ # # ]: 0 : pAttr->Put (XFillHatchItem (pName->GetValue (), pEntry->GetHatch ()), XATTR_FILLHATCH);
[ # # ]
729 : :
730 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_HATCH);
731 [ # # ]: 0 : rBindings.Invalidate (SID_ATTR_FILL_STYLE);
732 : 0 : break;
733 : : }
734 : : }
735 : :
736 : 0 : break;
737 : : }
738 : : #ifndef DISABLE_SCRIPTING
739 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
740 : : #endif
741 : 0 : break;
742 : :
743 : : case SID_UNSELECT :
744 : 0 : mpDrawView->UnmarkAll ();
745 : 0 : break;
746 : :
747 : : case SID_GETRED :
748 [ # # ]: 0 : if (pArgs)
749 [ # # ]: 0 : if (pArgs->Count () == 1)
750 : : {
751 : 0 : break;
752 : : }
753 : : #ifndef DISABLE_SCRIPTING
754 : 0 : StarBASIC::FatalError (SbERR_WRONG_ARGS);
755 : : #endif
756 : 0 : break;
757 : :
758 : : /* case SID_SETFONTFAMILYNAME :
759 : : case SID_SETFONTSTYLENAME :
760 : : case SID_SETFONTFAMILY :
761 : : case SID_SETFONTPITCH :
762 : : case SID_SETFONTCHARSET :
763 : : case SID_SETFONTPOSTURE :
764 : : case SID_SETFONTWEIGHT :
765 : : case SID_SETFONTUNDERLINE :
766 : : case SID_SETFONTCROSSEDOUT :
767 : : case SID_SETFONTSHADOWED :
768 : : case SID_SETFONTCONTOUR :
769 : : case SID_SETFONTCOLOR :
770 : : case SID_SETFONTLANGUAGE :
771 : : case SID_SETFONTWORDLINE :
772 : : case SID_SETFONTCASEMAP :
773 : : case SID_SETFONTESCAPE :
774 : : case SID_SETFONTKERNING :
775 : : break;*/
776 : :
777 : : default :
778 : : ;
779 : : }
780 : :
781 : 0 : mpDrawView->SetAttributes (*(const SfxItemSet *) pAttr);
782 : 0 : rReq.Ignore ();
783 [ # # ]: 0 : delete pAttr;
784 : : }
785 : :
786 : : /*************************************************************************
787 : : |*
788 : : |* Makros fuer die Attributeinstellungen bearbeiten
789 : : |*
790 : : \************************************************************************/
791 : :
792 : 0 : void DrawViewShell::AttrState (SfxItemSet& rSet)
793 : : {
794 [ # # ]: 0 : SfxWhichIter aIter (rSet);
795 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich ();
796 [ # # ][ # # ]: 0 : SfxItemSet aAttr( GetDoc()->GetPool() );
797 [ # # ]: 0 : mpDrawView->GetAttributes( aAttr );
798 : :
799 [ # # ]: 0 : while (nWhich)
800 : : {
801 [ # # # # : 0 : switch (nWhich)
# ]
802 : : {
803 : : case SID_GETFILLSTYLE :
804 : : {
805 [ # # ]: 0 : const XFillStyleItem &rFillStyleItem = (const XFillStyleItem &) aAttr.Get (XATTR_FILLSTYLE);
806 : :
807 [ # # ][ # # ]: 0 : rSet.Put (SfxUInt32Item (nWhich, (long) rFillStyleItem.GetValue ()));
[ # # ]
808 : 0 : break;
809 : : }
810 : :
811 : : case SID_GETLINESTYLE :
812 : : {
813 [ # # ]: 0 : const XLineStyleItem &rLineStyleItem = (const XLineStyleItem &) aAttr.Get (XATTR_LINESTYLE);
814 : :
815 [ # # ][ # # ]: 0 : rSet.Put (SfxUInt32Item (nWhich, (long) rLineStyleItem.GetValue ()));
[ # # ]
816 : 0 : break;
817 : : }
818 : :
819 : : case SID_GETLINEWIDTH :
820 : : {
821 [ # # ]: 0 : const XLineWidthItem &rLineWidthItem = (const XLineWidthItem &) aAttr.Get (XATTR_LINEWIDTH);
822 : :
823 [ # # ][ # # ]: 0 : rSet.Put (SfxUInt32Item (nWhich, (long) rLineWidthItem.GetValue ()));
[ # # ]
824 : 0 : break;
825 : : }
826 : :
827 : : case SID_GETGREEN :
828 : : case SID_GETRED :
829 : : case SID_GETBLUE :
830 : : {
831 [ # # ]: 0 : const SfxUInt32Item &rWhatKind = (const SfxUInt32Item &) rSet.Get (ID_VAL_WHATKIND);
832 : 0 : Color aColor;
833 : :
834 [ # # # # : 0 : switch (rWhatKind.GetValue ())
# ]
835 : : {
836 : : case 1 :
837 : : {
838 [ # # ]: 0 : const XLineColorItem &rLineColorItem = (const XLineColorItem &) aAttr.Get (XATTR_LINECOLOR);
839 : :
840 [ # # ]: 0 : aColor = rLineColorItem.GetColorValue ();
841 : 0 : break;
842 : : }
843 : :
844 : : case 2 :
845 : : {
846 [ # # ]: 0 : const XFillColorItem &rFillColorItem = (const XFillColorItem &) aAttr.Get (XATTR_FILLCOLOR);
847 : :
848 [ # # ]: 0 : aColor = rFillColorItem.GetColorValue ();
849 : 0 : break;
850 : : }
851 : :
852 : : case 3 :
853 : : case 4 :
854 : : {
855 [ # # ]: 0 : const XFillGradientItem &rFillGradientItem = (const XFillGradientItem &) aAttr.Get (XATTR_FILLGRADIENT);
856 [ # # ]: 0 : const XGradient &rGradient = rFillGradientItem.GetGradientValue ();
857 : :
858 : 0 : aColor = (rWhatKind.GetValue () == 3)
859 : : ? rGradient.GetStartColor ()
860 [ # # ]: 0 : : rGradient.GetEndColor ();
861 : 0 : break;
862 : : }
863 : :
864 : : case 5:
865 : : {
866 [ # # ]: 0 : const XFillHatchItem &rFillHatchItem = (const XFillHatchItem &) aAttr.Get (XATTR_FILLHATCH);
867 [ # # ]: 0 : const XHatch &rHatch = rFillHatchItem.GetHatchValue ();
868 : :
869 : 0 : aColor = rHatch.GetColor ();
870 : 0 : break;
871 : : }
872 : :
873 : : default :
874 : : ;
875 : : }
876 : :
877 : : rSet.Put (SfxUInt32Item (nWhich, (long) ((nWhich == SID_GETRED)
878 : 0 : ? aColor.GetRed ()
879 : : : (nWhich == SID_GETGREEN)
880 : 0 : ? aColor.GetGreen ()
881 [ # # ][ # # ]: 0 : : aColor.GetBlue ())));
[ # # ][ # # ]
[ # # ]
882 : : break;
883 : : }
884 : :
885 : : default :
886 : : ;
887 : : }
888 : :
889 [ # # ]: 0 : nWhich = aIter.NextWhich ();
890 [ # # ][ # # ]: 0 : }
891 : 0 : }
892 : :
893 : : } // end of namespace sd
894 : :
895 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|