Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _DESKTOP_COMMANDLINEARGS_HXX_
30 : : #define _DESKTOP_COMMANDLINEARGS_HXX_
31 : :
32 : : #include "sal/config.h"
33 : :
34 : : #include <vector>
35 : :
36 : : #include <rtl/ustring.hxx>
37 : : #include "boost/noncopyable.hpp"
38 : : #include "boost/optional.hpp"
39 : :
40 : : namespace desktop
41 : : {
42 : :
43 [ + - ]: 158 : class CommandLineArgs: private boost::noncopyable
44 : : {
45 : : public:
46 : 158 : struct Supplier
47 : : {
48 : : // Thrown from constructors and next:
49 : : class Exception {
50 : : public:
51 : : Exception();
52 : : Exception(Exception const &);
53 : : virtual ~Exception();
54 : : Exception & operator =(Exception const &);
55 : : };
56 : :
57 : : virtual ~Supplier();
58 : : virtual boost::optional< rtl::OUString > getCwdUrl() = 0;
59 : : virtual bool next(rtl::OUString * argument) = 0;
60 : : };
61 : :
62 : : CommandLineArgs();
63 : : CommandLineArgs( Supplier& supplier );
64 : :
65 : 96 : boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; }
66 : :
67 : : // Access to bool parameters
68 : : bool IsMinimized() const;
69 : : bool IsInvisible() const;
70 : : bool IsNoRestore() const;
71 : : bool IsNoDefault() const;
72 : : bool IsHeadless() const;
73 : : bool IsQuickstart() const;
74 : : bool IsNoQuickstart() const;
75 : : bool IsTerminateAfterInit() const;
76 : : bool IsNoLogo() const;
77 : : bool IsNoLockcheck() const;
78 : : bool IsHelp() const;
79 : : bool IsHelpWriter() const;
80 : : bool IsHelpCalc() const;
81 : : bool IsHelpDraw() const;
82 : : bool IsHelpImpress() const;
83 : : bool IsHelpBase() const;
84 : : bool IsHelpMath() const;
85 : : bool IsHelpBasic() const;
86 : : bool IsWriter() const;
87 : : bool IsCalc() const;
88 : : bool IsDraw() const;
89 : : bool IsImpress() const;
90 : : bool IsBase() const;
91 : : bool IsGlobal() const;
92 : : bool IsMath() const;
93 : : bool IsWeb() const;
94 : : bool IsVersion() const;
95 : : bool HasModuleParam() const;
96 : : bool HasUnknown() const;
97 : : bool WantsToLoadDocument() const;
98 : :
99 : : // Access to string parameters
100 : : bool HasSplashPipe() const;
101 : : std::vector< rtl::OUString > const & GetAccept() const;
102 : : std::vector< rtl::OUString > const & GetUnaccept() const;
103 : : std::vector< rtl::OUString > GetOpenList() const;
104 : : std::vector< rtl::OUString > GetViewList() const;
105 : : std::vector< rtl::OUString > GetStartList() const;
106 : : std::vector< rtl::OUString > GetForceOpenList() const;
107 : : std::vector< rtl::OUString > GetForceNewList() const;
108 : : std::vector< rtl::OUString > GetPrintList() const;
109 : : std::vector< rtl::OUString > GetPrintToList() const;
110 : : rtl::OUString GetPrinterName() const;
111 : : rtl::OUString GetLanguage() const;
112 : : std::vector< rtl::OUString > const & GetInFilter() const;
113 : : std::vector< rtl::OUString > GetConversionList() const;
114 : : rtl::OUString GetConversionParams() const;
115 : : rtl::OUString GetConversionOut() const;
116 : :
117 : : // Special analyzed states (does not match directly to a command line parameter!)
118 : : bool IsEmpty() const;
119 : :
120 : : private:
121 : : bool InterpretCommandLineParameter( const ::rtl::OUString&, ::rtl::OUString& );
122 : : void ParseCommandLine_Impl( Supplier& supplier );
123 : : void InitParamValues();
124 : :
125 : : boost::optional< rtl::OUString > m_cwdUrl;
126 : :
127 : : bool m_minimized;
128 : : bool m_invisible;
129 : : bool m_norestore;
130 : : bool m_headless;
131 : : bool m_quickstart;
132 : : bool m_noquickstart;
133 : : bool m_terminateafterinit;
134 : : bool m_nofirststartwizard;
135 : : bool m_nologo;
136 : : bool m_nolockcheck;
137 : : bool m_nodefault;
138 : : bool m_help;
139 : : bool m_writer;
140 : : bool m_calc;
141 : : bool m_draw;
142 : : bool m_impress;
143 : : bool m_global;
144 : : bool m_math;
145 : : bool m_web;
146 : : bool m_base;
147 : : bool m_helpwriter;
148 : : bool m_helpcalc;
149 : : bool m_helpdraw;
150 : : bool m_helpbasic;
151 : : bool m_helpmath;
152 : : bool m_helpimpress;
153 : : bool m_helpbase;
154 : : bool m_psn;
155 : : bool m_version;
156 : : bool m_unknown;
157 : : bool m_splashpipe;
158 : :
159 : : bool m_bEmpty; // No Args at all
160 : : bool m_bDocumentArgs; // A document creation/open/load arg is used
161 : : std::vector< rtl::OUString > m_accept;
162 : : std::vector< rtl::OUString > m_unaccept;
163 : : std::vector< rtl::OUString > m_openlist; // contains external URIs
164 : : std::vector< rtl::OUString > m_viewlist; // contains external URIs
165 : : std::vector< rtl::OUString > m_startlist; // contains external URIs
166 : : std::vector< rtl::OUString > m_forceopenlist; // contains external URIs
167 : : std::vector< rtl::OUString > m_forcenewlist; // contains external URIs
168 : : std::vector< rtl::OUString > m_printlist; // contains external URIs
169 : : std::vector< rtl::OUString > m_printtolist; // contains external URIs
170 : : rtl::OUString m_printername;
171 : : std::vector< rtl::OUString > m_conversionlist; // contains external URIs
172 : : rtl::OUString m_conversionparams;
173 : : rtl::OUString m_conversionout; // contains external URIs
174 : : std::vector< rtl::OUString > m_infilter;
175 : : rtl::OUString m_language;
176 : : };
177 : :
178 : : }
179 : :
180 : : #endif
181 : :
182 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|