update dev300-m57
[ooovba.git] / applied_patches / 0615-linkwarn-svx-warning-dlg.diff
blob6b64c1343c0607e452c7e697fa22a17a63cc569f
1 --- svx/inc/svx/dialogs.hrc
2 +++ svx/inc/svx/dialogs.hrc
3 @@ -38,7 +38,7 @@
4 // Resource-Id's ------------------------------------------------------------
6 // Bitte FIRSTFREE pflegen!!! (gilt nicht f"ur Strings)
7 -#define RID_SVX_FIRSTFREE 305
8 +#define RID_SVX_FIRSTFREE 314
10 // ResId fuer die Hintergrund-TabPage
11 #define RID_SVXPAGE_BACKGROUND (RID_SVX_START + 1)
12 @@ -437,6 +437,7 @@
13 #define RID_SVXPAGE_IMPROVEMENT (RID_SVX_START + 302)
14 #define RID_SVXPAGE_EVENTASSIGN (RID_SVX_START + 303)
15 #define RID_SVXPAGE_CONFIGGROUPBOX (RID_SVX_START + 304)
16 +#define RID_SVXDLG_LINK_WARNING (RID_SVX_START + 313)
17 // !!! please update RID_SVX_FIRSTFREE !!! see line 46
19 // Strings ------------------------------------------------------------------
20 diff -urN ooo-build-anon/build/current/svx/inc/svx/linkwarn.hxx ooo-build/build/current/svx/inc/svx/linkwarn.hxx
21 --- svx/inc/svx/linkwarn.hxx 1970-01-01 01:00:00.000000000 +0100
22 +++ svx/inc/svx/linkwarn.hxx 2008-05-07 18:08:58.000000000 +0200
23 @@ -0,0 +1,61 @@
24 +/*************************************************************************
25 + *
26 + * OpenOffice.org - a multi-platform office productivity suite
27 + *
28 + * $RCSfile: linkwarn.hxx,v $
29 + *
30 + * $Revision: $
31 + *
32 + * last change: $Author: $ $Date: $
33 + *
34 + * The Contents of this file are made available subject to
35 + * the terms of GNU Lesser General Public License Version 2.1.
36 + *
37 + *
38 + * GNU Lesser General Public License Version 2.1
39 + * =============================================
40 + * Copyright 2005 by Sun Microsystems, Inc.
41 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
42 + *
43 + * This library is free software; you can redistribute it and/or
44 + * modify it under the terms of the GNU Lesser General Public
45 + * License version 2.1, as published by the Free Software Foundation.
46 + *
47 + * This library is distributed in the hope that it will be useful,
48 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50 + * Lesser General Public License for more details.
51 + *
52 + * You should have received a copy of the GNU Lesser General Public
53 + * License along with this library; if not, write to the Free Software
54 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
55 + * MA 02111-1307 USA
56 + *
57 + ************************************************************************/
58 +#ifndef _SFX_LINKWARN_HXX
59 +#define _SFX_LINKWARN_HXX
61 +#include <vcl/button.hxx>
62 +#include <vcl/fixed.hxx>
63 +#include <sfx2/basedlgs.hxx>
64 +#include "svx/svxdllapi.h"
66 +class SVX_DLLPUBLIC SvxLinkWarningDialog : public SfxModalDialog
68 +private:
69 + FixedImage m_aQueryImage;
70 + FixedText m_aInfoText;
71 + OKButton m_aLinkGraphicBtn;
72 + CancelButton m_aEmbedGraphicBtn;
73 + FixedLine m_aOptionLine;
74 + CheckBox m_aWarningOnBox;
76 + void InitSize();
78 +public:
79 + SvxLinkWarningDialog( Window* pParent, const String& _rFileName );
80 + virtual ~SvxLinkWarningDialog();
81 +};
83 +#endif // #ifndef _SFX_LINKWARN_HXX
85 diff -urN ooo-build-anon/build/current/svx/prj/d.lst ooo-build/build/current/svx/prj/d.lst
86 --- svx/prj/d.lst 2008-05-08 07:04:17.000000000 +0200
87 +++ svx/prj/d.lst 2008-05-07 15:27:21.000000000 +0200
88 @@ -53,6 +53,7 @@
89 ..\inc\charhiddenitem.hxx %_DEST%\inc%_EXT%\svx\charhiddenitem.hxx
90 ..\inc\svx\bmpmask.hxx %_DEST%\inc%_EXT%\svx\bmpmask.hxx
91 ..\inc\bolnitem.hxx %_DEST%\inc%_EXT%\svx\bolnitem.hxx
92 +..\inc\svx\linkwarn.hxx %_DEST%\inc%_EXT%\svx\linkwarn.hxx
93 ..\inc\svx\borderline.hxx %_DEST%\inc%_EXT%\svx\borderline.hxx
94 ..\inc\svx\boxitem.hxx %_DEST%\inc%_EXT%\svx\boxitem.hxx
95 ..\inc\svx\brkitem.hxx %_DEST%\inc%_EXT%\svx\brkitem.hxx
96 --- svx/source/dialog/linkwarn.cxx 1970-01-01 01:00:00.000000000 +0100
97 +++ svx/source/dialog/linkwarn.cxx 2008-05-07 18:12:55.000000000 +0200
98 @@ -0,0 +1,155 @@
99 +/*************************************************************************
101 + * OpenOffice.org - a multi-platform office productivity suite
103 + * $RCSfile: linkwarn.cxx,v $
105 + * $Revision: $
107 + * last change: $Author: $ $Date: $
109 + * The Contents of this file are made available subject to
110 + * the terms of GNU Lesser General Public License Version 2.1.
113 + * GNU Lesser General Public License Version 2.1
114 + * =============================================
115 + * Copyright 2005 by Sun Microsystems, Inc.
116 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
118 + * This library is free software; you can redistribute it and/or
119 + * modify it under the terms of the GNU Lesser General Public
120 + * License version 2.1, as published by the Free Software Foundation.
122 + * This library is distributed in the hope that it will be useful,
123 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
124 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
125 + * Lesser General Public License for more details.
127 + * You should have received a copy of the GNU Lesser General Public
128 + * License along with this library; if not, write to the Free Software
129 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
130 + * MA 02111-1307 USA
132 + ************************************************************************/
134 +// MARKER(update_precomp.py): autogen include statement, do not remove
135 +#include "precompiled_svx.hxx"
137 +#include "linkwarn.hrc"
138 +#include "svx/linkwarn.hxx"
139 +#include "svx/dialogs.hrc"
140 +#include "svx/dialmgr.hxx"
141 +#include <vcl/msgbox.hxx>
142 +#include <sfx2/basedlgs.hxx>
143 +#include <svtools/miscopt.hxx>
145 +SvxLinkWarningDialog::SvxLinkWarningDialog( Window* pParent, const String& _rFileName ) :
146 + SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_LINK_WARNING ) ),
147 + m_aQueryImage ( this, SVX_RES( FI_QUERY ) ),
148 + m_aInfoText ( this, SVX_RES( FT_INFOTEXT ) ),
149 + m_aLinkGraphicBtn ( this, SVX_RES( PB_OK ) ),
150 + m_aEmbedGraphicBtn ( this, SVX_RES( PB_NO ) ),
151 + m_aOptionLine ( this, SVX_RES( FL_OPTION ) ),
152 + m_aWarningOnBox ( this, SVX_RES( CB_WARNING_OFF ) )
154 + FreeResource();
156 + // set questionmark image
157 + m_aQueryImage.SetImage( QueryBox::GetStandardImage() );
159 + // replace filename
160 + String sInfoText = m_aInfoText.GetText();
161 + sInfoText.SearchAndReplaceAll(
162 + UniString::CreateFromAscii(
163 + RTL_CONSTASCII_STRINGPARAM( "%FILENAME" ) ), _rFileName );
164 + m_aInfoText.SetText( sInfoText );
166 + // load state of "warning on" checkbox from misc options
167 + SvtMiscOptions aMiscOpt;
168 + m_aWarningOnBox.Check( aMiscOpt.ShowLinkWarningDialog() == sal_True );
169 + if( aMiscOpt.IsShowLinkWarningDialogReadOnly() )
170 + m_aWarningOnBox.Disable();
172 + // set focus to Cancel button
173 + m_aEmbedGraphicBtn.GrabFocus();
175 + // calculate and set the size of the dialog and its controls
176 + InitSize();
179 +// -----------------------------------------------------------------------
181 +SvxLinkWarningDialog::~SvxLinkWarningDialog()
183 + // save value of "warning off" checkbox, if necessary
184 + SvtMiscOptions aMiscOpt;
185 + sal_Bool bChecked = m_aWarningOnBox.IsChecked();
186 + if ( aMiscOpt.ShowLinkWarningDialog() != bChecked )
187 + aMiscOpt.SetShowLinkWarningDialog( bChecked );
190 +// -----------------------------------------------------------------------
192 +void SvxLinkWarningDialog::InitSize()
194 + // text of checkbox to wide -> add new line
195 + long nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH;
196 + long nCtrlW = m_aWarningOnBox.GetSizePixel().Width();
197 + if ( nTxtW >= nCtrlW )
199 + long nTextHeight = m_aWarningOnBox.GetTextHeight();
200 + Size aNewSize = m_aWarningOnBox.GetSizePixel();
201 + aNewSize.Height() += nTextHeight;
202 + m_aWarningOnBox.SetSizePixel( aNewSize );
203 + aNewSize = GetSizePixel();
204 + aNewSize.Height() += nTextHeight;
205 + SetSizePixel( aNewSize );
208 + // align the size of the information text control (FixedText) to its content
209 + Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() );
210 + long nTxtH = aMinSize.Height();
211 + long nCtrlH = m_aInfoText.GetSizePixel().Height();
212 + long nDelta = ( nCtrlH - nTxtH );
213 + Size aNewSize = m_aInfoText.GetSizePixel();
214 + aNewSize.Height() -= nDelta;
215 + m_aInfoText.SetSizePixel( aNewSize );
217 + // new position for the succeeding windows
218 + Window* pWins[] =
220 + &m_aLinkGraphicBtn, &m_aEmbedGraphicBtn, &m_aOptionLine, &m_aWarningOnBox
221 + };
222 + Window** pCurrent = pWins;
223 + for ( sal_uInt32 i = 0; i < sizeof(pWins) / sizeof(*pWins); ++i, ++pCurrent )
225 + Point aNewPos = (*pCurrent)->GetPosPixel();
226 + aNewPos.Y() -= nDelta;
227 + (*pCurrent)->SetPosPixel( aNewPos );
230 + // new size of the dialog
231 + aNewSize = GetSizePixel();
232 + aNewSize.Height() -= nDelta;
233 + SetSizePixel( aNewSize );
235 + // recalculate the size and position of the buttons
236 + nTxtW = m_aLinkGraphicBtn.GetCtrlTextWidth( m_aLinkGraphicBtn.GetText() );
237 + long nTemp = m_aEmbedGraphicBtn.GetCtrlTextWidth( m_aEmbedGraphicBtn.GetText() );
238 + if ( nTemp > nTxtW )
239 + nTxtW = nTemp;
240 + nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
241 + Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
242 + Point aPos = m_aLinkGraphicBtn.GetPosPixel();
243 + aPos.X() = ( aNewSize.Width() - (2*nTxtW) - a3Size.Width() ) / 2;
244 + long nDefX = m_aWarningOnBox.GetPosPixel().X();
245 + if ( nDefX < aPos.X() )
246 + aPos.X() = nDefX;
247 + aNewSize = m_aLinkGraphicBtn.GetSizePixel();
248 + aNewSize.Width() = nTxtW;
249 + m_aLinkGraphicBtn.SetPosSizePixel( aPos, aNewSize );
250 + aPos.X() += nTxtW + a3Size.Width();
251 + m_aEmbedGraphicBtn.SetPosSizePixel( aPos, aNewSize );
254 diff -urN ooo-build-anon/build/current/svx/source/dialog/linkwarn.hrc ooo-build/build/current/svx/source/dialog/linkwarn.hrc
255 --- svx/source/dialog/linkwarn.hrc 1970-01-01 01:00:00.000000000 +0100
256 +++ svx/source/dialog/linkwarn.hrc 2008-05-07 17:21:30.000000000 +0200
257 @@ -0,0 +1,67 @@
258 +/*************************************************************************
260 + * OpenOffice.org - a multi-platform office productivity suite
262 + * $RCSfile: linkwarn.hrc,v $
264 + * $Revision: $
266 + * last change: $Author: $ $Date: $
268 + * The Contents of this file are made available subject to
269 + * the terms of GNU Lesser General Public License Version 2.1.
272 + * GNU Lesser General Public License Version 2.1
273 + * =============================================
274 + * Copyright 2005 by Sun Microsystems, Inc.
275 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
277 + * This library is free software; you can redistribute it and/or
278 + * modify it under the terms of the GNU Lesser General Public
279 + * License version 2.1, as published by the Free Software Foundation.
281 + * This library is distributed in the hope that it will be useful,
282 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
283 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
284 + * Lesser General Public License for more details.
286 + * You should have received a copy of the GNU Lesser General Public
287 + * License along with this library; if not, write to the Free Software
288 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
289 + * MA 02111-1307 USA
291 + ************************************************************************/
292 +#ifndef _SVX_LINKWARN_HRC
293 +#define _SVX_LINKWARN_HRC
295 +#include <svtools/controldims.hrc>
297 +// dialog ids
298 +#define FI_QUERY 10
299 +#define FT_INFOTEXT 11
300 +#define PB_OK 12
301 +#define PB_NO 13
302 +#define FL_OPTION 15
303 +#define CB_WARNING_OFF 16
305 +// --------- general metrics ---------
307 +#define SYMBOL_EDGE 20
308 +#define DIALOG_WIDTH 220
309 +#define INFO_TEXT_LINES 11
311 +#define AW_COL_1 (RSC_SP_DLG_INNERBORDER_LEFT)
312 +#define AW_COL_2 (AW_COL_1+SYMBOL_EDGE+RSC_SP_CTRL_DESC_X)
313 +#define AW_COL_3 (AW_COL_2+RSC_CD_PUSHBUTTON_WIDTH+RSC_SP_CTRL_DESC_X)
314 +#define AW_COL_4 (DIALOG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT-RSC_CD_PUSHBUTTON_WIDTH)
316 +#define AW_ROW_1 (RSC_SP_DLG_INNERBORDER_TOP)
317 +#define AW_ROW_2 (AW_ROW_1+INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_CTRL_Y)
318 +#define AW_ROW_3 (AW_ROW_2+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_CTRL_DESC_Y)
319 +#define AW_ROW_4 (AW_ROW_3+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
321 +#define DIALOG_HEIGHT (AW_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM)
323 +#endif
325 diff -urN ooo-build-anon/build/current/svx/source/dialog/linkwarn.src ooo-build/build/current/svx/source/dialog/linkwarn.src
326 --- svx/source/dialog/linkwarn.src 1970-01-01 01:00:00.000000000 +0100
327 +++ svx/source/dialog/linkwarn.src 2008-05-07 20:13:42.000000000 +0200
328 @@ -0,0 +1,94 @@
329 +/*************************************************************************
331 + * OpenOffice.org - a multi-platform office productivity suite
333 + * $RCSfile: linkwarn.src,v $
335 + * $Revision: $
337 + * last change: $Author: $ $Date: $
339 + * The Contents of this file are made available subject to
340 + * the terms of GNU Lesser General Public License Version 2.1.
343 + * GNU Lesser General Public License Version 2.1
344 + * =============================================
345 + * Copyright 2005 by Sun Microsystems, Inc.
346 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
348 + * This library is free software; you can redistribute it and/or
349 + * modify it under the terms of the GNU Lesser General Public
350 + * License version 2.1, as published by the Free Software Foundation.
352 + * This library is distributed in the hope that it will be useful,
353 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
354 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
355 + * Lesser General Public License for more details.
357 + * You should have received a copy of the GNU Lesser General Public
358 + * License along with this library; if not, write to the Free Software
359 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
360 + * MA 02111-1307 USA
362 + ************************************************************************/
364 +#include "linkwarn.hrc"
365 +#include "svx/dialogs.hrc"
366 +#include "helpid.hrc"
368 +ModalDialog RID_SVXDLG_LINK_WARNING
370 + Size = MAP_APPFONT( DIALOG_WIDTH, DIALOG_HEIGHT );
371 + OutputSize = TRUE;
372 + Closeable = FALSE;
373 + Moveable = TRUE;
374 + SVLook = TRUE;
376 + Text = "%PRODUCTNAME %PRODUCTVERSION %PRODUCTEXTENSION";
378 + FixedImage FI_QUERY
380 + Pos = MAP_APPFONT( AW_COL_1, AW_ROW_1 );
381 + Size = MAP_APPFONT( SYMBOL_EDGE, SYMBOL_EDGE );
382 + };
383 + FixedText FT_INFOTEXT
385 + Pos = MAP_APPFONT( AW_COL_2, AW_ROW_1 );
386 + Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, INFO_TEXT_LINES*RSC_CD_FIXEDTEXT_HEIGHT );
387 + NoLabel = TRUE;
388 + Wordbreak = TRUE;
389 + 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?";
390 + Text [ de-DE ] = "Die Datei %FILENAME wird nicht zusammen mit dem Dokument gespeichert, sondern nur als Verweis referenziert. Dies kann zu Problemen führen, wenn die Dateien verschoben und/oder umbenannt werden. Möchten Sie stattdessen die Grafik als eingebettetes Objekt einfügen?";
391 + };
392 + OKButton PB_OK
394 + Pos = MAP_APPFONT( AW_COL_2, AW_ROW_2 );
395 + Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
396 + DefButton = TRUE ;
397 + Text [ en-US ] = "~Keep Link";
398 + Text [ de-DE ] = "~Als Verweis einfügen";
399 + };
400 + CancelButton PB_NO
402 + Pos = MAP_APPFONT( AW_COL_3, AW_ROW_2 );
403 + Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
404 + Text [ en-US ] = "~Embed Graphic";
405 + Text [ de-DE ] = "~Eingebettet einfügen";
406 + };
407 + FixedLine FL_OPTION
409 + Pos = MAP_APPFONT( 0, AW_ROW_3 );
410 + Size = MAP_APPFONT( DIALOG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
411 + };
412 + CheckBox CB_WARNING_OFF
414 + Pos = MAP_APPFONT( AW_COL_2, AW_ROW_4 );
415 + Size = MAP_APPFONT( DIALOG_WIDTH-AW_COL_2-RSC_SP_DLG_INNERBORDER_RIGHT, RSC_CD_CHECKBOX_HEIGHT );
416 + WordBreak = TRUE ;
417 + Text [ en-US ] = "~Ask when linking a graphic";
418 + Text [ de-DE ] = "~Nachfragen falls Grafik als Verweis eingefügt wird";
419 + };
423 --- svx/source/dialog/makefile.mk
424 +++ svx/source/dialog/makefile.mk
425 @@ -83,6 +83,7 @@
426 langbox.src \
427 language.src \
428 lingu.src \
429 + linkwarn.src \
430 passwd.src \
431 prtqry.src \
432 rubydialog.src\
433 @@ -191,6 +192,7 @@
434 $(SLO)$/hyprlink.obj \
435 $(SLO)$/imapdlg.obj \
436 $(SLO)$/imapwnd.obj \
437 + $(SLO)$/linkwarn.obj \
438 $(SLO)$/measctrl.obj \
439 $(SLO)$/orienthelper.obj \
440 $(SLO)$/pagectrl.obj \