diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-11-18 11:34:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-18 14:08:08 +0000 |
commit | e0840df74c9f33cae4e3cea5f5e5de39d51d17fd (patch) | |
tree | daba654ec69a941e2c1926922a9056e04b14338d /sfx2 | |
parent | 6019cd9bb5606e0d3c2dfd3acbf3a24eee85ea11 (diff) |
convert alien dialog to .ui
Change-Id: I5b4a17eb83d61f7f95d7b71024ba035c957adf2c
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/AllLangResTarget_sfx2.mk | 1 | ||||
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/alienwarn.cxx | 133 | ||||
-rw-r--r-- | sfx2/source/dialog/alienwarn.hrc | 54 | ||||
-rw-r--r-- | sfx2/source/dialog/alienwarn.src | 83 | ||||
-rw-r--r-- | sfx2/source/inc/alienwarn.hxx | 19 | ||||
-rw-r--r-- | sfx2/source/inc/helpid.hrc | 1 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/alienwarndialog.ui | 88 |
8 files changed, 105 insertions, 275 deletions
diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index c9fc44aa4bea..b845e20c58e9 100644 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -42,7 +42,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\ sfx2/source/bastyp/bastyp.src \ sfx2/source/bastyp/fltfnc.src \ sfx2/source/control/templateview.src \ - sfx2/source/dialog/alienwarn.src \ sfx2/source/dialog/dialog.src \ sfx2/source/dialog/dinfdlg.src \ sfx2/source/dialog/filedlghelper.src \ diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index 1ae909102b69..a62f479f7947 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -10,6 +10,7 @@ $(eval $(call gb_UIConfig_UIConfig,sfx)) $(eval $(call gb_UIConfig_add_uifiles,sfx,\ + sfx2/uiconfig/ui/alienwarndialog \ sfx2/uiconfig/ui/checkin \ sfx2/uiconfig/ui/custominfopage \ sfx2/uiconfig/ui/descriptioninfopage \ diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index dd2e9d190263..0ec75affefa6 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -19,149 +19,38 @@ #include <sal/macros.h> -#include "alienwarn.hxx" #include <sfx2/sfxresid.hxx> #include <sfx2/sfxuno.hxx> - -#include "alienwarn.hrc" -#include "dialog.hrc" -#include <vcl/msgbox.hxx> #include <unotools/saveopt.hxx> +#include "alienwarn.hxx" -// class SfxAlienWarningDialog ------------------------------------------- - -SfxAlienWarningDialog::SfxAlienWarningDialog( Window* pParent, const OUString& _rFormatName ) : - - SfxModalDialog( pParent, SfxResId( RID_DLG_ALIEN_WARNING ) ), - - m_aKeepCurrentBtn ( this, SfxResId( PB_NO ) ), - m_aSaveODFBtn ( this, SfxResId( PB_YES ) ), - m_aMoreInfoBtn ( this, SfxResId( PB_MOREINFO ) ), - m_aOptionLine ( this, SfxResId( FL_OPTION ) ), - m_aWarningOnBox ( this, SfxResId( CB_WARNING_OFF ) ), - m_aQueryImage ( this, SfxResId( FI_QUERY ) ), - m_aInfoText ( this, SfxResId( FT_INFOTEXT ) ) - +SfxAlienWarningDialog::SfxAlienWarningDialog(Window* pParent, const OUString& _rFormatName) + : MessageDialog(pParent, "AlienWarnDialog", "sfx/ui/alienwarndialog.ui") { - FreeResource(); - - // set questionmark image - m_aQueryImage.SetImage( QueryBox::GetStandardImage() ); + get(m_pWarningOnBox, "ask"); + get(m_pKeepCurrentBtn, "ok"); // replace formatname (text) - OUString sInfoText = m_aInfoText.GetText(); + OUString sInfoText = get_primary_text(); sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName ); - m_aInfoText.SetText( sInfoText ); + set_primary_text(sInfoText); // replace formatname (button) - sInfoText = m_aKeepCurrentBtn.GetText(); + sInfoText = m_pKeepCurrentBtn->GetText(); sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName ); - m_aKeepCurrentBtn.SetText( sInfoText ); + m_pKeepCurrentBtn->SetText( sInfoText ); // load value of "warning on" checkbox from save options - m_aWarningOnBox.Check( SvtSaveOptions().IsWarnAlienFormat() == sal_True ); - - // set focus to "Keep Current Format" button - m_aKeepCurrentBtn.GrabFocus(); - - // pb: #i43989# we have no online help for this dialog at the moment - // -> hide the "more info" button - //m_aMoreInfoBtn.Hide(); - - // calculate and set the size of the dialog and its controls - InitSize(); + m_pWarningOnBox->Check( SvtSaveOptions().IsWarnAlienFormat() == sal_True ); } -// ----------------------------------------------------------------------- - SfxAlienWarningDialog::~SfxAlienWarningDialog() { // save value of "warning off" checkbox, if necessary SvtSaveOptions aSaveOpt; - sal_Bool bChecked = m_aWarningOnBox.IsChecked(); + sal_Bool bChecked = m_pWarningOnBox->IsChecked(); if ( aSaveOpt.IsWarnAlienFormat() != bChecked ) aSaveOpt.SetWarnAlienFormat( bChecked ); } -// ----------------------------------------------------------------------- - -void SfxAlienWarningDialog::InitSize() -{ - const long nExtraButtonWidth = LogicToPixel( Size(IMPL_EXTRA_BUTTON_WIDTH,1), MapMode(MAP_APPFONT) ).getWidth(); - const long nAwCol2 = LogicToPixel( Size(AW_COL_2,1), MapMode(MAP_APPFONT) ).getWidth(); - long nTxtW, nCtrlW; - - // layout calculations should be re-done, when More Info button is enabled - m_aMoreInfoBtn.Hide(); - - // recalculate the size and position of the buttons - nTxtW = m_aKeepCurrentBtn.GetCtrlTextWidth( m_aKeepCurrentBtn.GetText() ); - nTxtW += nExtraButtonWidth; - Size aNewSize = m_aKeepCurrentBtn.GetSizePixel(); - aNewSize.Width() = nTxtW; - m_aKeepCurrentBtn.SetSizePixel( aNewSize ); - Point aPos = m_aSaveODFBtn.GetPosPixel(); - aPos.X() = nAwCol2 + nTxtW + nExtraButtonWidth; - m_aSaveODFBtn.SetPosPixel( aPos ); - nTxtW = m_aSaveODFBtn.GetCtrlTextWidth( m_aSaveODFBtn.GetText() ); - nTxtW += nExtraButtonWidth; - aNewSize = m_aSaveODFBtn.GetSizePixel(); - aNewSize.Width() = nTxtW; - m_aSaveODFBtn.SetSizePixel( aNewSize ); - long nBtnsWidthSize = m_aKeepCurrentBtn.GetSizePixel().Width() + m_aSaveODFBtn.GetSizePixel().Width() + nAwCol2 + 2*nExtraButtonWidth; - - // resize + text of checkbox too wide -> add new line - aNewSize = m_aWarningOnBox.GetSizePixel(); - aNewSize.Width() = nBtnsWidthSize - 2*nExtraButtonWidth; - m_aWarningOnBox.SetSizePixel( aNewSize ); - nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() ); - nCtrlW = m_aWarningOnBox.GetSizePixel().Width(); - if ( nTxtW >= nCtrlW ) - { - long nTextHeight = m_aWarningOnBox.GetTextHeight(); - aNewSize.Height() += nTextHeight; - m_aWarningOnBox.SetSizePixel( aNewSize ); - aNewSize = GetSizePixel(); - aNewSize.Height() += nTextHeight; - SetSizePixel( aNewSize ); - } - - // resize + align the size of the information text control (FixedText) to its content - aNewSize = m_aInfoText.GetSizePixel(); - aNewSize.Width() = nBtnsWidthSize - 2*nExtraButtonWidth; - m_aInfoText.SetSizePixel( aNewSize ); - Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() ); - long nTxtH = aMinSize.Height(); - long nCtrlH = m_aInfoText.GetSizePixel().Height(); - long nDelta = ( nCtrlH - nTxtH ); - aNewSize.Height() -= nDelta; - m_aInfoText.SetSizePixel( aNewSize ); - - - // new position for the succeeding windows - Window* pWins[] = - { - &m_aSaveODFBtn, &m_aKeepCurrentBtn, &m_aMoreInfoBtn, &m_aOptionLine, &m_aWarningOnBox - }; - Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) - { - Point aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } - - // new size of the dialog - aNewSize = GetSizePixel(); - aNewSize.Height() -= nDelta; - aNewSize.Width() = nBtnsWidthSize; - SetSizePixel( aNewSize ); - - // resize the FixedLine - aNewSize = m_aOptionLine.GetSizePixel(); - aNewSize.Width() = GetSizePixel().Width(); - m_aOptionLine.SetSizePixel( aNewSize ); - -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/alienwarn.hrc b/sfx2/source/dialog/alienwarn.hrc deleted file mode 100644 index 7c871e3300cb..000000000000 --- a/sfx2/source/dialog/alienwarn.hrc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ -#ifndef _SFX_ALIENWARN_HRC -#define _SFX_ALIENWARN_HRC - -#include <svtools/controldims.hrc> - -// dialog ids - -#define FI_QUERY 10 -#define FT_INFOTEXT 11 -#define PB_YES 12 -#define PB_NO 13 -#define PB_MOREINFO 14 -#define FL_OPTION 15 -#define CB_WARNING_OFF 16 - -// --------- general metrics --------- - -#define SYMBOL_EDGE 20 -#define DIALOG_WIDTH 250 -#define INFO_TEXT_LINES 11 - -#define AW_COL_1 (RSC_SP_DLG_INNERBORDER_LEFT) -#define AW_COL_2 (AW_COL_1+SYMBOL_EDGE+RSC_SP_CTRL_DESC_X) -#define AW_COL_3 (AW_COL_2+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_DESC_X) -#define AW_COL_4 (DIALOG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_WIDTH) - -#define AW_ROW_1 (RSC_SP_DLG_INNERBORDER_TOP) -#define AW_ROW_2 (AW_ROW_1+INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_Y) -#define AW_ROW_3 (AW_ROW_2+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y) -#define AW_ROW_4 (AW_ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y) - -#define DIALOG_HEIGHT (AW_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM) - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/alienwarn.src b/sfx2/source/dialog/alienwarn.src deleted file mode 100644 index 88a6fc1eb9eb..000000000000 --- a/sfx2/source/dialog/alienwarn.src +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ - -#include "alienwarn.hrc" -#include "dialog.hrc" -#include "helpid.hrc" - -ModalDialog RID_DLG_ALIEN_WARNING -{ - HelpId = HID_WARNING_ALIENFORMAT; - Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT ); - OutputSize = TRUE; - Closeable = FALSE; - Moveable = TRUE; - SVLook = TRUE; - - Text [ en-US ] = "Confirm File Format"; - - FixedImage FI_QUERY - { - Pos = MAP_APPFONT( AW_COL_1, AW_ROW_1 ); - Size = MAP_APPFONT( SYMBOL_EDGE, SYMBOL_EDGE ); - }; - FixedText FT_INFOTEXT - { - Pos = MAP_APPFONT( AW_COL_2, AW_ROW_1 ); - Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT ); - NoLabel = TRUE; - Wordbreak = TRUE; - Text [ en-US ] = "This document may contain formatting or content that cannot be saved in the currently selected file format \"%FORMATNAME\".\n\nUse the default ODF file format to be sure that the document is saved correctly."; - }; - OKButton PB_NO - { - Pos = MAP_APPFONT( AW_COL_2, AW_ROW_2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - DefButton = TRUE ; - Text [ en-US ] = "~Use %FORMATNAME Format"; - }; - CancelButton PB_YES - { - Pos = MAP_APPFONT( AW_COL_3, AW_ROW_2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "Use ~ODF Format"; - }; - HelpButton PB_MOREINFO - { - Pos = MAP_APPFONT( AW_COL_4, AW_ROW_2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Hide = TRUE ; - Text [ en-US ] = "~More Information..."; - }; - FixedLine FL_OPTION - { - Pos = MAP_APPFONT( 0, AW_ROW_3 ); - Size = MAP_APPFONT( DIALOG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - }; - CheckBox CB_WARNING_OFF - { - HelpID = "sfx2:CheckBox:RID_DLG_ALIEN_WARNING:CB_WARNING_OFF"; - Pos = MAP_APPFONT( AW_COL_2, AW_ROW_4 ); - Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT ); - WordBreak = TRUE ; - Text [ en-US ] = "~Ask when not saving in ODF format"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index 722115879ca5..4ad97689d959 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -20,25 +20,16 @@ #define INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX #include <vcl/button.hxx> -#include <vcl/fixed.hxx> +#include <vcl/layout.hxx> -#include <sfx2/basedlgs.hxx> - -class SfxAlienWarningDialog : public SfxModalDialog +class SfxAlienWarningDialog : public MessageDialog { private: - OKButton m_aKeepCurrentBtn; - CancelButton m_aSaveODFBtn; - HelpButton m_aMoreInfoBtn; - FixedLine m_aOptionLine; - CheckBox m_aWarningOnBox; - FixedImage m_aQueryImage; - FixedText m_aInfoText; - - void InitSize(); + PushButton* m_pKeepCurrentBtn; + CheckBox* m_pWarningOnBox; public: - SfxAlienWarningDialog( Window* pParent, const OUString& _rFormatName ); + SfxAlienWarningDialog(Window* pParent, const OUString& _rFormatName); virtual ~SfxAlienWarningDialog(); }; diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index 575579ee7655..d26d3f44ad73 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -128,7 +128,6 @@ #define HID_XMLSECDLG_MACROWARN "SFX2_HID_XMLSECDLG_MACROWARN" #define HID_XMLSEC_INFO_WRONGDOCFORMAT "SFX2_HID_XMLSEC_INFO_WRONGDOCFORMAT" #define HID_WARNING_MACROSDISABLED "SFX2_HID_WARNING_MACROSDISABLED" -#define HID_WARNING_ALIENFORMAT "SFX2_HID_WARNING_ALIENFORMAT" #define HID_HELP_ONSTARTUP_BOX "SFX2_HID_HELP_ONSTARTUP_BOX" #define HID_DLG_CHECKFORONLINEUPDATE "SFX2_HID_DLG_CHECKFORONLINEUPDATE" #define HID_CTRL_CUSTOMPROPS_YES_NO "SFX2_HID_CTRL_CUSTOMPROPS_YES_NO" diff --git a/sfx2/uiconfig/ui/alienwarndialog.ui b/sfx2/uiconfig/ui/alienwarndialog.ui new file mode 100644 index 000000000000..02bbca336f37 --- /dev/null +++ b/sfx2/uiconfig/ui/alienwarndialog.ui @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkMessageDialog" id="AlienWarnDialog"> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="title" translatable="yes">Confirm File Format</property> + <property name="resizable">False</property> + <property name="modal">True</property> + <property name="type_hint">dialog</property> + <property name="skip_taskbar_hint">True</property> + <property name="message_type">question</property> + <property name="text" translatable="yes">This document may contain formatting or content that cannot be saved in the currently selected file format "%FORMATNAME".</property> + <property name="secondary_text" translatable="yes">Use the default ODF file format to be sure that the document is saved correctly.</property> + <child internal-child="vbox"> + <object class="GtkBox" id="messagedialog-vbox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">24</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="messagedialog-action_area"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label" translatable="yes">_Use %FORMATNAME Format</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + <property name="non_homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">Use _ODF Format</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + <property name="image_position">bottom</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + <property name="non_homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="ask"> + <property name="label" translatable="yes">_Ask when not saving in ODF format</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="1">ok</action-widget> + <action-widget response="0">cancel</action-widget> + </action-widgets> + </object> +</interface> |