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: confirmdelete.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_svx.hxx"
33 #include "confirmdelete.hxx"
34 #include <svx/dialmgr.hxx>
35 #ifndef _SVX_FMHELP_HRC
38 #ifndef _SVX_FMRESIDS_HRC
39 #include "fmresids.hrc"
41 #include <unotools/configmgr.hxx>
42 #include <vcl/msgbox.hxx>
44 //........................................................................
47 //........................................................................
49 #define BORDER_HEIGHT 6 // default distance control-dialog
50 #define BORDER_WIDTH 6 // default distance control-dialog
52 using namespace ::com::sun::star::uno
;
54 //====================================================================
55 //= class ConfirmDeleteDialog
56 //====================================================================
57 //------------------------------------------------------------------------------
58 ConfirmDeleteDialog::ConfirmDeleteDialog(Window
* pParent
, const String
& _rTitle
)
59 :ButtonDialog(pParent
, WB_HORZ
| WB_STDDIALOG
)
61 ,m_aTitle (this, WB_WORDBREAK
| WB_LEFT
)
62 ,m_aMessage (this, WB_WORDBREAK
| WB_LEFT
)
64 String
sMessage(SVX_RES(RID_STR_DELETECONFIRM
));
66 // Changed as per BugID 79541 Branding/Configuration
67 Any aProductName
= ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME
);
68 ::rtl::OUString sProductName
;
69 aProductName
>>= sProductName
;
71 String aTitle
= sProductName
;
72 aProductName
= ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTVERSION
);
73 aProductName
>>= sProductName
;
74 aTitle
.AppendAscii(" ");
75 aTitle
+= String(sProductName
);
78 SetHelpId(HID_DLG_DBMSG
);
79 SetSizePixel(LogicToPixel(Size(220, 30),MAP_APPFONT
));
81 m_aInfoImage
.SetPosSizePixel(LogicToPixel(Point(6, 6),MAP_APPFONT
),
82 LogicToPixel(Size(20, 20),MAP_APPFONT
));
85 m_aTitle
.SetPosSizePixel(LogicToPixel(Point(45, 6),MAP_APPFONT
),
86 LogicToPixel(Size(169, 20),MAP_APPFONT
));
88 Font aFont
= m_aTitle
.GetFont();
89 aFont
.SetWeight(WEIGHT_SEMIBOLD
);
90 m_aTitle
.SetFont(aFont
);
93 m_aMessage
.SetPosSizePixel(LogicToPixel(Point(45, 29),MAP_APPFONT
),
94 LogicToPixel(Size(169, 1),MAP_APPFONT
));
98 m_aInfoImage
.SetImage(WarningBox::GetStandardImage());
101 m_aTitle
.SetText(_rTitle
);
103 // Ermitteln der Hoehe des Textfeldes und des Dialogs
104 Size aBorderSize
= LogicToPixel(Size(BORDER_WIDTH
, BORDER_HEIGHT
),MAP_APPFONT
);
105 Rectangle
aDlgRect(GetPosPixel(),GetSizePixel());
106 Rectangle
aMessageRect(m_aMessage
.GetPosPixel(),m_aMessage
.GetSizePixel());
107 Rectangle aTextRect
=
108 GetTextRect(aMessageRect
, sMessage
, TEXT_DRAW_WORDBREAK
| TEXT_DRAW_MULTILINE
| TEXT_DRAW_LEFT
);
110 long nHText
= aTextRect
.Bottom() > aMessageRect
.Bottom() ? aTextRect
.Bottom() - aMessageRect
.Bottom() : 0;
112 aDlgRect
.Bottom() += nHText
+ 2 * aBorderSize
.Height();
113 aMessageRect
.Bottom() += nHText
;
116 SetSizePixel(aDlgRect
.GetSize());
117 SetPageSizePixel(aDlgRect
.GetSize());
119 // Message Text anpassen und setzen
120 m_aMessage
.SetSizePixel(aMessageRect
.GetSize());
121 m_aMessage
.SetText(sMessage
);
124 AddButton(BUTTON_YES
, BUTTONID_YES
, 0);
125 AddButton(BUTTON_NO
, BUTTONID_NO
, BUTTONDIALOG_DEFBUTTON
| BUTTONDIALOG_FOCUSBUTTON
);
128 //------------------------------------------------------------------------------
129 ConfirmDeleteDialog::~ConfirmDeleteDialog()
133 //........................................................................
134 } // namespace svxform
135 //........................................................................