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