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