LibreOffice Module desktop (master) 1
cmdlineargs.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/config.h>
23
24#include <vector>
25
26#include <rtl/ustring.hxx>
27#include <optional>
28
29namespace desktop
30{
31
33{
34 public:
35 struct Supplier
36 {
37 // Thrown from constructors and next:
38 class Exception final
39 {
40 public:
41 Exception();
42 Exception(Exception const &);
44 };
45
46 virtual ~Supplier();
47 virtual std::optional< OUString > getCwdUrl() = 0;
48 virtual bool next(OUString * argument) = 0;
49 };
50
52 explicit CommandLineArgs( Supplier& supplier );
53
55 const CommandLineArgs& operator=(const CommandLineArgs&) = delete;
56
57 const std::optional< OUString >& getCwdUrl() const { return m_cwdUrl; }
58
59 // Access to bool parameters
60 bool IsMinimized() const { return m_minimized;}
61 bool IsInvisible() const
62 {
64 }
65 bool IsNoRestore() const { return m_norestore;}
66 bool IsNoDefault() const { return m_nodefault;}
67 bool IsHeadless() const { return m_headless;}
68 bool IsEventTesting() const { return m_eventtesting;}
69 bool IsQuickstart() const { return m_quickstart;}
70 bool IsNoQuickstart() const { return m_noquickstart;}
72 bool IsNoLogo() const { return m_nologo;}
73 bool IsNoLockcheck() const { return m_nolockcheck;}
74 bool IsHelp() const { return m_help;}
75 bool IsHelpWriter() const { return m_helpwriter;}
76 bool IsHelpCalc() const { return m_helpcalc;}
77 bool IsHelpDraw() const { return m_helpdraw;}
78 bool IsHelpImpress() const { return m_helpimpress;}
79 bool IsHelpBase() const { return m_helpbase;}
80 bool IsHelpMath() const { return m_helpmath;}
81 bool IsHelpBasic() const { return m_helpbasic;}
82 bool IsWriter() const { return m_writer;}
83 bool IsCalc() const { return m_calc;}
84 bool IsDraw() const { return m_draw;}
85 bool IsImpress() const { return m_impress;}
86 bool IsBase() const { return m_base;}
87 bool IsGlobal() const { return m_global;}
88 bool IsMath() const { return m_math;}
89 bool IsWeb() const { return m_web;}
90 bool IsVersion() const { return m_version;}
91 bool HasModuleParam() const;
92 bool WantsToLoadDocument() const { return m_bDocumentArgs;}
93 bool IsTextCat() const { return m_textcat;}
94 bool IsScriptCat() const { return m_scriptcat;}
95 bool IsSafeMode() const { return m_safemode; }
96
97 const OUString& GetUnknown() const { return m_unknown;}
98
99 // Access to string parameters
100 bool HasSplashPipe() const { return m_splashpipe;}
101 std::vector< OUString > const & GetAccept() const { return m_accept;}
102 std::vector< OUString > const & GetUnaccept() const { return m_unaccept;}
103 std::vector< OUString > GetOpenList() const;
104 std::vector< OUString > GetViewList() const;
105 std::vector< OUString > GetStartList() const;
106 std::vector< OUString > GetForceOpenList() const;
107 std::vector< OUString > GetForceNewList() const;
108 std::vector< OUString > GetPrintList() const;
109 std::vector< OUString > GetPrintToList() const;
110 const OUString& GetPrinterName() const { return m_printername;}
111 const OUString& GetLanguage() const { return m_language;}
112 std::vector< OUString > const & GetInFilter() const { return m_infilter;}
113 std::vector< OUString > GetConversionList() const;
114 const OUString& GetConversionParams() const { return m_conversionparams;}
115 OUString GetConversionOut() const;
116 OUString const & GetImageConversionType() const { return m_convertimages; }
117 const OUString& GetPidfileName() const { return m_pidfile;}
118
119 // Special analyzed states (does not match directly to a command line parameter!)
120 bool IsEmpty() const { return m_bEmpty;}
121
122 void setHeadless() { m_headless = true; }
123
124 private:
125 void ParseCommandLine_Impl( Supplier& supplier );
126 void InitParamValues();
127
128 std::optional< OUString > m_cwdUrl;
129
141 bool m_help;
143 bool m_calc;
144 bool m_draw;
147 bool m_math;
148 bool m_web;
149 bool m_base;
162
163 OUString m_unknown;
164
165 bool m_bEmpty; // No Args at all
166 bool m_bDocumentArgs; // A document creation/open/load arg is used
167 std::vector< OUString > m_accept;
168 std::vector< OUString > m_unaccept;
169 std::vector< OUString > m_openlist; // contains external URIs
170 std::vector< OUString > m_viewlist; // contains external URIs
171 std::vector< OUString > m_startlist; // contains external URIs
172 std::vector< OUString > m_forceopenlist; // contains external URIs
173 std::vector< OUString > m_forcenewlist; // contains external URIs
174 std::vector< OUString > m_printlist; // contains external URIs
175 std::vector< OUString > m_printtolist; // contains external URIs
177 std::vector< OUString > m_conversionlist; // contains external URIs
179 OUString m_conversionout; // contains external URIs
180 OUString m_convertimages; // The format in which images should be converted
181 std::vector< OUString > m_infilter;
182 OUString m_language;
183 OUString m_pidfile;
184};
185
186}
187
188/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Exception & operator=(Exception const &)
std::vector< OUString > GetForceNewList() const
std::vector< OUString > m_unaccept
bool IsTerminateAfterInit() const
Definition: cmdlineargs.hxx:71
std::vector< OUString > m_openlist
const OUString & GetLanguage() const
std::vector< OUString > m_infilter
std::vector< OUString > GetConversionList() const
std::vector< OUString > m_printtolist
bool IsNoLockcheck() const
Definition: cmdlineargs.hxx:73
std::vector< OUString > m_forceopenlist
std::vector< OUString > m_accept
const OUString & GetPrinterName() const
OUString const & GetImageConversionType() const
OUString GetConversionOut() const
std::vector< OUString > GetViewList() const
std::vector< OUString > GetStartList() const
std::vector< OUString > const & GetAccept() const
std::vector< OUString > GetPrintList() const
std::vector< OUString > m_conversionlist
std::vector< OUString > m_startlist
std::vector< OUString > GetForceOpenList() const
const OUString & GetUnknown() const
Definition: cmdlineargs.hxx:97
const CommandLineArgs & operator=(const CommandLineArgs &)=delete
std::vector< OUString > m_printlist
bool IsEventTesting() const
Definition: cmdlineargs.hxx:68
std::vector< OUString > m_viewlist
const std::optional< OUString > & getCwdUrl() const
Definition: cmdlineargs.hxx:57
std::vector< OUString > GetPrintToList() const
std::vector< OUString > GetOpenList() const
bool IsNoQuickstart() const
Definition: cmdlineargs.hxx:70
bool WantsToLoadDocument() const
Definition: cmdlineargs.hxx:92
CommandLineArgs(const CommandLineArgs &)=delete
std::optional< OUString > m_cwdUrl
void ParseCommandLine_Impl(Supplier &supplier)
std::vector< OUString > const & GetInFilter() const
const OUString & GetPidfileName() const
std::vector< OUString > m_forcenewlist
bool IsHelpImpress() const
Definition: cmdlineargs.hxx:78
const OUString & GetConversionParams() const
std::vector< OUString > const & GetUnaccept() const
Definition: app.cxx:165
virtual bool next(OUString *argument)=0
virtual std::optional< OUString > getCwdUrl()=0