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