Line data Source code
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 :
21 : #include <sal/macros.h>
22 : #include <sfx2/sfxresid.hxx>
23 : #include <sfx2/sfxuno.hxx>
24 : #include <unotools/saveopt.hxx>
25 : #include <vcl/msgbox.hxx>
26 : #include "alienwarn.hxx"
27 :
28 0 : SfxAlienWarningDialog::SfxAlienWarningDialog(Window* pParent, const OUString& _rFormatName)
29 0 : : MessageDialog(pParent, "AlienWarnDialog", "sfx/ui/alienwarndialog.ui")
30 : {
31 0 : get(m_pWarningOnBox, "ask");
32 : //fdo#75121, a bit tricky because the widgets we want to align with
33 : //don't actually exist in the ui description, they're implied
34 0 : m_pWarningOnBox->set_margin_left(QueryBox::GetStandardImage().GetSizePixel().Width() + 12);
35 :
36 0 : get(m_pKeepCurrentBtn, "save");
37 :
38 : // replace formatname (text)
39 0 : OUString sInfoText = get_primary_text();
40 0 : sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName );
41 0 : set_primary_text(sInfoText);
42 :
43 : // replace formatname (button)
44 0 : sInfoText = m_pKeepCurrentBtn->GetText();
45 0 : sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName );
46 0 : m_pKeepCurrentBtn->SetText( sInfoText );
47 :
48 : // load value of "warning on" checkbox from save options
49 0 : m_pWarningOnBox->Check( SvtSaveOptions().IsWarnAlienFormat() );
50 0 : }
51 :
52 0 : SfxAlienWarningDialog::~SfxAlienWarningDialog()
53 : {
54 : // save value of "warning off" checkbox, if necessary
55 0 : SvtSaveOptions aSaveOpt;
56 0 : bool bChecked = m_pWarningOnBox->IsChecked();
57 0 : if ( aSaveOpt.IsWarnAlienFormat() != bChecked )
58 0 : aSaveOpt.SetWarnAlienFormat( bChecked );
59 3 : }
60 :
61 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|