/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #ifdef UNX #include #endif #include #include #include #include #include #include "desktopresid.hxx" #include "desktop.hrc" #include "cmdlinehelp.hxx" namespace desktop { // to be able to display the help nicely in a dialog box with propotional font, // we need to split it in chunks... // ___HEAD___ // LEFT RIGHT // LEFT RIGHT // LEFT RIGHT // __BOTTOM__ // [OK] const char aCmdLineHelp_version[] = "%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION %BUILDID\n"\ "\n"; const char aCmdLineHelp_head[] = "Usage: %CMDNAME [options] [documents...]\n"\ "\n"\ "Options:\n"; const char aCmdLineHelp_left[] = "--minimized \n"\ "--invisible \n"\ "--norestore \n"\ "--quickstart \n"\ "--nologo \n"\ "--nolockcheck \n"\ "--nodefault \n"\ "--headless \n"\ "--help/-h/-? \n"\ "--version \n"\ "--writer \n"\ "--calc \n"\ "--draw \n"\ "--impress \n"\ "--base \n"\ "--math \n"\ "--global \n"\ "--web \n"\ "-o \n"\ "-n \n"; const char aCmdLineHelp_right[] = "keep startup bitmap minimized.\n"\ "no startup screen, no default document and no UI.\n"\ "suppress restart/restore after fatal errors.\n"\ "starts the quickstart service\n"\ "don't show startup screen.\n"\ "don't check for remote instances using the installation\n"\ "don't start with an empty document\n"\ "like invisible but no userinteraction at all.\n"\ "show this message and exit.\n"\ "display the version information.\n"\ "create new text document.\n"\ "create new spreadsheet document.\n"\ "create new drawing.\n"\ "create new presentation.\n"\ "create new database.\n"\ "create new formula.\n"\ "create new global document.\n"\ "create new HTML document.\n"\ "open documents regardless whether they are templates or not.\n"\ "always open documents as new files (use as template).\n"; const char aCmdLineHelp_bottom[] = "--display \n"\ " Specify X-Display to use in Unix/X11 versions.\n" "-p \n"\ " print the specified documents on the default printer.\n"\ "--pt \n"\ " print the specified documents on the specified printer.\n"\ "--view \n"\ " open the specified documents in viewer-(readonly-)mode.\n"\ "--show \n"\ " open the specified presentation and start it immediately\n"\ "--accept=\n"\ " Specify an UNO connect-string to create an UNO acceptor through which\n"\ " other programs can connect to access the API\n"\ "--unaccept=\n"\ " Close an acceptor that was created with --accept=\n"\ " Use --unnaccept=all to close all open acceptors\n"\ "--infilter=[:filter_options]\n"\ " Force an input filter type if possible\n"\ " Eg. --infilter=\"Calc Office Open XML\"\n"\ " --infilter=\"Text (encoded):UTF8,LF,,,\"\n"\ "--convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir output_dir] files\n"\ " Batch convert files.\n"\ " If --outdir is not specified then current working dir is used as output_dir.\n"\ " Eg. --convert-to pdf *.doc\n"\ " --convert-to pdf:writer_pdf_Export --outdir /home/user *.doc\n"\ " --convert-to \"html:XHTML Writer File:UTF8\" *.doc\n"\ " --convert-to \"txt:Text (encoded):UTF8\" *.doc\n"\ "--print-to-file [-printer-name printer_name] [--outdir output_dir] files\n"\ " Batch print files to file.\n"\ " If --outdir is not specified then current working dir is used as output_dir.\n"\ " Eg. --print-to-file *.doc\n"\ " --print-to-file --printer-name nasty_lowres_printer --outdir /home/user *.doc\n"\ "--pidfile file\n"\ " Store soffice.bin pid to file.\n"\ "-env:[=]\n"\ " Set a bootstrap variable.\n"\ " Eg. -env:UserInstallation=file:///tmp/test to set a non-default user profile path.\n"\ "\nRemaining arguments will be treated as filenames or URLs of documents to open.\n\n"; OUString ReplaceStringHookProc(const OUString& rStr); void displayCmdlineHelp(OUString const & unknown) { // if you put variables in other chunks don't forget to call the replace routines // for those chunks... OUString aHelpMessage_version = OUString::createFromAscii(aCmdLineHelp_version); OUString aHelpMessage_head = OUString::createFromAscii(aCmdLineHelp_head); OUString aHelpMessage_left = OUString::createFromAscii(aCmdLineHelp_left); OUString aHelpMessage_right = OUString::createFromAscii(aCmdLineHelp_right); OUString aHelpMessage_bottom = OUString::createFromAscii(aCmdLineHelp_bottom); aHelpMessage_version = ReplaceStringHookProc(aHelpMessage_version); aHelpMessage_head = aHelpMessage_head.replaceFirst( "%CMDNAME", "soffice" ); if (!unknown.isEmpty()) { aHelpMessage_head = "Unknown option: " + unknown + "\n\n" + aHelpMessage_head; } #ifdef UNX // on unix use console for output fprintf(stdout, "%s%s", OUStringToOString(aHelpMessage_version, RTL_TEXTENCODING_ASCII_US).getStr(), OUStringToOString(aHelpMessage_head, RTL_TEXTENCODING_ASCII_US).getStr()); // merge left and right column sal_Int32 n = comphelper::string::getTokenCount(aHelpMessage_left, '\n'); OString bsLeft(OUStringToOString(aHelpMessage_left, RTL_TEXTENCODING_ASCII_US)); OString bsRight(OUStringToOString(aHelpMessage_right, RTL_TEXTENCODING_ASCII_US)); for ( sal_Int32 i = 0; i < n; ++i ) { using comphelper::string::getToken; fprintf(stdout, "%s", getToken(bsLeft, i, '\n').getStr()); fprintf(stdout, "%s\n", getToken(bsRight, i, '\n').getStr()); } fprintf(stdout, "%s", OUStringToOString(aHelpMessage_bottom, RTL_TEXTENCODING_ASCII_US).getStr()); #else // rest gets a dialog box CmdlineHelpDialog aDlg; aDlg.m_pftHead->SetText(aHelpMessage_version + aHelpMessage_head); aDlg.m_pftLeft->SetText(aHelpMessage_left); aDlg.m_pftRight->SetText(aHelpMessage_right); aDlg.m_pftBottom->SetText(aHelpMessage_bottom); aDlg.Execute(); #endif } void displayVersion() { OUString aVersionMsg(aCmdLineHelp_version); aVersionMsg = ReplaceStringHookProc(aVersionMsg); #ifdef UNX fprintf(stdout, "%s", OUStringToOString(aVersionMsg, RTL_TEXTENCODING_ASCII_US).getStr()); #else // Just re-use the help dialog for now. CmdlineHelpDialog aDlg; aDlg.m_pftHead->SetText(aVersionMsg); aDlg.m_pftLeft->SetText(""); aDlg.m_pftRight->SetText(""); aDlg.m_pftBottom->SetText(""); aDlg.Execute(); #endif } #ifndef UNX CmdlineHelpDialog::CmdlineHelpDialog (void) : ModalDialog( NULL, "CmdLineHelp", "desktop/ui/cmdlinehelp.ui" ) { get(m_pftHead, "header"); get(m_pftLeft, "left"); get(m_pftRight, "right"); get(m_pftBottom, "bottom"); } #endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ption> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2017-02-18loplugin:vclwidgets check for assigning from VclPt<T> to T*Noel Grandin
2016-07-28vcl: Guard against invalid statesSamuel Mehrbrodt
2016-06-17convert DBG_ASSERT in vclNoel Grandin
2016-04-18clean-up: unused using declarations and includesJochen Nitschke
2016-04-12clang-tidy performance-unnecessary-value-param in vclNoel Grandin
2016-03-16loplugin:constantparams in vcl/Noel Grandin
2016-03-08Bin unneeded inclusions of dbggui.hxxTor Lillqvist
2016-02-13vcl: include vcl headers via triangular brackets instead of quotesChris Sherlock
2016-02-10Don't fall back to Tool Bar as accessible name for toolbarsNiklas Johansson
2016-01-25git: rename dndlcon.{hxx|cxx} to dndlistenercontainer.{hxx|cxx}Chris Sherlock
2016-01-25vcl: move dndevdis.{hxx|cxx} to dndeventdispatcher.{hxx|cxx}Chris Sherlock
2016-01-08vcl: change ImplFontEntry to LogicalFontInstanceChris Sherlock
2016-01-07vcl: rename outfont.hxx to fontentry.hxxChris Sherlock
2015-11-18com::sun::star->css in vcl/Noel Grandin
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
2015-08-11loplugin: defaultparamsNoel Grandin
2015-05-22convert WINDOW constants for GetWindow() methods to scoped enumNoel Grandin
2015-04-10vclwidget: change all vcl::window fields to be wrapped in VclPtrNoel Grandin
2015-04-09prophylactic double dispose audit.Michael Meeks
2015-03-26const_cast: convert some C-style casts and remove some redundant onesStephan Bergmann
2015-02-03vcl: Remove commented-out codeAdolfo Jayme Barrientos
2015-01-14do TODO: replace ImplCallEventListeners() by CallEventListeners() in vclCaolán McNamara
2014-11-01vcl/source: get rid of redundant svsys.h includesDouglas Mencken
2014-09-29loplugin: cstylecastNoel Grandin
2014-09-23fdo#82577: Handle WindowNoel Grandin
2014-09-10vcl: sal_Bool -> boolStephan Bergmann
2014-05-27use namespace css instead of com::sunThomas Arnhold
2014-05-13VCL: Move accessibility functions to accessibility.cxxChris Sherlock