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
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_desktop.hxx"
26 
27 #include "sal/config.h"
28 
29 #include <algorithm>
30 #include <vector>
31 
32 #include "rtl/ustring.hxx"
33 #include "tools/gen.hxx"
34 #include "tools/resid.hxx"
35 #include "tools/resmgr.hxx"
36 #include "tools/solar.h"
37 #include "tools/string.hxx"
38 #include "vcl/dialog.hxx"
39 
40 #include "dp_gui.hrc"
41 #include "dp_gui_dependencydialog.hxx"
42 #include "dp_gui_shared.hxx"
43 
44 class Window;
45 
46 using dp_gui::DependencyDialog;
47 
DependencyDialog(Window * parent,std::vector<rtl::OUString> const & dependencies)48 DependencyDialog::DependencyDialog(
49     Window * parent, std::vector< rtl::OUString > const & dependencies):
50     ModalDialog(parent, DpGuiResId(RID_DLG_DEPENDENCIES) ),
51     m_text(this, DpGuiResId(RID_DLG_DEPENDENCIES_TEXT)),
52     m_list(this, DpGuiResId(RID_DLG_DEPENDENCIES_LIST)),
53     m_ok(this, DpGuiResId(RID_DLG_DEPENDENCIES_OK)),
54     m_listDelta(
55         GetOutputSizePixel().Width() - m_list.GetSizePixel().Width(),
56         GetOutputSizePixel().Height() - m_list.GetSizePixel().Height())
57 {
58     FreeResource();
59     SetMinOutputSizePixel(GetOutputSizePixel());
60     m_list.SetReadOnly();
61     for (std::vector< rtl::OUString >::const_iterator i(dependencies.begin());
62          i != dependencies.end(); ++i)
63     {
64         m_list.InsertEntry(*i);
65     }
66 }
67 
~DependencyDialog()68 DependencyDialog::~DependencyDialog() {}
69 
Resize()70 void DependencyDialog::Resize() {
71     long n = m_ok.GetPosPixel().Y() -
72         (m_list.GetPosPixel().Y() + m_list.GetSizePixel().Height());
73     m_list.SetSizePixel(
74         Size(
75             GetOutputSizePixel().Width() - m_listDelta.Width(),
76             GetOutputSizePixel().Height() - m_listDelta.Height()));
77     m_ok.SetPosPixel(
78         Point(
79             (m_list.GetPosPixel().X() +
80              (m_list.GetSizePixel().Width() - m_ok.GetSizePixel().Width()) / 2),
81             m_list.GetPosPixel().Y() + m_list.GetSizePixel().Height() + n));
82 }
83