From 2994ed75378601e61b457e9bee3c6a303997a701 Mon Sep 17 00:00:00 2001 From: Rüdiger Timm Date: Tue, 8 Apr 2003 14:50:32 +0000 Subject: INTEGRATION: CWS sal02 (1.1.2); FILE ADDED 2003/03/20 12:10:58 tra 1.1.2.1: #88865#added some path helper functions --- sal/osl/w32/path_helper.cxx | 157 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sal/osl/w32/path_helper.cxx (limited to 'sal') diff --git a/sal/osl/w32/path_helper.cxx b/sal/osl/w32/path_helper.cxx new file mode 100644 index 000000000000..ba895e74ed23 --- /dev/null +++ b/sal/osl/w32/path_helper.cxx @@ -0,0 +1,157 @@ +/************************************************************************* + * + * $RCSfile: path_helper.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2003-04-08 15:50:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +/******************************************************************* + Includes + ******************************************************************/ + +#ifndef _PATH_HELPER_HXX_ +#include "path_helper.hxx" +#endif + +#ifndef _OSL_DIAGNOSE_H_ +#include +#endif + +#ifndef _RTL_OUSTRING_HXX_ +#include +#endif + +#include +#include + +/******************************************************************* + Constants + ******************************************************************/ + +const rtl::OUString BACKSLASH = rtl::OUString::createFromAscii("\\"); +const rtl::OUString SLASH = rtl::OUString::createFromAscii("/"); + +/******************************************************************* + osl_systemPathEnsureSeparator + ******************************************************************/ + +void osl_systemPathEnsureSeparator(/*inout*/ rtl_uString** ppustrPath) +{ + OSL_PRECOND(ppustrPath && (NULL != *ppustrPath), \ + "osl_systemPathEnsureSeparator: Invalid parameter"); + + rtl::OUString path(*ppustrPath); + sal_Int32 i = std::max(path.lastIndexOf(BACKSLASH), path.lastIndexOf(SLASH)); + + if (i < (path.getLength()-1)) + { + path += BACKSLASH; + rtl_uString_assign(ppustrPath, path.pData); + } + + OSL_POSTCOND(path.lastIndexOf(BACKSLASH) == (path.getLength() - 1), \ + "osl_systemPathEnsureSeparator: Post condition failed"); +} + +/******************************************************************* + osl_systemPathRemoveSeparator + ******************************************************************/ + +void SAL_CALL osl_systemPathRemoveSeparator(/*inout*/ rtl_uString** ppustrPath) +{ + rtl::OUString path(*ppustrPath); + + if (!osl::systemPathIsLogicalDrivePattern(path)) + { + sal_Int32 i = std::max(path.lastIndexOf(BACKSLASH), path.lastIndexOf(SLASH)); + + if (i > -1 && (i == (path.getLength() - 1))) + { + path = rtl::OUString(path.getStr(), path.getLength() - 1); + rtl_uString_assign(ppustrPath, path.pData); + } + } +} + +/******************************************************************* + osl_is_logical_drive_pattern + ******************************************************************/ + +// is [A-Za-z]:[/|\]\0 +const sal_Unicode* LDP = L":"; +const sal_Unicode* LDP_WITH_BACKSLASH = L":\\"; +const sal_Unicode* LDP_WITH_SLASH = L":/"; + +// degenerated case returned by the Windows FileOpen dialog +// when someone enters for instance "x:filename", the Win32 +// API accepts this case +const sal_Unicode* LDP_WITH_DOT_BACKSLASH = L":.\\"; + +sal_Int32 osl_systemPathIsLogicalDrivePattern(/*in*/ const rtl_uString* pustrPath) +{ + const sal_Unicode* p = rtl_uString_getStr(const_cast(pustrPath)); + if (iswalpha(*p++)) + { + return ((0 == wcscmp(p, LDP)) || + (0 == wcscmp(p, LDP_WITH_BACKSLASH)) || + (0 == wcscmp(p, LDP_WITH_SLASH)) || + (0 == wcscmp(p, LDP_WITH_DOT_BACKSLASH))); + } + return 0; +} + + -- cgit breoffice-7-4+backports'>distro/lhm/libreoffice-7-4+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/filter
AgeCommit message (Expand)Author
2013-06-03re-base on ALv2 code. Includes:Michael Meeks
2013-06-03fdo#46808, Convert FrameLoaderFactory and ContentHandlerFactory to new styleNoel Grandin
2013-05-31fdo#63690 - replace RTL_CONTEXT_ macros with SAL_INFORadu Ioan
2013-05-31Resolves: #i119631# Teardrop shape cannot be shown correctly in pptxZhe Wang
2013-05-29Related: #i119628# Arrow shape changed is save doc file by AOOJianyuan Li
2013-05-28fdo#46808, Convert awt::UnoControlDialog to new styleNoel Grandin
2013-05-27Resolves: #i120158# fix picture shadow lost after saved as doc in some caseLei De Bin
2013-05-27Resolves: #i119753# fix audio video object lost when save .ppt fileSun Ying
2013-05-25Resolves: #i119874 Fixed text alignment in RTL layoutCaolán McNamara
2013-05-25Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"Stephan Bergmann
2013-05-24Revert "Resolves: #i119874 Fixed text alignment in RTL layout."Caolán McNamara
2013-05-24Resolves: #i119874 Fixed text alignment in RTL layout.Andre Fischer
2013-05-23Resolves: #i119537# Fixed extrusion of custom shapes to XLSAndre Fischer
2013-05-23Resolves: #i119903# Alternative text for form control t import/exportAndre Fischer
2013-05-22fdo#46808, Convert XMultiServiceFactory to XComponentContextNoel Grandin
2013-05-22Use the new type-checking Reference constructor to reduce code noiseNoel Grandin
2013-05-21remove unused member and methodNoel Grandin
2013-05-21fdo#46808, Clean up old usages of ExtToolkitNoel Grandin
2013-05-21fdo#46808, Convert awt::XUnoControlDialog to new styleNoel Grandin
2013-05-21fdo#46808, Convert awt::UnoControlDialogModel to new styleNoel Grandin
2013-05-20WaE: use of unary operator that may be intended as compound assignmentTor Lillqvist
2013-05-20Resolves: #i120554# Shape Gradient MS2003 import/export EnhancementJianyuan Li
2013-05-20Resolves: #i121420# merge sidebar featureOliver-Rainer Wittmann
2013-05-19typoJulien Nabet
2013-05-19Resolves: #i119885# corrected AutoGrowHeight setting...Armin Le Grand
2013-05-19Resolves: #i119496# Correct flags AutoGrowWidth/Height for WordArtArmin Le Grand
2013-05-19Resolves: #i119443# Import lines from ppt as one point connectorsArmin Le Grand
2013-05-19Resolves: #i119703# Corrected bound rect for ms graphic object...Armin Le Grand
2013-05-18Resolves: #i119570# fix chaotically grouped object when importedJianyuan Li
2013-05-18Resolves: #i120437# Connector corrections in groups and PPT importsArmin Le Grand
2013-05-17fdo#37222 and possibly fdo#37219anuragkanungo
2013-05-15Resolves: #i119493# Fixed import of tables with connectors.Andre Fischer
2013-05-15Spelling "separate" (etc) correctly is hardTor Lillqvist
2013-05-14sal_Int*/sal_uInt* to boolTakeshi Abe
2013-05-12bnc#758621: Set the attribs for the entire para if a placeholder.Jan Holesovsky
2013-05-12bnc#758621: Kill unused aPlacementId, it is never set.Jan Holesovsky
2013-05-12Quiet cppcheck + simplify/optimize a bitJulien Nabet
2013-05-10resolved fdo#35756 import more than 64k HTML table cellsEike Rathke
2013-05-09Related: #119477#, nBuStart is initialized as -1, an unsigned int is requiredXisco Fauli
2013-05-09#119477# fix bullet's start with error when save .ppt fileSun Ying
2013-05-09Resolves: #i121233# Added bitmap scaling methods BMP_SCALE_SUPERArmin Le Grand
2013-05-09Drop String.AppendAscii from filterRicardo Montania
2013-05-09make conversions between BitmapColor and sal_uInt8 explicitHerbert Dürr
2013-05-08zlib: remove ExternalPackage_zlibMichael Stahl
2013-05-06Revert "properly prefix graphic filter methods"Peter Foley
2013-05-06fix typos (wich instead of which)Philipp Riemer
2013-05-06remove usage of RTL_CONSTASCII_USTRINGPARAMLuboš Luňák