2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-05 20:18:35 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2005-02-02 15:47:06 +00:00
|
|
|
|
2006-09-17 15:30:32 +00:00
|
|
|
|
2010-10-14 22:33:33 +01:00
|
|
|
#include <sal/macros.h>
|
2013-11-11 22:11:22 -06:00
|
|
|
#include <sfx2/sfxresid.hxx>
|
2007-06-27 22:09:13 +00:00
|
|
|
#include <sfx2/sfxuno.hxx>
|
2009-10-06 07:38:24 +02:00
|
|
|
#include <unotools/saveopt.hxx>
|
2014-02-18 15:47:15 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
2013-11-18 11:34:28 +00:00
|
|
|
#include "alienwarn.hxx"
|
2005-02-02 15:47:06 +00:00
|
|
|
|
2015-04-10 18:52:33 +02:00
|
|
|
SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName,
|
|
|
|
const OUString& _rDefaultExtension, bool rDefaultIsAlien)
|
2013-11-18 11:34:28 +00:00
|
|
|
: MessageDialog(pParent, "AlienWarnDialog", "sfx/ui/alienwarndialog.ui")
|
2005-02-02 15:47:06 +00:00
|
|
|
{
|
2013-11-18 11:34:28 +00:00
|
|
|
get(m_pWarningOnBox, "ask");
|
2014-02-18 15:47:15 +00:00
|
|
|
//fdo#75121, a bit tricky because the widgets we want to align with
|
|
|
|
//don't actually exist in the ui description, they're implied
|
|
|
|
m_pWarningOnBox->set_margin_left(QueryBox::GetStandardImage().GetSizePixel().Width() + 12);
|
|
|
|
|
2014-01-08 12:14:04 +00:00
|
|
|
get(m_pKeepCurrentBtn, "save");
|
2014-12-15 19:13:24 +01:00
|
|
|
get(m_pUseDefaultFormatBtn, "cancel");
|
|
|
|
|
2015-04-10 18:52:33 +02:00
|
|
|
OUString aExtension = "ODF";
|
2005-02-02 15:47:06 +00:00
|
|
|
|
2011-08-11 12:25:48 +09:30
|
|
|
// replace formatname (text)
|
2013-11-18 11:34:28 +00:00
|
|
|
OUString sInfoText = get_primary_text();
|
2013-02-01 09:33:19 +01:00
|
|
|
sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName );
|
2013-11-18 11:34:28 +00:00
|
|
|
set_primary_text(sInfoText);
|
2005-02-02 15:47:06 +00:00
|
|
|
|
2011-08-11 12:25:48 +09:30
|
|
|
// replace formatname (button)
|
2013-11-18 11:34:28 +00:00
|
|
|
sInfoText = m_pKeepCurrentBtn->GetText();
|
2013-02-01 09:33:19 +01:00
|
|
|
sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName );
|
2013-11-18 11:34:28 +00:00
|
|
|
m_pKeepCurrentBtn->SetText( sInfoText );
|
2011-08-11 12:25:48 +09:30
|
|
|
|
2015-04-10 18:52:33 +02:00
|
|
|
// hide ODF explanation if default format is alien
|
|
|
|
// and set the proper extension in the button
|
|
|
|
if( rDefaultIsAlien )
|
|
|
|
{
|
|
|
|
set_secondary_text(OUString());
|
|
|
|
aExtension = _rDefaultExtension.toAsciiUpperCase();
|
|
|
|
}
|
|
|
|
|
2014-12-15 19:13:24 +01:00
|
|
|
// replace defaultextension (button)
|
|
|
|
sInfoText = m_pUseDefaultFormatBtn->GetText();
|
|
|
|
sInfoText = sInfoText.replaceAll( "%DEFAULTEXTENSION", aExtension );
|
|
|
|
m_pUseDefaultFormatBtn->SetText( sInfoText );
|
|
|
|
|
2008-03-12 10:33:58 +00:00
|
|
|
// load value of "warning on" checkbox from save options
|
2014-02-19 12:30:34 +01:00
|
|
|
m_pWarningOnBox->Check( SvtSaveOptions().IsWarnAlienFormat() );
|
2005-07-12 13:26:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SfxAlienWarningDialog::~SfxAlienWarningDialog()
|
2015-01-13 14:50:19 +02:00
|
|
|
{
|
2015-03-10 09:07:06 +02:00
|
|
|
disposeOnce();
|
2015-01-13 14:50:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SfxAlienWarningDialog::dispose()
|
2005-07-12 13:26:29 +00:00
|
|
|
{
|
|
|
|
// save value of "warning off" checkbox, if necessary
|
|
|
|
SvtSaveOptions aSaveOpt;
|
2014-02-19 12:30:34 +01:00
|
|
|
bool bChecked = m_pWarningOnBox->IsChecked();
|
2005-07-12 13:26:29 +00:00
|
|
|
if ( aSaveOpt.IsWarnAlienFormat() != bChecked )
|
|
|
|
aSaveOpt.SetWarnAlienFormat( bChecked );
|
2015-03-09 14:29:30 +02:00
|
|
|
m_pKeepCurrentBtn.clear();
|
2015-04-28 11:41:31 +01:00
|
|
|
m_pUseDefaultFormatBtn.clear();
|
2015-03-09 14:29:30 +02:00
|
|
|
m_pWarningOnBox.clear();
|
2015-01-13 14:50:19 +02:00
|
|
|
MessageDialog::dispose();
|
2005-07-12 13:26:29 +00:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|