1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_desktop.hxx" 30 31 #include "sal/config.h" 32 33 #include <algorithm> 34 #include <vector> 35 36 #include "rtl/ustring.hxx" 37 #include "tools/gen.hxx" 38 #include "tools/resid.hxx" 39 #include "tools/resmgr.hxx" 40 #include "tools/solar.h" 41 #include "tools/string.hxx" 42 #include "vcl/dialog.hxx" 43 44 #include "dp_gui.hrc" 45 #include "dp_gui_dependencydialog.hxx" 46 #include "dp_gui_shared.hxx" 47 48 class Window; 49 50 using dp_gui::DependencyDialog; 51 52 DependencyDialog::DependencyDialog( 53 Window * parent, std::vector< rtl::OUString > const & dependencies): 54 ModalDialog(parent, DpGuiResId(RID_DLG_DEPENDENCIES) ), 55 m_text(this, DpGuiResId(RID_DLG_DEPENDENCIES_TEXT)), 56 m_list(this, DpGuiResId(RID_DLG_DEPENDENCIES_LIST)), 57 m_ok(this, DpGuiResId(RID_DLG_DEPENDENCIES_OK)), 58 m_listDelta( 59 GetOutputSizePixel().Width() - m_list.GetSizePixel().Width(), 60 GetOutputSizePixel().Height() - m_list.GetSizePixel().Height()) 61 { 62 FreeResource(); 63 SetMinOutputSizePixel(GetOutputSizePixel()); 64 m_list.SetReadOnly(); 65 for (std::vector< rtl::OUString >::const_iterator i(dependencies.begin()); 66 i != dependencies.end(); ++i) 67 { 68 m_list.InsertEntry(*i); 69 } 70 } 71 72 DependencyDialog::~DependencyDialog() {} 73 74 void DependencyDialog::Resize() { 75 long n = m_ok.GetPosPixel().Y() - 76 (m_list.GetPosPixel().Y() + m_list.GetSizePixel().Height()); 77 m_list.SetSizePixel( 78 Size( 79 GetOutputSizePixel().Width() - m_listDelta.Width(), 80 GetOutputSizePixel().Height() - m_listDelta.Height())); 81 m_ok.SetPosPixel( 82 Point( 83 (m_list.GetPosPixel().X() + 84 (m_list.GetSizePixel().Width() - m_ok.GetSizePixel().Width()) / 2), 85 m_list.GetPosPixel().Y() + m_list.GetSizePixel().Height() + n)); 86 } 87