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