Branch data 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 : : #include "sfx2/QuerySaveDocument.hxx"
21 : :
22 : : #include <sfx2/sfx.hrc>
23 : : #include "sfx2/sfxresid.hxx"
24 : : #include <sfx2/sfxuno.hxx>
25 : : #include "doc.hrc"
26 : : #include <vcl/msgbox.hxx>
27 : : #include <vcl/svapp.hxx>
28 : : // -----------------------------------------------------------------------------
29 : 0 : short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle)
30 : : {
31 [ # # ][ # # ]: 0 : if (Application::IsHeadlessModeEnabled())
32 : : { // don't block Desktop::terminate() if there's no user to ask
33 : 0 : return RET_NO;
34 : : }
35 [ # # ][ # # ]: 0 : String aText( SfxResId(STR_QUERY_SAVE_DOCUMENT).toString() );
[ # # ]
36 : : aText.SearchAndReplace( DEFINE_CONST_UNICODE( "$(DOC)" ),
37 [ # # ][ # # ]: 0 : _rTitle );
[ # # ]
38 [ # # ]: 0 : QueryBox aQBox( _pParent, WB_YES_NO_CANCEL | WB_DEF_YES, aText );
39 [ # # ][ # # ]: 0 : aQBox.SetButtonText( BUTTONID_NO, SfxResId(STR_NOSAVEANDCLOSE).toString() );
[ # # ][ # # ]
[ # # ]
40 [ # # ][ # # ]: 0 : aQBox.SetButtonText( BUTTONID_YES, SfxResId(STR_SAVEDOC).toString() );
[ # # ][ # # ]
[ # # ]
41 [ # # ][ # # ]: 0 : return aQBox.Execute();
[ # # ]
42 : : }
43 : : // -----------------------------------------------------------------------------
44 : :
45 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|