Kaydet (Commit) 0af52474 authored tarafından Matúš Kukan's avatar Matúš Kukan

sysui: remove some unused stuff

Change-Id: I6d18017311013f3bb63451c4b6f59f82f02f918a
üst 33a6f881
su sysui : offapi DESKTOP:l10ntools NULL su sysui : offapi DESKTOP:l10ntools NULL
#su sysui\source\win32\QuickStart nmake - w su_win32_quickstart NULL
#su sysui\source\win32\QuickStart\so nmake - w su_win32_quickstart_so su_win32_quickstart.w NULL
su sysui\desktop\icons nmake - w su_iconsw NULL su sysui\desktop\icons nmake - w su_iconsw NULL
su sysui\desktop\macosx nmake - u su_dtmacosx su_dtshare.u NULL su sysui\desktop\macosx nmake - u su_dtmacosx su_dtshare.u NULL
su sysui\desktop\cleanversion nmake - u su_dtcleanversion NULL su sysui\desktop\cleanversion nmake - u su_dtcleanversion NULL
......
/* -*- 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 "AutoBuffer.hxx"
#include <osl/diagnose.h>
#include <windows.h>
//------------------------------------------------------------------------
// namespace directives
//------------------------------------------------------------------------
using rtl::OUString;
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
CAutoUnicodeBuffer::CAutoUnicodeBuffer( size_t size, sal_Bool bLazyCreation ) :
m_buffSize( size ),
m_pBuff( NULL )
{
if ( !bLazyCreation )
init( );
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
CAutoUnicodeBuffer::~CAutoUnicodeBuffer( )
{
delete [] m_pBuff;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
sal_Bool SAL_CALL CAutoUnicodeBuffer::resize( size_t new_size )
{
OSL_ASSERT( new_size >= 0 );
if ( new_size != m_buffSize )
{
if ( new_size > m_buffSize )
{
delete [] m_pBuff;
m_pBuff = NULL;
}
m_buffSize = new_size;
}
return sal_True;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
void SAL_CALL CAutoUnicodeBuffer::empty( )
{
if ( m_pBuff )
ZeroMemory( m_pBuff, m_buffSize * sizeof( sal_Unicode ) );
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
sal_Bool SAL_CALL CAutoUnicodeBuffer::fill( const sal_Unicode* pContent, size_t nLen )
{
OSL_ASSERT( pContent && m_buffSize && (m_buffSize >= nLen) );
init( );
sal_Bool bRet = sal_False;
if ( m_pBuff && pContent && nLen )
{
CopyMemory( m_pBuff, pContent, nLen * sizeof( sal_Unicode ) );
bRet = sal_True;
}
return bRet;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
size_t SAL_CALL CAutoUnicodeBuffer::size( ) const
{
return m_buffSize;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
CAutoUnicodeBuffer::operator sal_Unicode*( )
{
return m_pBuff;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
sal_Unicode* CAutoUnicodeBuffer::operator&( )
{
return m_pBuff;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
const sal_Unicode* CAutoUnicodeBuffer::operator&( ) const
{
return m_pBuff;
}
//------------------------------------------------------------------------
//
//------------------------------------------------------------------------
void SAL_CALL CAutoUnicodeBuffer::init( )
{
if ( !m_pBuff && (m_buffSize > 0) )
m_pBuff = new sal_Unicode[ m_buffSize ];
empty( );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef _AUTO_BUFFER_HXX_
#define _AUTO_BUFFER_HXX_
#include <sal/types.h>
#include <rtl/ustring>
//-------------------------------------------------------------
// A simple unicode buffer management class, the class itself
// is responsible for the allocated unicode buffer, any
// modification of the buffer size outside the class may lead
// to undefined behaviour
//-------------------------------------------------------------
class CAutoUnicodeBuffer
{
public:
// if bLazyCreation is true the buffer will be created
// when someone wants to fill the buffer
CAutoUnicodeBuffer( size_t size, sal_Bool bLazyCreation = sal_False );
~CAutoUnicodeBuffer( );
// resizes the buffer
sal_Bool SAL_CALL resize( size_t new_size );
// zeros the buffer
void SAL_CALL empty( );
// fills the buffer with a given content
sal_Bool SAL_CALL fill( const sal_Unicode* pContent, size_t nLen );
// returns the size of the buffer
size_t SAL_CALL size( ) const;
// conversion operator
operator sal_Unicode*( );
// address operator
sal_Unicode* operator&( );
const sal_Unicode* operator&( ) const;
private:
void SAL_CALL init( );
private:
size_t m_buffSize; // the number of unicode chars
sal_Unicode* m_pBuff;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
/* -*- 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 .
*/
#ifndef _WINIMPLHELPER_HXX_
#define _WINIMPLHELPER_HXX_
#include <sal/types.h>
#include <rtl/ustring>
#include <windows.h>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
sal_Bool SAL_CALL IsWin2000( );
// set actions
void SAL_CALL ListboxAddItem(
HWND hwnd, const ::com::sun::star::uno::Any& aItem, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang::IllegalArgumentException );
void SAL_CALL ListboxAddItems(
HWND hwnd, const ::com::sun::star::uno::Any& aItemList, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang:: IllegalArgumentException );
void SAL_CALL ListboxDeleteItem(
HWND hwnd, const ::com::sun::star::uno::Any& aPosition, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang::IllegalArgumentException );
void SAL_CALL ListboxDeleteItems(
HWND hwnd, const ::com::sun::star::uno::Any& aUnused, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang::IllegalArgumentException );
void SAL_CALL ListboxSetSelectedItem(
HWND hwnd, const ::com::sun::star::uno::Any& aPosition, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang::IllegalArgumentException );
// get actions
::com::sun::star::uno::Any SAL_CALL ListboxGetItems( HWND hwnd );
::com::sun::star::uno::Any SAL_CALL ListboxGetSelectedItem( HWND hwnd );
// checkbox helper functions
::com::sun::star::uno::Any SAL_CALL CheckboxGetState( HWND hwnd );
void SAL_CALL CheckboxSetState(
HWND hwnd, const ::com::sun::star::uno::Any& aState, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rXInterface, sal_Int16 aArgPos )
throw( ::com::sun::star::lang::IllegalArgumentException );
// calculates the length of '\0' separated and '\0\0'
// ending strings used in some Win32 functions
// e.g. Filter\0*.txt\0\0
// the returned length excludes the last '\0'
sal_uInt32 SAL_CALL _wcslenex( const sal_Unicode* pStr );
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#
# 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 .
#
PRJ=..$/..$/..
PRJNAME=sysui
TARGET=utils
LIBTARGET=NO
# --- Settings ----------------------------------
.INCLUDE : settings.mk
CFLAGS+=/GX
# --- Files -------------------------------------
SLOFILES=$(SLO)$/WinImplHelper.obj\
$(SLO)$/AutoBuffer.obj\
$(SLO)$/resourceprovider.obj
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1OBJFILES=$(SLOFILES)
# --- Targets ----------------------------------
.INCLUDE : target.mk
/* -*- 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 <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include "resourceprovider.hxx"
#include <tools/resmgr.hxx>
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <svtools/svtools.hrc>
//------------------------------------------------------------
// namespace directives
//------------------------------------------------------------
using rtl::OUString;
using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
//------------------------------------------------------------
//
//------------------------------------------------------------
// because the label of a listbox is
// a control itself (static text) we
// have defined a control id for this
// label which is the listbox control
// id + 100
#define LB_LABEL_OFFSET 100
const rtl::OUString TILDE( "~" );
const sal_Unicode TILDE_SIGN = L'~';
#define FOLDERPICKER_TITLE 500
#define FOLDER_PICKER_DEF_DESCRIPTION 501
//------------------------------------------------------------
// we have to translate control ids to resource ids
//------------------------------------------------------------
struct _Entry
{
sal_Int32 ctrlId;
sal_Int16 resId;
};
_Entry CtrlIdToResIdTable[] = {
{ CHECKBOX_AUTOEXTENSION, STR_SVT_FILEPICKER_AUTO_EXTENSION },
{ CHECKBOX_PASSWORD, STR_SVT_FILEPICKER_PASSWORD },
{ CHECKBOX_FILTEROPTIONS, STR_SVT_FILEPICKER_FILTER_OPTIONS },
{ CHECKBOX_READONLY, STR_SVT_FILEPICKER_READONLY },
{ CHECKBOX_LINK, STR_SVT_FILEPICKER_INSERT_AS_LINK },
{ CHECKBOX_PREVIEW, STR_SVT_FILEPICKER_SHOW_PREVIEW },
{ PUSHBUTTON_PLAY, STR_SVT_FILEPICKER_PLAY },
{ LISTBOX_VERSION + LB_LABEL_OFFSET, STR_SVT_FILEPICKER_VERSION },
{ LISTBOX_TEMPLATE + LB_LABEL_OFFSET, STR_SVT_FILEPICKER_TEMPLATES },
{ LISTBOX_IMAGE_TEMPLATE + LB_LABEL_OFFSET, STR_SVT_FILEPICKER_IMAGE_TEMPLATE },
{ CHECKBOX_SELECTION, STR_SVT_FILEPICKER_SELECTION },
{ FOLDERPICKER_TITLE, STR_SVT_FOLDERPICKER_DEFAULT_TITLE },
{ FOLDER_PICKER_DEF_DESCRIPTION, STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION }
};
const sal_Int32 SIZE_TABLE = sizeof( CtrlIdToResIdTable ) / sizeof( _Entry );
//------------------------------------------------------------
//
//------------------------------------------------------------
sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
{
sal_Int16 aResId = -1;
for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ )
{
if ( CtrlIdToResIdTable[i].ctrlId == aControlId )
{
aResId = CtrlIdToResIdTable[i].resId;
break;
}
}
return aResId;
}
//------------------------------------------------------------
//
//------------------------------------------------------------
class CResourceProvider_Impl
{
public:
//-------------------------------------
//
//-------------------------------------
CResourceProvider_Impl( )
{
m_ResMgr = ResMgr::CreateResMgr("svt");
}
//-------------------------------------
//
//-------------------------------------
~CResourceProvider_Impl( )
{
delete m_ResMgr;
}
//-------------------------------------
//
//-------------------------------------
OUString getResString( sal_Int16 aId )
{
String aResString;
OUString aResOUString;
try
{
OSL_ASSERT( m_ResMgr );
// translate the control id to a resource id
sal_Int16 aResId = CtrlIdToResId( aId );
if ( aResId > -1 )
{
aResString = String( ResId( aResId, m_ResMgr ) );
aResOUString = OUString( aResString );
// remove '~' signs, if there are two '~' signs
// in a row we remove only one of them
if ( aResOUString.indexOf( TILDE ) > -1 )
{
sal_Int32 nStrLen = aResOUString.getLength( );
rtl::OUStringBuffer aBuffer( nStrLen );
sal_Int32 i = 0;
const sal_Unicode* pPos = aResOUString.getStr( );
const sal_Unicode* pNext = aResOUString.getStr( ) + 1;
const sal_Unicode* pEnd = aResOUString.getStr( ) + nStrLen;
while( pPos < pEnd )
{
// we insert the next character only if the current character
// in not a '~' or the following character is also a '~'
if ( (*pPos != TILDE_SIGN) ||
((*pPos == TILDE_SIGN) && (pNext < pEnd) && (*pNext == TILDE_SIGN)) )
{
aBuffer.insert( i, *pPos );
i++;
}
pPos++;
pNext++;
}
aResOUString = aBuffer.makeStringAndClear( );
}
}
}
catch(...)
{
}
return aResOUString;
}
public:
ResMgr* m_ResMgr;
};
//------------------------------------------------------------
//
//------------------------------------------------------------
CResourceProvider::CResourceProvider( ) :
m_pImpl( new CResourceProvider_Impl() )
{
}
//------------------------------------------------------------
//
//------------------------------------------------------------
CResourceProvider::~CResourceProvider( )
{
delete m_pImpl;
}
//------------------------------------------------------------
//
//------------------------------------------------------------
OUString CResourceProvider::getResString( sal_Int32 aId )
{
return m_pImpl->getResString( aId );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef _RESOURCEPROVIDER_HXX_
#define _RESOURCEPROVIDER_HXX_
#include <sal/types.h>
#include <rtl/ustring>
class CResourceProvider_Impl;
class CResourceProvider
{
public:
CResourceProvider( );
~CResourceProvider( );
rtl::OUString getResString( sal_Int32 aId );
private:
CResourceProvider_Impl* m_pImpl;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment