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