1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 20 #include <o3tl/typed_flags_set.hxx> 21 #include <helper/btndlg.hxx> 22 #include <vcl/toolkit/fixed.hxx> 23 24 // Window-Bits for MessageBoxen 25 enum class MessBoxStyle 26 { 27 NONE = 0x0000, 28 Ok = 0x0001, 29 OkCancel = 0x0002, 30 YesNo = 0x0004, 31 YesNoCancel = 0x0008, 32 RetryCancel = 0x0010, 33 DefaultOk = 0x0020, 34 DefaultCancel = 0x0040, 35 DefaultRetry = 0x0080, 36 DefaultYes = 0x0100, 37 DefaultNo = 0x0200, 38 AbortRetryIgnore = 0x1000, 39 DefaultIgnore = 0x2000, 40 }; 41 namespace o3tl 42 { 43 template <> struct typed_flags<MessBoxStyle> : is_typed_flags<MessBoxStyle, 0x33ff> 44 { 45 }; 46 } 47 48 class MessBox : public ButtonDialog 49 { 50 VclPtr<VclMultiLineEdit> mpVCLMultiLineEdit; 51 VclPtr<FixedImage> mpFixedImage; 52 Image maImage; 53 bool mbHelpBtn; 54 MessBoxStyle mnMessBoxStyle; 55 56 protected: 57 OUString maMessText; 58 59 void ImplInitButtons(); 60 void ImplPosControls(); 61 62 public: 63 MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n, const OUString& rTitle, 64 const OUString& rMessage); 65 virtual ~MessBox() override; 66 virtual void dispose() override; 67 68 virtual void StateChanged(StateChangedType nStateChange) override; 69 SetMessText(const OUString & rText)70 void SetMessText(const OUString& rText) { maMessText = rText; } GetMessText() const71 const OUString& GetMessText() const { return maMessText; } 72 SetImage(const Image & rImage)73 void SetImage(const Image& rImage) { maImage = rImage; } 74 75 virtual Size GetOptimalSize() const override; 76 }; 77 78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 79