1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 21 #include <osl/diagnose.h> 22 #include <tools/debug.hxx> 23 24 #include <sfx2/app.hxx> 25 #include <appdata.hxx> 26 #include <workwin.hxx> 27 #include <childwinimpl.hxx> 28 #include <sfx2/childwin.hxx> 29 #include <sfx2/module.hxx> 30 #include <sfx2/viewfrm.hxx> 31 32 RegisterChildWindow_Impl(SfxModule * pMod,std::unique_ptr<SfxChildWinFactory> pFact)33void SfxApplication::RegisterChildWindow_Impl( SfxModule *pMod, std::unique_ptr<SfxChildWinFactory> pFact ) 34 { 35 if ( pMod ) 36 { 37 pMod->RegisterChildWindow( std::move(pFact) ); 38 return; 39 } 40 41 if (!pImpl->pFactArr) 42 pImpl->pFactArr.reset(new SfxChildWinFactArr_Impl); 43 44 for (size_t nFactory=0; nFactory<pImpl->pFactArr->size(); ++nFactory) 45 { 46 if (pFact->nId == (*pImpl->pFactArr)[nFactory].nId) 47 { 48 pImpl->pFactArr->erase( pImpl->pFactArr->begin() + nFactory ); 49 } 50 } 51 52 pImpl->pFactArr->push_back( std::move(pFact) ); 53 } 54 GetChildWinFactories_Impl() const55SfxChildWinFactArr_Impl& SfxApplication::GetChildWinFactories_Impl() const 56 { 57 return ( *(pImpl->pFactArr)); 58 } 59 GetWorkWindow_Impl(const SfxViewFrame * pFrame) const60SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) const 61 { 62 if ( pFrame ) 63 return pFrame->GetFrame().GetWorkWindow_Impl(); 64 else if ( pImpl->pViewFrame ) 65 return pImpl->pViewFrame->GetFrame().GetWorkWindow_Impl(); 66 else 67 return nullptr; 68 } 69 70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 71