linkmgr2.cxx (cf914f84) | linkmgr2.cxx (611fcdab) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 51 unchanged lines hidden (view full) --- 60 61 virtual sal_Bool Connect( sfx2::SvBaseLink* ); 62}; 63 64 65SV_IMPL_PTRARR( SvBaseLinks, SvBaseLinkRefPtr ) 66 67LinkManager::LinkManager(SfxObjectShell* p) | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 51 unchanged lines hidden (view full) --- 60 61 virtual sal_Bool Connect( sfx2::SvBaseLink* ); 62}; 63 64 65SV_IMPL_PTRARR( SvBaseLinks, SvBaseLinkRefPtr ) 66 67LinkManager::LinkManager(SfxObjectShell* p) |
68 : pPersist( p ) | 68 : pPersist(p), 69 mUpdateAsked(sal_False), 70 mAutoAskUpdateAllLinks(sal_False) |
69{ 70} 71 | 71{ 72} 73 |
72 | |
73LinkManager::~LinkManager() 74{ 75 SvBaseLinkRef** ppRef = (SvBaseLinkRef**)aLinkTbl.GetData(); 76 for( sal_uInt16 n = aLinkTbl.Count(); n; --n, ++ppRef ) 77 { 78 if( (*ppRef)->Is() ) 79 { 80 (*(*ppRef))->Disconnect(); --- 71 unchanged lines hidden (view full) --- 152 153 if( pLink == *pTmp ) 154 return sal_False; 155 } 156 157 SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink ); 158 pLink->SetLinkManager( this ); 159 aLinkTbl.Insert( pTmp, aLinkTbl.Count() ); | 74LinkManager::~LinkManager() 75{ 76 SvBaseLinkRef** ppRef = (SvBaseLinkRef**)aLinkTbl.GetData(); 77 for( sal_uInt16 n = aLinkTbl.Count(); n; --n, ++ppRef ) 78 { 79 if( (*ppRef)->Is() ) 80 { 81 (*(*ppRef))->Disconnect(); --- 71 unchanged lines hidden (view full) --- 153 154 if( pLink == *pTmp ) 155 return sal_False; 156 } 157 158 SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink ); 159 pLink->SetLinkManager( this ); 160 aLinkTbl.Insert( pTmp, aLinkTbl.Count() ); |
161 Window *parent = GetPersist()->GetDialogParent(); 162 if (mAutoAskUpdateAllLinks) 163 { 164 SetUserAllowsLinkUpdate(pLink, GetUserAllowsLinkUpdate(parent)); 165 } 166 |
|
160 return sal_True; 161} 162 163 164sal_Bool LinkManager::InsertLink( SvBaseLink * pLink, 165 sal_uInt16 nObjType, 166 sal_uInt16 nUpdateMode, 167 const String* pName ) --- 95 unchanged lines hidden (view full) --- 263 default: 264 break; 265 } 266 } 267 268 return bRet; 269} 270 | 167 return sal_True; 168} 169 170 171sal_Bool LinkManager::InsertLink( SvBaseLink * pLink, 172 sal_uInt16 nObjType, 173 sal_uInt16 nUpdateMode, 174 const String* pName ) --- 95 unchanged lines hidden (view full) --- 270 default: 271 break; 272 } 273 } 274 275 return bRet; 276} 277 |
278void LinkManager::SetAutoAskUpdateAllLinks() 279{ 280 mAutoAskUpdateAllLinks = sal_True; 281} |
|
271 | 282 |
283sal_Bool LinkManager::GetUserAllowsLinkUpdate(Window *pParentWin) 284{ 285 if (!mUpdateAsked) 286 { 287 if (QueryBox(pParentWin, WB_YES_NO | WB_DEF_NO, SfxResId(STR_QUERY_UPDATE_LINKS)).Execute() == RET_YES) 288 mAllowUpdate = sal_True; 289 else 290 mAllowUpdate = sal_False; 291 mUpdateAsked = sal_True; 292 } 293 return mAllowUpdate; 294} 295 296void LinkManager::SetUserAllowsLinkUpdate(SvBaseLink *pLink, sal_Bool allows) 297{ 298 SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); 299 300 if (pShell) 301 { 302 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer(); 303 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(allows); 304 } 305} 306 307 |
|
272void LinkManager::UpdateAllLinks( 273 sal_Bool bAskUpdate, 274 sal_Bool /*bCallErrHdl*/, 275 sal_Bool bUpdateGrfLinks, 276 Window* pParentWin ) 277{ 278 SvStringsDtor aApps, aTopics, aItems; 279 String sApp, sTopic, sItem; --- 28 unchanged lines hidden (view full) --- 308 309 if( USHRT_MAX == nFndPos ) 310 continue; // war noch nicht vorhanden! 311 312 // do not update graphic links yet 313 if( !pLink->IsVisible() || 314 ( !bUpdateGrfLinks && OBJECT_CLIENT_GRF == pLink->GetObjType() )) 315 continue; | 308void LinkManager::UpdateAllLinks( 309 sal_Bool bAskUpdate, 310 sal_Bool /*bCallErrHdl*/, 311 sal_Bool bUpdateGrfLinks, 312 Window* pParentWin ) 313{ 314 SvStringsDtor aApps, aTopics, aItems; 315 String sApp, sTopic, sItem; --- 28 unchanged lines hidden (view full) --- 344 345 if( USHRT_MAX == nFndPos ) 346 continue; // war noch nicht vorhanden! 347 348 // do not update graphic links yet 349 if( !pLink->IsVisible() || 350 ( !bUpdateGrfLinks && OBJECT_CLIENT_GRF == pLink->GetObjType() )) 351 continue; |
316 317 if( bAskUpdate ) | 352 353 sal_Bool allows = sal_False; 354 355 if (bAskUpdate) |
318 { | 356 { |
319 int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_NO, SfxResId( STR_QUERY_UPDATE_LINKS ) ).Execute(); 320 SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); | 357 allows = GetUserAllowsLinkUpdate(pParentWin); 358 } |
321 | 359 |
322 if(pShell) 323 { 324 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = pShell->getEmbeddedObjectContainer(); 325 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(RET_YES == nRet); 326 } | 360 SetUserAllowsLinkUpdate(pLink, allows); 361 bAskUpdate = sal_False; // one time is OK |
327 | 362 |
328 if (RET_YES != nRet) 329 { 330 return; // nothing should be updated 331 } 332 bAskUpdate = sal_False; // one time is OK 333 } | 363 if (allows) 364 pLink->Update(); |
334 | 365 |
335 pLink->Update(); | |
336 } 337} 338 339/************************************************************************ 340|* SvBaseLink::CreateObject() 341|* 342|* Beschreibung 343*************************************************************************/ --- 298 unchanged lines hidden --- | 366 } 367} 368 369/************************************************************************ 370|* SvBaseLink::CreateObject() 371|* 372|* Beschreibung 373*************************************************************************/ --- 298 unchanged lines hidden --- |