diff options
-rw-r--r-- | include/svx/linkwarn.hxx | 16 | ||||
-rw-r--r-- | svx/AllLangResTarget_svx.mk | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/source/dialog/linkwarn.cxx | 104 | ||||
-rw-r--r-- | svx/source/dialog/linkwarn.hrc | 53 | ||||
-rw-r--r-- | svx/source/dialog/linkwarn.src | 74 | ||||
-rw-r--r-- | svx/uiconfig/ui/linkwarndialog.ui | 89 |
7 files changed, 103 insertions, 235 deletions
diff --git a/include/svx/linkwarn.hxx b/include/svx/linkwarn.hxx index ba0d841aaba1..beb715452238 100644 --- a/include/svx/linkwarn.hxx +++ b/include/svx/linkwarn.hxx @@ -21,24 +21,16 @@ #define INCLUDED_SVX_LINKWARN_HXX #include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <sfx2/basedlgs.hxx> +#include <vcl/layout.hxx> #include <svx/svxdllapi.h> -class SVX_DLLPUBLIC SvxLinkWarningDialog : public SfxModalDialog +class SVX_DLLPUBLIC SvxLinkWarningDialog : public MessageDialog { private: - FixedImage m_aQueryImage; - FixedText m_aInfoText; - OKButton m_aLinkGraphicBtn; - CancelButton m_aEmbedGraphicBtn; - FixedLine m_aOptionLine; - CheckBox m_aWarningOnBox; - - void InitSize(); + CheckBox* m_pWarningOnBox; public: - SvxLinkWarningDialog( Window* pParent, const OUString& _rFileName ); + SvxLinkWarningDialog(Window* pParent, const OUString& _rFileName); virtual ~SvxLinkWarningDialog(); }; diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk index f2674d132a1d..002b339cc52b 100644 --- a/svx/AllLangResTarget_svx.mk +++ b/svx/AllLangResTarget_svx.mk @@ -48,7 +48,6 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\ svx/source/dialog/imapdlg.src \ svx/source/dialog/langbox.src \ svx/source/dialog/language.src \ - svx/source/dialog/linkwarn.src \ svx/source/dialog/passwd.src \ svx/source/dialog/prtqry.src \ svx/source/dialog/ruler.src \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index cb4c7590bf75..1780983c49d3 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -18,6 +18,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/deletefooterdialog \ svx/uiconfig/ui/headfootformatpage \ svx/uiconfig/ui/findreplacedialog \ + svx/uiconfig/ui/linkwarndialog \ svx/uiconfig/ui/optgridpage \ svx/uiconfig/ui/passwd \ svx/uiconfig/ui/redlinecontrol \ diff --git a/svx/source/dialog/linkwarn.cxx b/svx/source/dialog/linkwarn.cxx index e15d7952d267..e46ebfc096be 100644 --- a/svx/source/dialog/linkwarn.cxx +++ b/svx/source/dialog/linkwarn.cxx @@ -17,119 +17,33 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "linkwarn.hrc" -#include "svx/linkwarn.hxx" -#include "svx/dialogs.hrc" -#include "svx/dialmgr.hxx" -#include <vcl/msgbox.hxx> -#include <sfx2/basedlgs.hxx> +#include <svx/linkwarn.hxx> #include <svtools/miscopt.hxx> -SvxLinkWarningDialog::SvxLinkWarningDialog( Window* pParent, const OUString& _rFileName ) : - SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_LINK_WARNING ) ), - m_aQueryImage ( this, SVX_RES( FI_QUERY ) ), - m_aInfoText ( this, SVX_RES( FT_INFOTEXT ) ), - m_aLinkGraphicBtn ( this, SVX_RES( PB_OK ) ), - m_aEmbedGraphicBtn ( this, SVX_RES( PB_NO ) ), - m_aOptionLine ( this, SVX_RES( FL_OPTION ) ), - m_aWarningOnBox ( this, SVX_RES( CB_WARNING_OFF ) ) +SvxLinkWarningDialog::SvxLinkWarningDialog( Window* pParent, const OUString& _rFileName ) + : MessageDialog(pParent, "LinkWarnDialog" , "svx/ui/linkwarndialog.ui") { - FreeResource(); - - // set questionmark image - m_aQueryImage.SetImage( QueryBox::GetStandardImage() ); + get(m_pWarningOnBox, "ask"); // replace filename - OUString sInfoText = m_aInfoText.GetText(); + OUString sInfoText = get_primary_text(); sInfoText = sInfoText.replaceAll("%FILENAME", _rFileName); - m_aInfoText.SetText( sInfoText ); + set_primary_text( sInfoText ); // load state of "warning on" checkbox from misc options SvtMiscOptions aMiscOpt; - m_aWarningOnBox.Check( aMiscOpt.ShowLinkWarningDialog() == sal_True ); + m_pWarningOnBox->Check( aMiscOpt.ShowLinkWarningDialog() == sal_True ); if( aMiscOpt.IsShowLinkWarningDialogReadOnly() ) - m_aWarningOnBox.Disable(); - - // set focus to Cancel button - m_aEmbedGraphicBtn.GrabFocus(); - - // calculate and set the size of the dialog and its controls - InitSize(); + m_pWarningOnBox->Disable(); } -// ----------------------------------------------------------------------- - SvxLinkWarningDialog::~SvxLinkWarningDialog() { // save value of "warning off" checkbox, if necessary SvtMiscOptions aMiscOpt; - sal_Bool bChecked = m_aWarningOnBox.IsChecked(); + sal_Bool bChecked = m_pWarningOnBox->IsChecked(); if ( aMiscOpt.ShowLinkWarningDialog() != bChecked ) aMiscOpt.SetShowLinkWarningDialog( bChecked ); } -// ----------------------------------------------------------------------- - -void SvxLinkWarningDialog::InitSize() -{ - // text of checkbox to wide -> add new line - long nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH; - long nCtrlW = m_aWarningOnBox.GetSizePixel().Width(); - if ( nTxtW >= nCtrlW ) - { - long nTextHeight = m_aWarningOnBox.GetTextHeight(); - Size aNewSize = m_aWarningOnBox.GetSizePixel(); - aNewSize.Height() += nTextHeight; - m_aWarningOnBox.SetSizePixel( aNewSize ); - aNewSize = GetSizePixel(); - aNewSize.Height() += nTextHeight; - SetSizePixel( aNewSize ); - } - - // align the size of the information text control (FixedText) to its content - Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() ); - long nTxtH = aMinSize.Height(); - long nCtrlH = m_aInfoText.GetSizePixel().Height(); - long nDelta = ( nCtrlH - nTxtH ); - Size aNewSize = m_aInfoText.GetSizePixel(); - aNewSize.Height() -= nDelta; - m_aInfoText.SetSizePixel( aNewSize ); - - // new position for the succeeding windows - Window* pWins[] = - { - &m_aLinkGraphicBtn, &m_aEmbedGraphicBtn, &m_aOptionLine, &m_aWarningOnBox - }; - Window** pCurrent = pWins; - for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS(pWins); ++i, ++pCurrent ) - { - Point aNewPos = (*pCurrent)->GetPosPixel(); - aNewPos.Y() -= nDelta; - (*pCurrent)->SetPosPixel( aNewPos ); - } - - // new size of the dialog - aNewSize = GetSizePixel(); - aNewSize.Height() -= nDelta; - SetSizePixel( aNewSize ); - - // recalculate the size and position of the buttons - nTxtW = m_aLinkGraphicBtn.GetCtrlTextWidth( m_aLinkGraphicBtn.GetText() ); - long nTemp = m_aEmbedGraphicBtn.GetCtrlTextWidth( m_aEmbedGraphicBtn.GetText() ); - if ( nTemp > nTxtW ) - nTxtW = nTemp; - nTxtW += IMPL_EXTRA_BUTTON_WIDTH; - Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ); - Point aPos = m_aLinkGraphicBtn.GetPosPixel(); - aPos.X() = ( aNewSize.Width() - (2*nTxtW) - a3Size.Width() ) / 2; - long nDefX = m_aWarningOnBox.GetPosPixel().X(); - if ( nDefX < aPos.X() ) - aPos.X() = nDefX; - aNewSize = m_aLinkGraphicBtn.GetSizePixel(); - aNewSize.Width() = nTxtW; - m_aLinkGraphicBtn.SetPosSizePixel( aPos, aNewSize ); - aPos.X() += nTxtW + a3Size.Width(); - m_aEmbedGraphicBtn.SetPosSizePixel( aPos, aNewSize ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/linkwarn.hrc b/svx/source/dialog/linkwarn.hrc deleted file mode 100644 index ec08edc68380..000000000000 --- a/svx/source/dialog/linkwarn.hrc +++ /dev/null @@ -1,53 +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 _SVX_LINKWARN_HRC -#define _SVX_LINKWARN_HRC - -#include <svtools/controldims.hrc> - -// dialog ids -#define FI_QUERY 10 -#define FT_INFOTEXT 11 -#define PB_OK 12 -#define PB_NO 13 -#define FL_OPTION 15 -#define CB_WARNING_OFF 16 - -// --------- general metrics --------- - -#define SYMBOL_EDGE 20 -#define DIALOG_WIDTH 220 -#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/svx/source/dialog/linkwarn.src b/svx/source/dialog/linkwarn.src deleted file mode 100644 index 3cecfceb1b2f..000000000000 --- a/svx/source/dialog/linkwarn.src +++ /dev/null @@ -1,74 +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 "linkwarn.hrc" -#include "svx/dialogs.hrc" -#include "helpid.hrc" - -ModalDialog RID_SVXDLG_LINK_WARNING -{ - Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT ); - OutputSize = TRUE; - Closeable = FALSE; - Moveable = TRUE; - SVLook = TRUE; - - Text = "%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION"; - - 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 ] = "The file %FILENAME will not be stored along with your document, but only referenced as a link. This is dangerous if you move and/or rename the files. Do you want to embed the graphic instead?"; - }; - OKButton PB_OK - { - 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 ] = "~Keep Link"; - }; - CancelButton PB_NO - { - Pos = MAP_APPFONT( AW_COL_3, AW_ROW_2 ); - Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); - Text [ en-US ] = "~Embed Graphic"; - }; - FixedLine FL_OPTION - { - Pos = MAP_APPFONT( 0, AW_ROW_3 ); - Size = MAP_APPFONT( DIALOG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT ); - }; - CheckBox 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 linking a graphic"; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/uiconfig/ui/linkwarndialog.ui b/svx/uiconfig/ui/linkwarndialog.ui new file mode 100644 index 000000000000..d263bd7e5374 --- /dev/null +++ b/svx/uiconfig/ui/linkwarndialog.ui @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkMessageDialog" id="LinkWarnDialog"> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="title" translatable="yes">Confirm Linked Graphic</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">The file %FILENAME will not be stored along with your document, but only referenced as a link.</property> + <property name="secondary_text" translatable="yes">This is dangerous if you move and/or rename the files. Do you want to embed the graphic instead?</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">_Keep Link</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_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">_Embed Graphic</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> + <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 linking a graphic</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> |