1b557fc96SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3b557fc96SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4b557fc96SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5b557fc96SAndrew Rist  * distributed with this work for additional information
6b557fc96SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7b557fc96SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8b557fc96SAndrew Rist  * "License"); you may not use this file except in compliance
9b557fc96SAndrew Rist  * with the License.  You may obtain a copy of the License at
10b557fc96SAndrew Rist  *
11b557fc96SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12b557fc96SAndrew Rist  *
13b557fc96SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14b557fc96SAndrew Rist  * software distributed under the License is distributed on an
15b557fc96SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16b557fc96SAndrew Rist  * KIND, either express or implied.  See the License for the
17b557fc96SAndrew Rist  * specific language governing permissions and limitations
18b557fc96SAndrew Rist  * under the License.
19b557fc96SAndrew Rist  *
20b557fc96SAndrew Rist  *************************************************************/
21b557fc96SAndrew Rist 
22b557fc96SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_fpicker.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _DIALOGCUSTOMCONTROLS_CXX_
28cdf0e10cSrcweir #include "dialogcustomcontrols.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <osl/diagnose.h>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir //-----------------------------------
33cdf0e10cSrcweir //
34cdf0e10cSrcweir //-----------------------------------
35cdf0e10cSrcweir 
CDialogCustomControlBase(HWND aControlHandle,HWND aParentHandle)36cdf0e10cSrcweir CDialogCustomControlBase::CDialogCustomControlBase(HWND aControlHandle, HWND aParentHandle) :
37cdf0e10cSrcweir 	m_CustomControlHandle(aControlHandle),
38cdf0e10cSrcweir 	m_ParentHandle(aParentHandle)
39cdf0e10cSrcweir {
40cdf0e10cSrcweir }
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //-----------------------------------
43cdf0e10cSrcweir //
44cdf0e10cSrcweir //-----------------------------------
45cdf0e10cSrcweir 
SetFont(HFONT hFont)46cdf0e10cSrcweir void SAL_CALL CDialogCustomControlBase::SetFont(HFONT hFont)
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	SendMessage(
49cdf0e10cSrcweir 		m_CustomControlHandle,
50cdf0e10cSrcweir 		WM_SETFONT,
51cdf0e10cSrcweir 		(WPARAM)hFont,
52cdf0e10cSrcweir 		(LPARAM)sal_True);
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir //-----------------------------------
56cdf0e10cSrcweir //
57cdf0e10cSrcweir //-----------------------------------
58cdf0e10cSrcweir 
AlignToBuddy(HWND aBuddyHandle)59cdf0e10cSrcweir void SAL_CALL CDialogCustomControlBase::AlignToBuddy(HWND aBuddyHandle)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	OSL_PRECOND(IsWindow(aBuddyHandle),"Invalid buddy window handle");
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	RECT rcBuddy;
64cdf0e10cSrcweir 	GetWindowRect(aBuddyHandle,&rcBuddy);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	POINT pt = {rcBuddy.left,rcBuddy.top};
67cdf0e10cSrcweir 	ScreenToClient(m_ParentHandle,&pt);
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	int cx_new = rcBuddy.right - rcBuddy.left;
70cdf0e10cSrcweir 	int cy_new = rcBuddy.bottom - rcBuddy.top;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	// keep the vertical position because
73*07a3d7f1SPedro Giffuni 	// the Windows dialog controller does
74cdf0e10cSrcweir 	// this job
75cdf0e10cSrcweir 	RECT rcMe;
76cdf0e10cSrcweir 	GetWindowRect(m_CustomControlHandle,&rcMe);
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	POINT ptMe = {rcMe.left,rcMe.top};
79cdf0e10cSrcweir 	ScreenToClient(m_ParentHandle,&ptMe);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	SetWindowPos(
82cdf0e10cSrcweir 		m_CustomControlHandle,
83cdf0e10cSrcweir 		HWND_TOP,
84cdf0e10cSrcweir 		pt.x,
85cdf0e10cSrcweir 		ptMe.y,
86cdf0e10cSrcweir 		cx_new,
87cdf0e10cSrcweir 		cy_new,
88cdf0e10cSrcweir 		SWP_NOACTIVATE);
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir //-----------------------------------
92cdf0e10cSrcweir //
93cdf0e10cSrcweir //-----------------------------------
94cdf0e10cSrcweir 
CDummyCustomControl(HWND,HWND)95cdf0e10cSrcweir CDummyCustomControl::CDummyCustomControl(HWND, HWND)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir //-----------------------------------
100cdf0e10cSrcweir //
101cdf0e10cSrcweir //-----------------------------------
102cdf0e10cSrcweir 
Align()103cdf0e10cSrcweir void SAL_CALL CDummyCustomControl::Align()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	// do nothing
106cdf0e10cSrcweir }
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //-----------------------------------
109cdf0e10cSrcweir //
110cdf0e10cSrcweir //-----------------------------------
111cdf0e10cSrcweir 
SetFont(HFONT)112cdf0e10cSrcweir void SAL_CALL CDummyCustomControl::SetFont(HFONT)
113cdf0e10cSrcweir {
114cdf0e10cSrcweir 	// do nothing
115cdf0e10cSrcweir }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir //-----------------------------------
118cdf0e10cSrcweir //
119cdf0e10cSrcweir //-----------------------------------
120cdf0e10cSrcweir 
CStaticCustomControl(HWND aControlHandle,HWND aParentHandle)121cdf0e10cSrcweir CStaticCustomControl::CStaticCustomControl(HWND aControlHandle, HWND aParentHandle) :
122cdf0e10cSrcweir 	CDialogCustomControlBase(aControlHandle,aParentHandle)
123cdf0e10cSrcweir {
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir //-----------------------------------
127cdf0e10cSrcweir // Align to the "File name" static
128cdf0e10cSrcweir // text of the standard FileOpen dlg
129cdf0e10cSrcweir //-----------------------------------
130cdf0e10cSrcweir 
Align()131cdf0e10cSrcweir void SAL_CALL CStaticCustomControl::Align()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	AlignToBuddy(GetDlgItem(m_ParentHandle,stc3));
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir //-----------------------------------
137cdf0e10cSrcweir //
138cdf0e10cSrcweir //-----------------------------------
139cdf0e10cSrcweir 
CPushButtonCustomControl(HWND aControlHandle,HWND aParentHandle)140cdf0e10cSrcweir CPushButtonCustomControl::CPushButtonCustomControl(HWND aControlHandle, HWND aParentHandle) :
141cdf0e10cSrcweir 	CDialogCustomControlBase(aControlHandle,aParentHandle)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir //-----------------------------------
146cdf0e10cSrcweir // Align to the "OK" button of the
147cdf0e10cSrcweir // standard FileOpen dlg
148cdf0e10cSrcweir //-----------------------------------
149cdf0e10cSrcweir 
Align()150cdf0e10cSrcweir void SAL_CALL CPushButtonCustomControl::Align()
151cdf0e10cSrcweir {
152cdf0e10cSrcweir 	AlignToBuddy(GetDlgItem(m_ParentHandle,IDCANCEL));
153cdf0e10cSrcweir }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir //-----------------------------------
156cdf0e10cSrcweir //
157cdf0e10cSrcweir //-----------------------------------
158cdf0e10cSrcweir 
CComboboxCustomControl(HWND aControlHandle,HWND aParentHandle)159cdf0e10cSrcweir CComboboxCustomControl::CComboboxCustomControl(HWND aControlHandle, HWND aParentHandle) :
160cdf0e10cSrcweir 	CDialogCustomControlBase(aControlHandle,aParentHandle)
161cdf0e10cSrcweir {
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir //-----------------------------------
165cdf0e10cSrcweir // Align to the "File name" combobox
166cdf0e10cSrcweir // of the standard FileOpen dlg
167cdf0e10cSrcweir //-----------------------------------
168cdf0e10cSrcweir 
Align()169cdf0e10cSrcweir void SAL_CALL CComboboxCustomControl::Align()
170cdf0e10cSrcweir {
171cdf0e10cSrcweir 	AlignToBuddy(GetDlgItem(m_ParentHandle,cmb1));
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir //-----------------------------------
175cdf0e10cSrcweir //
176cdf0e10cSrcweir //-----------------------------------
177cdf0e10cSrcweir 
CCheckboxCustomControl(HWND aControlHandle,HWND aParentHandle)178cdf0e10cSrcweir CCheckboxCustomControl::CCheckboxCustomControl(HWND aControlHandle, HWND aParentHandle) :
179cdf0e10cSrcweir 	CDialogCustomControlBase(aControlHandle,aParentHandle)
180cdf0e10cSrcweir {
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
183cdf0e10cSrcweir //-----------------------------------
184cdf0e10cSrcweir // Align to the "File name" combobox
185cdf0e10cSrcweir // of the standard FileOpen dlg
186cdf0e10cSrcweir //-----------------------------------
187cdf0e10cSrcweir 
Align()188cdf0e10cSrcweir void SAL_CALL CCheckboxCustomControl::Align()
189cdf0e10cSrcweir {
190cdf0e10cSrcweir 	AlignToBuddy(GetDlgItem(m_ParentHandle,cmb1));
191cdf0e10cSrcweir }
192