1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/stdtext.hxx>
21 #include <vcl/image.hxx>
22 #include <vcl/weld.hxx>
23 #include <bitmaps.hlst>
24 #include <strings.hrc>
27 void ShowServiceNotAvailableError(weld::Widget
* pParent
,
28 const OUString
& rServiceName
, bool bError
)
30 OUString aText
= VclResId(SV_STDTEXT_SERVICENOTAVAILABLE
).replaceAll("%s", rServiceName
);
31 std::unique_ptr
<weld::MessageDialog
> xBox(Application::CreateMessageDialog(pParent
,
32 bError
? VclMessageType::Error
: VclMessageType::Warning
, VclButtonsType::Ok
, aText
));
36 static void ImplInitMsgBoxImageList()
38 ImplSVData
* pSVData
= ImplGetSVData();
39 std::vector
<Image
> &rImages
= pSVData
->maWinData
.maMsgBoxImgList
;
42 rImages
.emplace_back(Image(StockImage::Yes
, SV_RESID_BITMAP_ERRORBOX
));
43 rImages
.emplace_back(Image(StockImage::Yes
, SV_RESID_BITMAP_QUERYBOX
));
44 rImages
.emplace_back(Image(StockImage::Yes
, SV_RESID_BITMAP_WARNINGBOX
));
45 rImages
.emplace_back(Image(StockImage::Yes
, SV_RESID_BITMAP_INFOBOX
));
49 Image
const & GetStandardInfoBoxImage()
51 ImplInitMsgBoxImageList();
52 return ImplGetSVData()->maWinData
.maMsgBoxImgList
[3];
55 OUString
GetStandardInfoBoxText()
57 return VclResId(SV_MSGBOX_INFO
);
60 Image
const & GetStandardWarningBoxImage()
62 ImplInitMsgBoxImageList();
63 return ImplGetSVData()->maWinData
.maMsgBoxImgList
[2];
66 OUString
GetStandardWarningBoxText()
68 return VclResId(SV_MSGBOX_WARNING
);
71 Image
const & GetStandardErrorBoxImage()
73 ImplInitMsgBoxImageList();
74 return ImplGetSVData()->maWinData
.maMsgBoxImgList
[0];
77 OUString
GetStandardErrorBoxText()
79 return VclResId(SV_MSGBOX_ERROR
);
82 Image
const & GetStandardQueryBoxImage()
84 ImplInitMsgBoxImageList();
85 return ImplGetSVData()->maWinData
.maMsgBoxImgList
[1];
88 OUString
GetStandardQueryBoxText()
90 return VclResId(SV_MSGBOX_QUERY
);
93 OUString
GetStandardText(StandardButtonType eButton
)
95 static const char* aResIdAry
[static_cast<int>(StandardButtonType::Count
)] =
97 // http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
98 // Under windows we don't want accelerators on ok/cancel but do on other
101 SV_BUTTONTEXT_OK_NOMNEMONIC
,
102 SV_BUTTONTEXT_CANCEL_NOMNEMONIC
,
105 SV_BUTTONTEXT_CANCEL
,
113 SV_BUTTONTEXT_IGNORE
,
121 return VclResId(aResIdAry
[static_cast<sal_uInt16
>(eButton
)]);
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */