1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dialogcustomcontrols.cxx,v $
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_fpicker.hxx"
34 #ifndef _DIALOGCUSTOMCONTROLS_CXX_
35 #include "dialogcustomcontrols.hxx"
37 #include <osl/diagnose.h>
39 //-----------------------------------
41 //-----------------------------------
43 CDialogCustomControlBase::CDialogCustomControlBase(HWND aControlHandle
, HWND aParentHandle
) :
44 m_CustomControlHandle(aControlHandle
),
45 m_ParentHandle(aParentHandle
)
49 //-----------------------------------
51 //-----------------------------------
53 void SAL_CALL
CDialogCustomControlBase::SetFont(HFONT hFont
)
56 m_CustomControlHandle
,
62 //-----------------------------------
64 //-----------------------------------
66 void SAL_CALL
CDialogCustomControlBase::AlignToBuddy(HWND aBuddyHandle
)
68 OSL_PRECOND(IsWindow(aBuddyHandle
),"Invalid buddy window handle");
71 GetWindowRect(aBuddyHandle
,&rcBuddy
);
73 POINT pt
= {rcBuddy
.left
,rcBuddy
.top
};
74 ScreenToClient(m_ParentHandle
,&pt
);
76 int cx_new
= rcBuddy
.right
- rcBuddy
.left
;
77 int cy_new
= rcBuddy
.bottom
- rcBuddy
.top
;
79 // keep the vertical position because
80 // the Windows dialog controler does
83 GetWindowRect(m_CustomControlHandle
,&rcMe
);
85 POINT ptMe
= {rcMe
.left
,rcMe
.top
};
86 ScreenToClient(m_ParentHandle
,&ptMe
);
89 m_CustomControlHandle
,
98 //-----------------------------------
100 //-----------------------------------
102 CDummyCustomControl::CDummyCustomControl(HWND
, HWND
)
106 //-----------------------------------
108 //-----------------------------------
110 void SAL_CALL
CDummyCustomControl::Align()
115 //-----------------------------------
117 //-----------------------------------
119 void SAL_CALL
CDummyCustomControl::SetFont(HFONT
)
124 //-----------------------------------
126 //-----------------------------------
128 CStaticCustomControl::CStaticCustomControl(HWND aControlHandle
, HWND aParentHandle
) :
129 CDialogCustomControlBase(aControlHandle
,aParentHandle
)
133 //-----------------------------------
134 // Align to the "File name" static
135 // text of the standard FileOpen dlg
136 //-----------------------------------
138 void SAL_CALL
CStaticCustomControl::Align()
140 AlignToBuddy(GetDlgItem(m_ParentHandle
,stc3
));
143 //-----------------------------------
145 //-----------------------------------
147 CPushButtonCustomControl::CPushButtonCustomControl(HWND aControlHandle
, HWND aParentHandle
) :
148 CDialogCustomControlBase(aControlHandle
,aParentHandle
)
152 //-----------------------------------
153 // Align to the "OK" button of the
154 // standard FileOpen dlg
155 //-----------------------------------
157 void SAL_CALL
CPushButtonCustomControl::Align()
159 AlignToBuddy(GetDlgItem(m_ParentHandle
,IDCANCEL
));
162 //-----------------------------------
164 //-----------------------------------
166 CComboboxCustomControl::CComboboxCustomControl(HWND aControlHandle
, HWND aParentHandle
) :
167 CDialogCustomControlBase(aControlHandle
,aParentHandle
)
171 //-----------------------------------
172 // Align to the "File name" combobox
173 // of the standard FileOpen dlg
174 //-----------------------------------
176 void SAL_CALL
CComboboxCustomControl::Align()
178 AlignToBuddy(GetDlgItem(m_ParentHandle
,cmb1
));
181 //-----------------------------------
183 //-----------------------------------
185 CCheckboxCustomControl::CCheckboxCustomControl(HWND aControlHandle
, HWND aParentHandle
) :
186 CDialogCustomControlBase(aControlHandle
,aParentHandle
)
190 //-----------------------------------
191 // Align to the "File name" combobox
192 // of the standard FileOpen dlg
193 //-----------------------------------
195 void SAL_CALL
CCheckboxCustomControl::Align()
197 AlignToBuddy(GetDlgItem(m_ParentHandle
,cmb1
));