Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / desktop / source / app / cmdlineargs.hxx
blob94600ed409726a1d8d43c5523842ad971155d65d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DESKTOP_SOURCE_APP_CMDLINEARGS_HXX
21 #define INCLUDED_DESKTOP_SOURCE_APP_CMDLINEARGS_HXX
23 #include <sal/config.h>
25 #include <vector>
27 #include <rtl/ustring.hxx>
28 #include <boost/optional.hpp>
30 namespace desktop
33 class CommandLineArgs
35 public:
36 struct Supplier
38 // Thrown from constructors and next:
39 class Exception final
41 public:
42 Exception();
43 Exception(Exception const &);
44 ~Exception();
45 Exception & operator =(Exception const &);
48 virtual ~Supplier();
49 virtual boost::optional< OUString > getCwdUrl() = 0;
50 virtual bool next(OUString * argument) = 0;
53 CommandLineArgs();
54 explicit CommandLineArgs( Supplier& supplier );
56 CommandLineArgs(const CommandLineArgs&) = delete;
57 const CommandLineArgs& operator=(const CommandLineArgs&) = delete;
59 const boost::optional< OUString >& getCwdUrl() const { return m_cwdUrl; }
61 // Access to bool parameters
62 bool IsMinimized() const { return m_minimized;}
63 bool IsInvisible() const
65 return m_invisible || (m_headless && !m_eventtesting);
67 bool IsNoRestore() const { return m_norestore;}
68 bool IsNoDefault() const { return m_nodefault;}
69 bool IsHeadless() const { return m_headless;}
70 bool IsEventTesting() const { return m_eventtesting;}
71 bool IsQuickstart() const { return m_quickstart;}
72 bool IsNoQuickstart() const { return m_noquickstart;}
73 bool IsTerminateAfterInit() const { return m_terminateafterinit;}
74 bool IsNoLogo() const { return m_nologo;}
75 bool IsNoLockcheck() const { return m_nolockcheck;}
76 bool IsHelp() const { return m_help;}
77 bool IsHelpWriter() const { return m_helpwriter;}
78 bool IsHelpCalc() const { return m_helpcalc;}
79 bool IsHelpDraw() const { return m_helpdraw;}
80 bool IsHelpImpress() const { return m_helpimpress;}
81 bool IsHelpBase() const { return m_helpbase;}
82 bool IsHelpMath() const { return m_helpmath;}
83 bool IsHelpBasic() const { return m_helpbasic;}
84 bool IsWriter() const { return m_writer;}
85 bool IsCalc() const { return m_calc;}
86 bool IsDraw() const { return m_draw;}
87 bool IsImpress() const { return m_impress;}
88 bool IsBase() const { return m_base;}
89 bool IsGlobal() const { return m_global;}
90 bool IsMath() const { return m_math;}
91 bool IsWeb() const { return m_web;}
92 bool IsVersion() const { return m_version;}
93 bool HasModuleParam() const;
94 bool WantsToLoadDocument() const { return m_bDocumentArgs;}
95 bool IsTextCat() const { return m_textcat;}
96 bool IsScriptCat() const { return m_scriptcat;}
97 bool IsSafeMode() const { return m_safemode; }
99 const OUString& GetUnknown() const { return m_unknown;}
101 // Access to string parameters
102 bool HasSplashPipe() const { return m_splashpipe;}
103 std::vector< OUString > const & GetAccept() const { return m_accept;}
104 std::vector< OUString > const & GetUnaccept() const { return m_unaccept;}
105 std::vector< OUString > GetOpenList() const;
106 std::vector< OUString > GetViewList() const;
107 std::vector< OUString > GetStartList() const;
108 std::vector< OUString > GetForceOpenList() const;
109 std::vector< OUString > GetForceNewList() const;
110 std::vector< OUString > GetPrintList() const;
111 std::vector< OUString > GetPrintToList() const;
112 const OUString& GetPrinterName() const { return m_printername;}
113 const OUString& GetLanguage() const { return m_language;}
114 std::vector< OUString > const & GetInFilter() const { return m_infilter;}
115 std::vector< OUString > GetConversionList() const;
116 const OUString& GetConversionParams() const { return m_conversionparams;}
117 OUString GetConversionOut() const;
118 OUString const & GetImageConversionType() const { return m_convertimages; }
119 const OUString& GetPidfileName() const { return m_pidfile;}
121 // Special analyzed states (does not match directly to a command line parameter!)
122 bool IsEmpty() const { return m_bEmpty;}
124 void setHeadless() { m_headless = true; }
126 private:
127 void ParseCommandLine_Impl( Supplier& supplier );
128 void InitParamValues();
130 boost::optional< OUString > m_cwdUrl;
132 bool m_minimized;
133 bool m_invisible;
134 bool m_norestore;
135 bool m_headless;
136 bool m_eventtesting;
137 bool m_quickstart;
138 bool m_noquickstart;
139 bool m_terminateafterinit;
140 bool m_nologo;
141 bool m_nolockcheck;
142 bool m_nodefault;
143 bool m_help;
144 bool m_writer;
145 bool m_calc;
146 bool m_draw;
147 bool m_impress;
148 bool m_global;
149 bool m_math;
150 bool m_web;
151 bool m_base;
152 bool m_helpwriter;
153 bool m_helpcalc;
154 bool m_helpdraw;
155 bool m_helpbasic;
156 bool m_helpmath;
157 bool m_helpimpress;
158 bool m_helpbase;
159 bool m_version;
160 bool m_splashpipe;
161 bool m_textcat;
162 bool m_scriptcat;
163 bool m_safemode;
165 OUString m_unknown;
167 bool m_bEmpty; // No Args at all
168 bool m_bDocumentArgs; // A document creation/open/load arg is used
169 std::vector< OUString > m_accept;
170 std::vector< OUString > m_unaccept;
171 std::vector< OUString > m_openlist; // contains external URIs
172 std::vector< OUString > m_viewlist; // contains external URIs
173 std::vector< OUString > m_startlist; // contains external URIs
174 std::vector< OUString > m_forceopenlist; // contains external URIs
175 std::vector< OUString > m_forcenewlist; // contains external URIs
176 std::vector< OUString > m_printlist; // contains external URIs
177 std::vector< OUString > m_printtolist; // contains external URIs
178 OUString m_printername;
179 std::vector< OUString > m_conversionlist; // contains external URIs
180 OUString m_conversionparams;
181 OUString m_conversionout; // contains external URIs
182 OUString m_convertimages; // The format in which images should be converted
183 std::vector< OUString > m_infilter;
184 OUString m_language;
185 OUString m_pidfile;
190 #endif
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */