Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / sfx2 / source / doc / QuerySaveDocument.cxx
blob7ac2b6771809523dcd7e3d983ef9cb1f7d999b69
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "sfx2/QuerySaveDocument.hxx"
31 #include <sfx2/sfx.hrc>
32 #include "sfx2/sfxresid.hxx"
33 #include <sfx2/sfxuno.hxx>
34 #include "doc.hrc"
35 #include <vcl/msgbox.hxx>
36 #include <vcl/svapp.hxx>
37 // -----------------------------------------------------------------------------
38 short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle)
40 if (Application::IsHeadlessModeEnabled())
41 { // don't block Desktop::terminate() if there's no user to ask
42 return RET_NO;
44 String aText( SfxResId( STR_QUERY_SAVE_DOCUMENT ) );
45 aText.SearchAndReplace( DEFINE_CONST_UNICODE( "$(DOC)" ),
46 _rTitle );
47 QueryBox aQBox( _pParent, WB_YES_NO_CANCEL | WB_DEF_YES, aText );
48 aQBox.SetButtonText( BUTTONID_NO, SfxResId( STR_NOSAVEANDCLOSE ) );
49 aQBox.SetButtonText( BUTTONID_YES, SfxResId( STR_SAVEDOC ) );
50 return aQBox.Execute();
52 // -----------------------------------------------------------------------------
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */