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