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_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <svx/svdoedge.hxx> 34*cdf0e10cSrcweir #include <svx/svdattrx.hxx> 35*cdf0e10cSrcweir #include <svx/svdmark.hxx> 36*cdf0e10cSrcweir #include <svx/svdview.hxx> 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <svx/svdpage.hxx> // SdrObjList 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include "svx/connctrl.hxx" 41*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 42*cdf0e10cSrcweir #include "svx/dlgutil.hxx" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir // #110094# 45*cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir // #110094# 48*cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 49*cdf0e10cSrcweir #include <vcl/svapp.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir /************************************************************************* 52*cdf0e10cSrcweir |* 53*cdf0e10cSrcweir |* Ctor SvxXConnectionPreview 54*cdf0e10cSrcweir |* 55*cdf0e10cSrcweir *************************************************************************/ 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir SvxXConnectionPreview::SvxXConnectionPreview( Window* pParent, const ResId& rResId, 58*cdf0e10cSrcweir const SfxItemSet& rInAttrs ) : 59*cdf0e10cSrcweir Control ( pParent, rResId ), 60*cdf0e10cSrcweir rAttrs ( rInAttrs ), 61*cdf0e10cSrcweir pEdgeObj( NULL ), 62*cdf0e10cSrcweir pObjList( NULL ), 63*cdf0e10cSrcweir pView ( NULL ) 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir SetMapMode( MAP_100TH_MM ); 66*cdf0e10cSrcweir SetStyles(); 67*cdf0e10cSrcweir } 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir /************************************************************************* 70*cdf0e10cSrcweir |* 71*cdf0e10cSrcweir |* Dtor SvxXConnectionPreview 72*cdf0e10cSrcweir |* 73*cdf0e10cSrcweir *************************************************************************/ 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir SvxXConnectionPreview::~SvxXConnectionPreview() 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir delete pObjList; 78*cdf0e10cSrcweir } 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir /************************************************************************* 81*cdf0e10cSrcweir |* 82*cdf0e10cSrcweir |* Dtor SvxXConnectionPreview 83*cdf0e10cSrcweir |* 84*cdf0e10cSrcweir *************************************************************************/ 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir void SvxXConnectionPreview::Construct() 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" ); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 91*cdf0e10cSrcweir sal_uIntPtr nMarkCount = rMarkList.GetMarkCount(); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir if( nMarkCount >= 1 ) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir sal_Bool bFound = sal_False; 96*cdf0e10cSrcweir const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nMarkCount && !bFound; i++ ) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir pObj = rMarkList.GetMark( i )->GetMarkedSdrObj(); 102*cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor(); 103*cdf0e10cSrcweir sal_uInt16 nId = pObj->GetObjIdentifier(); 104*cdf0e10cSrcweir if( nInv == SdrInventor && nId == OBJ_EDGE ) 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir bFound = sal_True; 107*cdf0e10cSrcweir SdrEdgeObj* pTmpEdgeObj = (SdrEdgeObj*) pObj; 108*cdf0e10cSrcweir pEdgeObj = (SdrEdgeObj*) pTmpEdgeObj->Clone(); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_True ); 111*cdf0e10cSrcweir SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( sal_False ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir rConn1 = pTmpEdgeObj->GetConnection( sal_True ); 114*cdf0e10cSrcweir rConn2 = pTmpEdgeObj->GetConnection( sal_False ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir SdrObject* pTmpObj1 = pTmpEdgeObj->GetConnectedNode( sal_True ); 117*cdf0e10cSrcweir SdrObject* pTmpObj2 = pTmpEdgeObj->GetConnectedNode( sal_False ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir // #110094# 120*cdf0e10cSrcweir // potential memory leak here (!). Create SdrObjList only when there is 121*cdf0e10cSrcweir // not yet one. 122*cdf0e10cSrcweir if(!pObjList) 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir pObjList = new SdrObjList( pView->GetModel(), NULL ); 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir if( pTmpObj1 ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir SdrObject* pObj1 = pTmpObj1->Clone(); 130*cdf0e10cSrcweir pObjList->InsertObject( pObj1 ); 131*cdf0e10cSrcweir pEdgeObj->ConnectToNode( sal_True, pObj1 ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir if( pTmpObj2 ) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir SdrObject* pObj2 = pTmpObj2->Clone(); 136*cdf0e10cSrcweir pObjList->InsertObject( pObj2 ); 137*cdf0e10cSrcweir pEdgeObj->ConnectToNode( sal_False, pObj2 ); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir pObjList->InsertObject( pEdgeObj ); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir if( !pEdgeObj ) 145*cdf0e10cSrcweir pEdgeObj = new SdrEdgeObj(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // Groesse anpassen 148*cdf0e10cSrcweir if( pObjList ) 149*cdf0e10cSrcweir { 150*cdf0e10cSrcweir OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 ); 151*cdf0e10cSrcweir Rectangle aRect = pObjList->GetAllObjBoundRect(); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir MapMode aMapMode = GetMapMode(); 154*cdf0e10cSrcweir aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() ); 155*cdf0e10cSrcweir SetMapMode( aMapMode ); 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir MapMode aDisplayMap( aMapMode ); 158*cdf0e10cSrcweir Point aNewPos; 159*cdf0e10cSrcweir Size aNewSize; 160*cdf0e10cSrcweir const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap ); 161*cdf0e10cSrcweir const long nWidth = aWinSize.Width(); 162*cdf0e10cSrcweir const long nHeight = aWinSize.Height(); 163*cdf0e10cSrcweir double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight(); 164*cdf0e10cSrcweir double fWinWH = (double) nWidth / nHeight; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // Bitmap an Thumbgroesse anpassen (hier nicht!) 167*cdf0e10cSrcweir if ( fRectWH < fWinWH) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir aNewSize.Width() = (long) ( (double) nHeight * fRectWH ); 170*cdf0e10cSrcweir aNewSize.Height()= nHeight; 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir else 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir aNewSize.Width() = nWidth; 175*cdf0e10cSrcweir aNewSize.Height()= (long) ( (double) nWidth / fRectWH ); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() ); 179*cdf0e10cSrcweir Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() ); 180*cdf0e10cSrcweir Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // MapMode umsetzen 183*cdf0e10cSrcweir aDisplayMap.SetScaleX( aMinFrac ); 184*cdf0e10cSrcweir aDisplayMap.SetScaleY( aMinFrac ); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir // Zentrierung 187*cdf0e10cSrcweir aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1; 188*cdf0e10cSrcweir aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) ); 191*cdf0e10cSrcweir SetMapMode( aDisplayMap ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // Ursprung 194*cdf0e10cSrcweir aNewPos = aDisplayMap.GetOrigin(); 195*cdf0e10cSrcweir aNewPos -= Point( aRect.TopLeft().X(), aRect.TopLeft().Y() ); 196*cdf0e10cSrcweir aDisplayMap.SetOrigin( aNewPos ); 197*cdf0e10cSrcweir SetMapMode( aDisplayMap ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir Point aPos; 201*cdf0e10cSrcweir MouseEvent aMEvt( aPos, 1, 0, MOUSE_RIGHT ); 202*cdf0e10cSrcweir MouseButtonDown( aMEvt ); 203*cdf0e10cSrcweir /* 204*cdf0e10cSrcweir Point aPt( -aRect.TopLeft().X(), -aRect.TopLeft().Y() ); 205*cdf0e10cSrcweir aMapMode.SetOrigin( aPt ); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir // Skalierung 208*cdf0e10cSrcweir Size aSize = GetOutputSize(); 209*cdf0e10cSrcweir Fraction aFrac1( aSize.Width(), aRect.GetWidth() ); 210*cdf0e10cSrcweir Fraction aFrac2( aSize.Height(), aRect.GetHeight() ); 211*cdf0e10cSrcweir Fraction aMaxFrac( aFrac1 > aFrac2 ? aFrac1 : aFrac2 ); 212*cdf0e10cSrcweir Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 ); 213*cdf0e10cSrcweir sal_Bool bChange = (sal_Bool) ( (double)aMinFrac > 1.0 ); 214*cdf0e10cSrcweir aMapMode.SetScaleX( aMinFrac ); 215*cdf0e10cSrcweir aMapMode.SetScaleY( aMinFrac ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir // zentrieren 218*cdf0e10cSrcweir long nXXL = aSize.Width() > aRect.GetWidth() ? aSize.Width() : aRect.GetWidth(); 219*cdf0e10cSrcweir long nXS = aSize.Width() <= aRect.GetWidth() ? aSize.Width() : aRect.GetWidth(); 220*cdf0e10cSrcweir if( bChange ) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir long nTmp = nXXL; nXXL = nXS; nXS = nTmp; 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir long nX = (long) ( (double)aMinFrac * (double)nXXL ); 225*cdf0e10cSrcweir nX = (long) ( (double)labs( nXS - nX ) / (double)aMinFrac / 2.0 ); 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir long nYXL = aSize.Height() > aRect.GetHeight() ? aSize.Height() : aRect.GetHeight(); 228*cdf0e10cSrcweir long nYS = aSize.Height() <= aRect.GetHeight() ? aSize.Height() : aRect.GetHeight(); 229*cdf0e10cSrcweir if( bChange ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir long nTmp = nXXL; nXXL = nXS; nXS = nTmp; 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir long nY = (long) ( (double)aMinFrac * (double)nYXL ); 234*cdf0e10cSrcweir nY = (long) ( (double)labs( nYS - nY ) / (double)aMinFrac / 2.0 ); 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir aPt += Point( nX, nY ); 237*cdf0e10cSrcweir aMapMode.SetOrigin( aPt ); 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir SetMapMode( aMapMode ); 240*cdf0e10cSrcweir */ 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir /************************************************************************* 245*cdf0e10cSrcweir |* 246*cdf0e10cSrcweir |* SvxXConnectionPreview: Paint() 247*cdf0e10cSrcweir |* 248*cdf0e10cSrcweir *************************************************************************/ 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir void SvxXConnectionPreview::Paint( const Rectangle& ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir if( pObjList ) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir // #110094# 255*cdf0e10cSrcweir // This will not work anymore. To not start at Adam and Eve, i will 256*cdf0e10cSrcweir // ATM not try to change all this stuff to really using an own model 257*cdf0e10cSrcweir // and a view. I will just try to provide a mechanism to paint such 258*cdf0e10cSrcweir // objects without own model and without a page/view with the new 259*cdf0e10cSrcweir // mechanism. 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // New stuff: Use a ObjectContactOfObjListPainter. 262*cdf0e10cSrcweir sdr::contact::SdrObjectVector aObjectVector; 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < pObjList->GetObjCount(); a++) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir SdrObject* pObject = pObjList->GetObj(a); 267*cdf0e10cSrcweir DBG_ASSERT(pObject, 268*cdf0e10cSrcweir "SvxXConnectionPreview::Paint: Corrupt ObjectList (!)"); 269*cdf0e10cSrcweir aObjectVector.push_back(pObject); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); 273*cdf0e10cSrcweir sdr::contact::DisplayInfo aDisplayInfo; 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir // do processing 276*cdf0e10cSrcweir aPainter.ProcessDisplay(aDisplayInfo); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir /************************************************************************* 281*cdf0e10cSrcweir |* 282*cdf0e10cSrcweir |* SvxXConnectionPreview: SetAttributes() 283*cdf0e10cSrcweir |* 284*cdf0e10cSrcweir *************************************************************************/ 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir void SvxXConnectionPreview::SetAttributes( const SfxItemSet& rInAttrs ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir //pEdgeObj->SetItemSetAndBroadcast(rInAttrs); 289*cdf0e10cSrcweir pEdgeObj->SetMergedItemSetAndBroadcast(rInAttrs); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir Invalidate(); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir /************************************************************************* 295*cdf0e10cSrcweir |* 296*cdf0e10cSrcweir |* Ermittelt die Anzahl der Linienversaetze anhand des Preview-Objektes 297*cdf0e10cSrcweir |* 298*cdf0e10cSrcweir *************************************************************************/ 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir sal_uInt16 SvxXConnectionPreview::GetLineDeltaAnz() 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir const SfxItemSet& rSet = pEdgeObj->GetMergedItemSet(); 303*cdf0e10cSrcweir sal_uInt16 nCount(0); 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir if(SFX_ITEM_DONTCARE != rSet.GetItemState(SDRATTR_EDGELINEDELTAANZ)) 306*cdf0e10cSrcweir nCount = ((const SdrEdgeLineDeltaAnzItem&)rSet.Get(SDRATTR_EDGELINEDELTAANZ)).GetValue(); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir return nCount; 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir /************************************************************************* 312*cdf0e10cSrcweir |* 313*cdf0e10cSrcweir |* SvxXConnectionPreview: MouseButtonDown() 314*cdf0e10cSrcweir |* 315*cdf0e10cSrcweir *************************************************************************/ 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir sal_Bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift(); 320*cdf0e10cSrcweir sal_Bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift(); 321*cdf0e10cSrcweir sal_Bool bCtrl = rMEvt.IsMod1(); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir if( bZoomIn || bZoomOut ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir MapMode aMapMode = GetMapMode(); 326*cdf0e10cSrcweir Fraction aXFrac = aMapMode.GetScaleX(); 327*cdf0e10cSrcweir Fraction aYFrac = aMapMode.GetScaleY(); 328*cdf0e10cSrcweir Fraction* pMultFrac; 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir if( bZoomIn ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir if( bCtrl ) 333*cdf0e10cSrcweir pMultFrac = new Fraction( 3, 2 ); 334*cdf0e10cSrcweir else 335*cdf0e10cSrcweir pMultFrac = new Fraction( 11, 10 ); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir else 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir if( bCtrl ) 340*cdf0e10cSrcweir pMultFrac = new Fraction( 2, 3 ); 341*cdf0e10cSrcweir else 342*cdf0e10cSrcweir pMultFrac = new Fraction( 10, 11 ); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir aXFrac *= *pMultFrac; 346*cdf0e10cSrcweir aYFrac *= *pMultFrac; 347*cdf0e10cSrcweir if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 && 348*cdf0e10cSrcweir (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir aMapMode.SetScaleX( aXFrac ); 351*cdf0e10cSrcweir aMapMode.SetScaleY( aYFrac ); 352*cdf0e10cSrcweir SetMapMode( aMapMode ); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir Size aOutSize( GetOutputSize() ); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir Point aPt( aMapMode.GetOrigin() ); 357*cdf0e10cSrcweir long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); 358*cdf0e10cSrcweir long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); 359*cdf0e10cSrcweir aPt.X() += nX; 360*cdf0e10cSrcweir aPt.Y() += nY; 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir aMapMode.SetOrigin( aPt ); 363*cdf0e10cSrcweir SetMapMode( aMapMode ); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir Invalidate(); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir delete pMultFrac; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir void SvxXConnectionPreview::SetStyles() 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); 374*cdf0e10cSrcweir SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); 375*cdf0e10cSrcweir SetBackground( Wallpaper( Color( rStyles.GetFieldColor() ) ) ); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir void SvxXConnectionPreview::DataChanged( const DataChangedEvent& rDCEvt ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir Control::DataChanged( rDCEvt ); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir SetStyles(); 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388