[Libreoffice-commits] .: 4 commits - configure.in RepositoryExternal.mk sal/qa sc/source svl/inc svl/source svtools/inc svtools/source svx/source unotools/source unusedcode.easy vcl/generic vcl/inc vcl/Library_vcl.mk vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Sep 17 02:54:19 PDT 2012
RepositoryExternal.mk | 20 ++
configure.in | 24 +-
sal/qa/rtl/uri/rtl_Uri.cxx | 40 ----
sc/source/core/tool/interpr1.cxx | 2
sc/source/ui/vba/vbaworkbook.cxx | 11 -
sc/source/ui/vba/vbaworkbook.hxx | 2
svl/inc/svl/zforlist.hxx | 14 -
svl/inc/svl/zformat.hxx | 4
svl/source/numbers/zforlist.cxx | 59 +++---
svtools/inc/svtools/fmtfield.hxx | 14 -
svtools/inc/svtools/stdmenu.hxx | 6
svtools/source/control/fmtfield.cxx | 26 +-
svtools/source/control/stdmenu.cxx | 12 -
svx/source/items/numfmtsh.cxx | 11 -
unotools/source/config/xmlaccelcfg.cxx | 9 -
unusedcode.easy | 29 +++
vcl/Library_vcl.mk | 14 -
vcl/generic/glyphs/gcach_ftyp.cxx | 50 -----
vcl/generic/glyphs/gcach_ftyp.hxx | 1
vcl/generic/glyphs/gcach_layout.cxx | 8
vcl/generic/glyphs/glyphcache.cxx | 19 --
vcl/inc/cupsmgr.hxx | 8
vcl/inc/generic/glyphcache.hxx | 2
vcl/unx/generic/printer/cupsmgr.cxx | 295 ++++-----------------------------
vcl/unx/generic/printer/ppdparser.cxx | 2
25 files changed, 189 insertions(+), 493 deletions(-)
New commits:
commit 01cadc8fdbc9eab94833566263e6bd0acb313c3c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 17 10:40:43 2012 +0100
Related: rhbz#857860 enable ligatures and kerning only when requested
Change-Id: I8c4d9744c9a8704fbb7de5670933f2229f710fce
diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 774f0f8..ab008b2 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -311,6 +311,12 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar)
bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
{
+ le_int32 nLayoutFlags = 0;
+ if (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS)
+ nLayoutFlags |= LayoutEngine::kTypoFlagKern;
+ if (rArgs.mnFlags & SAL_LAYOUT_ENABLE_LIGATURES)
+ nLayoutFlags |= LayoutEngine::kTypoFlagLiga;
+
LEUnicode* pIcuChars;
if( sizeof(LEUnicode) == sizeof(*rArgs.mpStr) )
pIcuChars = (LEUnicode*)rArgs.mpStr;
@@ -371,7 +377,7 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
delete mpIcuLE;
meScriptCode = eScriptCode;
le_int32 eLangCode = 0; // TODO: get better value
- mpIcuLE = LayoutEngine::layoutEngineFactory( &maIcuFont, eScriptCode, eLangCode, rcIcu );
+ mpIcuLE = LayoutEngine::layoutEngineFactory( &maIcuFont, eScriptCode, eLangCode, nLayoutFlags, rcIcu );
if( LE_FAILURE(rcIcu) )
{
delete mpIcuLE;
commit d5e15c6355e5bbf9ca87545f9ffb2f81b85d6d8d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 14 11:40:31 2012 +0100
update unused code list
Change-Id: I4d6ad11fbe68420931e88defa20afbef290d4d24
diff --git a/sal/qa/rtl/uri/rtl_Uri.cxx b/sal/qa/rtl/uri/rtl_Uri.cxx
index 7358099..e142b1d 100644
--- a/sal/qa/rtl/uri/rtl_Uri.cxx
+++ b/sal/qa/rtl/uri/rtl_Uri.cxx
@@ -41,52 +41,12 @@
namespace Stringtest
{
- rtl::OString toHex(unsigned char _c)
- {
- rtl::OStringBuffer sStrBuf;
- static char cHex[] = "0123456789ABCDEF";
-
- int nhigh = int(_c) >> 4 & 0xf;
- int nlow = int(_c) & 0xf;
- sStrBuf.append( cHex[nhigh] );
- sStrBuf.append( cHex[nlow] );
- return sStrBuf.makeStringAndClear();
- }
-
- rtl::OString escapeString(rtl::OString const& _sStr)
- {
- rtl::OStringBuffer sStrBuf;
- sal_Int32 nLength = _sStr.getLength();
- for(int i=0;i<nLength;++i)
- {
- unsigned char c = (unsigned char)_sStr[i];
- if (c > 127)
- {
- sStrBuf.append("%");
- sStrBuf.append(toHex(c));
- }
- else
- {
- sStrBuf.append((char)c);
- }
- }
- return sStrBuf.makeStringAndClear();
- }
-
// -----------------------------------------------------------------------------
class Convert : public CppUnit::TestFixture
{
rtl::OUString m_aStr;
public:
- /*
- rtl::OString toUTF8(rtl::OUString const& _suStr)
- {
- rtl::OString sStrAsUTF8 = rtl::OUStringToOString(_suStr, RTL_TEXTENCODING_UTF8);
- printf("%s\n", escapeString(sStrAsUTF8).getStr());
- return sStrAsUTF8;
- }
- */
rtl::OUString fromUTF8(rtl::OString const& _suStr)
{
rtl::OUString suStr = rtl::OStringToOUString(_suStr, RTL_TEXTENCODING_UTF8);
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 209facd..bccb701 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -190,17 +190,6 @@ ScVbaWorkbook::ScVbaWorkbook( uno::Sequence< uno::Any> const & args,
init();
}
-namespace
-{
- class theScVbaWorkbookUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScVbaWorkbookUnoTunnelId > {};
-}
-
-const uno::Sequence<sal_Int8>&
-ScVbaWorkbook::getUnoTunnelId()
-{
- return theScVbaWorkbookUnoTunnelId::get().getSeq();
-}
-
uno::Reference< excel::XWorksheet >
ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/vba/vbaworkbook.hxx b/sc/source/ui/vba/vbaworkbook.hxx
index 063d7c3..7d32dec 100644
--- a/sc/source/ui/vba/vbaworkbook.hxx
+++ b/sc/source/ui/vba/vbaworkbook.hxx
@@ -50,8 +50,6 @@ public:
ScVbaWorkbook( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
virtual ~ScVbaWorkbook() {}
- static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
-
// Attributes
virtual ::sal_Bool SAL_CALL getProtectStructure() throw (css::uno::RuntimeException);
virtual css::uno::Reference< ov::excel::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException);
diff --git a/unotools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx
index 57ea43e..543f349 100644
--- a/unotools/source/config/xmlaccelcfg.cxx
+++ b/unotools/source/config/xmlaccelcfg.cxx
@@ -60,7 +60,6 @@ public:
public:
void addAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sType , const ::rtl::OUString &sValue );
- void clear();
private:
struct AttributeListImpl_impl *m_pImpl;
@@ -177,14 +176,6 @@ void AttributeListImpl::addAttribute( const OUString &sName ,
m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) );
}
-void AttributeListImpl::clear()
-{
- ::std::vector<struct TagAttribute> dummy;
- m_pImpl->vecAttribute.swap( dummy );
-
- OSL_ASSERT( ! getLength() );
-}
-
} // anonymous namespace
Any SAL_CALL OReadAccelatorDocumentHandler::queryInterface( const Type & rType ) throw( RuntimeException )
diff --git a/unusedcode.easy b/unusedcode.easy
index fab7935..cdb8a53 100755
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -1,21 +1,44 @@
FontSelectPattern::FontSelectPattern(PhysicalFontFace const&, Size const&, float, int, bool)
PopupMenu::SetSelectedEntry(unsigned short)
SanExtensionImpl::setCertExtn(unsigned char*, unsigned int, unsigned char*, unsigned int, unsigned char)
+ScMenuFloatingWindow::getDoc()
ScVbaFormat<ooo::vba::excel::XRange>::setNumberFormat(com::sun::star::lang::Locale, rtl::OUString const&)
ScVbaFormat<ooo::vba::excel::XStyle>::getAddIndent()
ScVbaFormat<ooo::vba::excel::XStyle>::setAddIndent(com::sun::star::uno::Any const&)
ScVbaFormat<ooo::vba::excel::XStyle>::setNumberFormat(com::sun::star::lang::Locale, rtl::OUString const&)
SvtSlideSorterBarOptions::AddListenerLink(Link const&)
SvtSlideSorterBarOptions::RemoveListenerLink(Link const&)
+SvtUserOptions::GetApartment() const
+SvtUserOptions::GetFathersName() const
+SvtUserOptions::SetApartment(rtl::OUString const&)
+SvtUserOptions::SetCity(rtl::OUString const&)
+SvtUserOptions::SetCompany(rtl::OUString const&)
+SvtUserOptions::SetCountry(rtl::OUString const&)
+SvtUserOptions::SetEmail(rtl::OUString const&)
+SvtUserOptions::SetFathersName(rtl::OUString const&)
+SvtUserOptions::SetFax(rtl::OUString const&)
+SvtUserOptions::SetFirstName(rtl::OUString const&)
+SvtUserOptions::SetID(rtl::OUString const&)
+SvtUserOptions::SetLastName(rtl::OUString const&)
+SvtUserOptions::SetPosition(rtl::OUString const&)
+SvtUserOptions::SetState(rtl::OUString const&)
+SvtUserOptions::SetStreet(rtl::OUString const&)
+SvtUserOptions::SetTelephoneHome(rtl::OUString const&)
+SvtUserOptions::SetTelephoneWork(rtl::OUString const&)
+SvtUserOptions::SetTitle(rtl::OUString const&)
+SvtUserOptions::SetZip(rtl::OUString const&)
TextEngine::GetLeftMargin() const
ThumbnailView::GetItemCount() const
ThumbnailView::ImplScroll(Point const&)
ThumbnailView::InsertItem(unsigned short, BitmapEx const&, rtl::OUString const&, unsigned long)
ThumbnailViewItemAcc::FireAccessibleEvent(short, com::sun::star::uno::Any const&, com::sun::star::uno::Any const&)
ThumbnailViewItemAcc::getImplementation(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
+VbaFoundFiles::VbaFoundFiles(com::sun::star::uno::Reference<ooo::vba::XHelperInterface> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> const&)
+VbaFoundFilesEnum::VbaFoundFilesEnum(com::sun::star::uno::Sequence<rtl::OUString>&)
VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(Size const&, Fraction const&, Point const&, boost::shared_array<unsigned char> const&)
Window::PostUserEvent(unsigned long&, unsigned long, void*)
XclExpPivotCache::GetFieldAcc(rtl::OUString const&)
+basctl::DbgName_DocShell()
binfilter::ImpSvtData::~ImpSvtData()
binfilter::PCodeBuffConvertor<unsigned int, unsigned short>::GetBuffer()
binfilter::PCodeBuffConvertor<unsigned int, unsigned short>::GetSize()
@@ -70,8 +93,11 @@ dbtools::getConnection(rtl::OUString const&, rtl::OUString const&, rtl::OUString
formula::FormulaTokenIterator::First()
framework::OReadMenuDocumentHandler::getServiceFactory()
jfw_plugin::VendorBase::createInstance()
+ooo::vba::excel::GetDocShellFromRanges(com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRangeContainer> const&)
+ooo::vba::excel::GetDocumentFromRange(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&)
oox::drawingml::TextParagraphProperties::dump() const
oox::xls::BiffDrawingObjectBase::BiffDrawingObjectBase(oox::xls::WorksheetHelper const&)
+sax_fastparser::FastSaxSerializer::getSupportedServiceNames_Static()
sd::ClientBox::GetMinOutputSizePixel() const
sd::ClientBox::RemoveUnlocked()
sd::ClientBox::SetScrollHdl(Link const&)
@@ -88,3 +114,6 @@ sd::ToolPanelPaneShell::RegisterInterface(SfxModule*)
sd::ViewShellBase::RegisterFactory(unsigned short)
std::__cxx1998::vector<SfxFilter*, std::allocator<SfxFilter*> >::~vector()
std::__cxx1998::vector<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::~vector()
+toolkit::ScrollableWrapper<Dialog>::getScrollVisibility()
+toolkit::ScrollableWrapper<GroupBox>::ScrollableWrapper(Window*, long)
+toolkit::ScrollableWrapper<GroupBox>::getScrollVisibility()
diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index 8ac55e4..d4f2b02 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -341,8 +341,7 @@ FtFontInfo::~FtFontInfo()
delete mpChar2Glyph;
delete mpGlyph2Char;
#ifdef ENABLE_GRAPHITE
- if (mpGraphiteFace)
- delete mpGraphiteFace;
+ delete mpGraphiteFace;
#endif
}
@@ -416,7 +415,7 @@ bool FtFontInfo::HasExtraKerning() const
if( !mpExtraKernInfo )
return false;
// TODO: how to enable the line below without getting #i29881# back?
- // on the other hand being to optimistic doesn't cause problems
+ // on the other hand being too optimistic doesn't cause problems
// return mpExtraKernInfo->HasKernPairs();
return true;
}
@@ -432,19 +431,6 @@ int FtFontInfo::GetExtraKernPairs( ImplKernPairData** ppKernPairs ) const
// -----------------------------------------------------------------------
-int FtFontInfo::GetExtraGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const
-{
- if( !mpExtraKernInfo )
- return 0;
- if( !mpGlyph2Char )
- return 0;
- sal_Unicode cLeftChar = (*mpGlyph2Char)[ nLeftGlyph ];
- sal_Unicode cRightChar = (*mpGlyph2Char)[ nRightGlyph ];
- return mpExtraKernInfo->GetUnscaledKernValue( cLeftChar, cRightChar );
-}
-
-// -----------------------------------------------------------------------
-
static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);}
//static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));}
@@ -1843,38 +1829,6 @@ bool ServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) c
}
// -----------------------------------------------------------------------
-// kerning stuff
-// -----------------------------------------------------------------------
-
-int ServerFont::GetGlyphKernValue( int nGlyphLeft, int nGlyphRight ) const
-{
- // if no kerning info is available from Freetype
- // then we may have to use extra info provided by e.g. psprint
- if( !FT_HAS_KERNING( maFaceFT ) || !FT_IS_SFNT( maFaceFT ) )
- {
- int nKernVal = mpFontInfo->GetExtraGlyphKernValue( nGlyphLeft, nGlyphRight );
- if( !nKernVal )
- return 0;
- // scale the kern value to match the font size
- const FontSelectPattern& rFSD = GetFontSelData();
- nKernVal *= rFSD.mnWidth ? rFSD.mnWidth : rFSD.mnHeight;
- return (nKernVal + 500) / 1000;
- }
-
- // when font faces of different sizes share the same maFaceFT
- // then we have to make sure that it uses the correct maSizeFT
- if( maSizeFT )
- pFTActivateSize( maSizeFT );
-
- // use Freetype's kerning info
- FT_Vector aKernVal;
- FT_Error rcFT = FT_Get_Kerning( maFaceFT, nGlyphLeft, nGlyphRight,
- FT_KERNING_DEFAULT, &aKernVal );
- int nResult = (rcFT == FT_Err_Ok) ? (aKernVal.x + 32) >> 6 : 0;
- return nResult;
-}
-
-// -----------------------------------------------------------------------
sal_uLong ServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) const
{
diff --git a/vcl/generic/glyphs/gcach_ftyp.hxx b/vcl/generic/glyphs/gcach_ftyp.hxx
index 192704f..817b3d5 100644
--- a/vcl/generic/glyphs/gcach_ftyp.hxx
+++ b/vcl/generic/glyphs/gcach_ftyp.hxx
@@ -102,7 +102,6 @@ public:
bool HasExtraKerning() const;
int GetExtraKernPairs( ImplKernPairData** ) const;
- int GetExtraGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const;
private:
FT_FaceRec_* maFaceFT;
diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx
index 2ed37a7..dc2f4e5 100644
--- a/vcl/generic/glyphs/glyphcache.cxx
+++ b/vcl/generic/glyphs/glyphcache.cxx
@@ -456,25 +456,6 @@ int ExtraKernInfo::GetUnscaledKernPairs( ImplKernPairData** ppKernPairs ) const
return nKernCount;
}
-//--------------------------------------------------------------------------
-
-int ExtraKernInfo::GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight ) const
-{
- if( !mbInitialized )
- Initialize();
-
- if( maUnicodeKernPairs.empty() )
- return 0;
-
- ImplKernPairData aKernPair = { cLeft, cRight, 0 };
- UnicodeKernPairs::const_iterator it = maUnicodeKernPairs.find( aKernPair );
- if( it == maUnicodeKernPairs.end() )
- return 0;
-
- int nUnscaledValue = (*it).mnKern;
- return nUnscaledValue;
-}
-
// =======================================================================
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index 6c6ca43..ff3eac7 100644
--- a/vcl/inc/generic/glyphcache.hxx
+++ b/vcl/inc/generic/glyphcache.hxx
@@ -208,7 +208,6 @@ public:
const unsigned char* GetTable( const char* pName, sal_uLong* pLength );
int GetEmUnits() const;
const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
- int GetGlyphKernValue( int, int ) const;
const ImplFontCharMap* GetImplFontCharMap() const;
bool GetFontCapabilities(vcl::FontCapabilities &) const;
@@ -402,7 +401,6 @@ public:
virtual ~ExtraKernInfo() {}
int GetUnscaledKernPairs( ImplKernPairData** ) const;
- int GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight ) const;
protected:
mutable bool mbInitialized;
commit 68ffb332f5717f9ef6af11497372becddaac7ef0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 14 11:31:50 2012 +0100
nothing propagates HAVE_CUPS_H so cups is always disabled
regression from 22f2e5f286d55cd5c1ead07fb82cd78027abf490
so, lets follow the same pattern as else where and fixup
ENABLE_CUPS to be TRUE when enabled and lets just link
against cups and not do the dlopen dance
Change-Id: I3cff1bd98a7474c403d7ff66183e76e26e407de8
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index fcc4782..772c098 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1219,6 +1219,26 @@ $(call gb_LinkTarget_add_libs,$(1),$(GTHREAD_LIBS))
endef
+ifeq ($(ENABLE_CUPS),TRUE)
+
+define gb_LinkTarget__use_cups
+$(call gb_LinkTarget_add_defs,$(1),\
+ -DENABLE_CUPS \
+)
+
+$(call gb_LinkTarget_add_libs,$(1),\
+ -lcups \
+)
+
+endef
+
+else # ENABLE_CUPS
+
+define gb_LinkTarget__use_cups
+
+endef
+
+endif # ENABLE_DBUS
ifeq ($(ENABLE_DBUS),TRUE)
diff --git a/configure.in b/configure.in
index c90a366..563bcdc 100644
--- a/configure.in
+++ b/configure.in
@@ -4109,32 +4109,32 @@ if test "$enable_headless" = "yes"; then
enable_gnome_vfs=no
fi
+dnl ===================================================================
dnl check for cups support
dnl ===================================================================
+ENABLE_CUPS=""
+
if test "$enable_cups" = "no"; then
test_cups=no
- ENABLE_CUPS="NO"
-elif test "$enable_cups" = "yes"; then
- if test $_os = iOS -o $_os = Android; then
- AC_MSG_ERROR([CUPS makes no sense for $_os])
- fi
- ENABLE_CUPS="YES"
-elif test $_os = iOS -o $_os = Android; then
- ENABLE_CUPS=NO
-else
- ENABLE_CUPS="YES"
fi
-AC_SUBST(ENABLE_CUPS)
+AC_MSG_CHECKING([whether to enable CUPS support])
if test "$test_cups" = "yes"; then
+ ENABLE_CUPS="TRUE"
+ AC_MSG_RESULT([yes])
+
AC_MSG_CHECKING([whether cups support is present])
AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
- AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
+ AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups-devel.])
fi
+
+else
+ AC_MSG_RESULT([no])
fi
+AC_SUBST(ENABLE_CUPS)
# fontconfig checks
if test "$test_fontconfig" = "yes"; then
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 836edb3..6c68a6f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -498,12 +498,6 @@ $(eval $(call gb_Library_add_defs,vcl,\
) \
))
-ifeq ($(ENABLE_CUPS),YES)
-$(eval $(call gb_Library_add_defs,vcl,\
- -DENABLE_CUPS\
-))
-endif
-
ifeq ($(GUIBASE),unx)
$(eval $(call gb_Library_add_defs,vcl,\
-DSAL_DLLPREFIX=\"$(gb_Library_SYSPRE)\" \
@@ -515,15 +509,15 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/unx/generic/plugadapt/salplug \
vcl/unx/generic/printer/jobdata \
vcl/unx/generic/printer/ppdparser \
- $(if $(filter YES,$(ENABLE_CUPS)),\
+ $(if $(filter TRUE,$(ENABLE_CUPS)),\
vcl/unx/generic/printer/cupsmgr \
- vcl/unx/generic/printer/printerinfomanager \
- ) \
- $(if $(filter NO,$(ENABLE_CUPS)),\
+ vcl/unx/generic/printer/printerinfomanager, \
+ else \
vcl/null/printerinfomanager \
) \
))
$(eval $(call gb_Library_use_externals,vcl,\
+ cups \
dbus \
fontconfig \
freetype \
diff --git a/vcl/inc/cupsmgr.hxx b/vcl/inc/cupsmgr.hxx
index b76e8ef..f3cee19 100644
--- a/vcl/inc/cupsmgr.hxx
+++ b/vcl/inc/cupsmgr.hxx
@@ -37,7 +37,6 @@
namespace psp
{
-class CUPSWrapper;
class PPDParser;
struct FPtrHash
@@ -48,7 +47,6 @@ struct FPtrHash
class CUPSManager : public PrinterInfoManager
{
- CUPSWrapper* m_pCUPSWrapper;
boost::unordered_map< FILE*, rtl::OString, FPtrHash > m_aSpoolFiles;
int m_nDests;
void* m_pDests;
@@ -66,13 +64,17 @@ class CUPSManager : public PrinterInfoManager
osl::Mutex m_aCUPSMutex;
oslThread m_aDestThread;
- CUPSManager( CUPSWrapper* );
+ osl::Mutex m_aGetPPDMutex;
+ bool m_bPPDThreadRunning;
+
+ CUPSManager();
virtual ~CUPSManager();
virtual void initialize();
void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const;
void runDests();
+ OString threadedCupsGetPPD(const char* pPrinter);
public:
// public for stub
static void runDestThread(void* pMgr);
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 367f09d..f13b774 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -44,106 +44,6 @@
#include <algorithm>
-#define CUPS_LIB_NAME "libcups.so.2"
-
-namespace psp
-{
-class CUPSWrapper
-{
- oslModule m_pLib;
- osl::Mutex m_aGetPPDMutex;
- bool m_bPPDThreadRunning;
-
- int (*m_pcupsPrintFile)(const char*, const char*, const char*, int, cups_option_t*);
- int (*m_pcupsGetDests)(cups_dest_t**);
- void (*m_pcupsSetDests)(int,cups_dest_t*);
- void (*m_pcupsFreeDests)(int,cups_dest_t*);
- const char* (*m_pcupsGetPPD)(const char*);
- int (*m_pcupsMarkOptions)(ppd_file_t*,int,cups_option_t*);
- int (*m_pcupsAddOption)(const char*,const char*,int,cups_option_t**);
- void (*m_pcupsFreeOptions)(int,cups_option_t*);
- ppd_file_t* (*m_pppdOpenFile)(const char* pFile);
- void (*m_pppdClose)(ppd_file_t*);
- http_t* (*m_phttpConnectEncrypt)(const char*, int, http_encryption_t);
- void (*m_phttpClose)(http_t*);
- int (*m_pippPort)();
- const char* (*m_pcupsServer)();
- http_encryption_t (*m_pcupsEncryption)();
- void (*m_pcupsSetPasswordCB)(const char*(cb)(const char*));
- const char* (*m_pcupsUser)();
- void (*m_pcupsSetUser)(const char*);
- const char* (*m_pcupsGetOption)(const char*,int,cups_option_t*);
-
- oslGenericFunction loadSymbol( const char* );
-public:
- CUPSWrapper();
- ~CUPSWrapper();
-
- bool isValid();
-
- int cupsGetDests(cups_dest_t** pDests)
- { return m_pcupsGetDests(pDests); }
-
- void cupsSetDests( int nDests, cups_dest_t* pDests )
- { m_pcupsSetDests( nDests, pDests ); }
-
- void cupsFreeDests(int nDests, cups_dest_t* pDests)
- { m_pcupsFreeDests(nDests, pDests); }
-
- int cupsPrintFile( const char* pPrinter,
- const char* pFileName,
- const char* pTitle,
- int nOptions,
- cups_option_t* pOptions )
- { return m_pcupsPrintFile( pPrinter, pFileName, pTitle, nOptions, pOptions ); }
-
- rtl::OString cupsGetPPD( const char* pPrinter );
-
- int cupsMarkOptions(ppd_file_t* pPPD, int nOptions, cups_option_t* pOptions )
- { return m_pcupsMarkOptions(pPPD, nOptions, pOptions); }
-
- int cupsAddOption( const char* pName, const char* pValue, int nOptions, cups_option_t** pOptions )
- { return m_pcupsAddOption( pName, pValue, nOptions, pOptions ); }
-
- void cupsFreeOptions( int nOptions, cups_option_t* pOptions )
- { m_pcupsFreeOptions( nOptions, pOptions ); }
-
- ppd_file_t* ppdOpenFile( const char* pFileName )
- { return m_pppdOpenFile( pFileName ); }
-
- void ppdClose( ppd_file_t* pPPD )
- { m_pppdClose( pPPD ); }
-
- http_t* httpConnectEncrypt(const char* host, int port, http_encryption_t crypt)
- { return m_phttpConnectEncrypt(host, port, crypt); }
-
- void httpClose(http_t* server)
- { m_phttpClose(server); }
-
- int ippPort()
- { return m_pippPort(); }
-
- const char *cupsServer(void)
- { return m_pcupsServer(); }
-
- http_encryption_t cupsEncryption()
- { return m_pcupsEncryption(); }
-
- const char *cupsUser(void)
- { return m_pcupsUser(); }
-
- void cupsSetPasswordCB(const char *(*cb)(const char *))
- { m_pcupsSetPasswordCB( cb ); }
-
- void cupsSetUser(const char *user)
- { m_pcupsSetUser( user ); }
-
- const char* cupsGetOption(const char* name, int num_options, cups_option_t* options)
- { return m_pcupsGetOption( name, num_options, options ); }
-
-};
-}
-
using namespace psp;
using namespace osl;
@@ -154,120 +54,8 @@ using ::rtl::OStringToOUString;
using ::rtl::OUStringHash;
using ::rtl::OString;
-/*
- * CUPSWrapper class
- */
-
-oslGenericFunction CUPSWrapper::loadSymbol( const char* pSymbol )
-{
- OUString aSym( OUString::createFromAscii( pSymbol ) );
- oslGenericFunction pSym = osl_getFunctionSymbol( m_pLib, aSym.pData );
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "%s %s\n", pSymbol, pSym ? "found" : "not found" );
-#endif
- return pSym;
-}
-
-CUPSWrapper::CUPSWrapper()
- : m_pLib( NULL ),
- m_bPPDThreadRunning( false )
-{
- OUString aLib( CUPS_LIB_NAME );
- m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
- if( ! m_pLib )
- {
- aLib = OUString( SAL_MODULENAME( "cups" ) );
- m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
- }
-
- if( ! m_pLib )
- {
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "no cups library found\n" );
-#endif
- return;
- }
-
- m_pcupsPrintFile = (int(*)(const char*,const char*,const char*,int,cups_option_t*))
- loadSymbol( "cupsPrintFile" );
- m_pcupsGetDests = (int(*)(cups_dest_t**))
- loadSymbol( "cupsGetDests" );
- m_pcupsSetDests = (void(*)(int,cups_dest_t*))
- loadSymbol( "cupsSetDests" );
- m_pcupsFreeDests = (void(*)(int,cups_dest_t*))
- loadSymbol( "cupsFreeDests" );
- m_pcupsGetPPD = (const char*(*)(const char*))
- loadSymbol( "cupsGetPPD" );
- m_pcupsMarkOptions = (int(*)(ppd_file_t*,int,cups_option_t*))
- loadSymbol( "cupsMarkOptions" );
- m_pcupsAddOption = (int(*)(const char*,const char*,int,cups_option_t**))
- loadSymbol( "cupsAddOption" );
- m_pcupsFreeOptions = (void(*)(int,cups_option_t*))
- loadSymbol( "cupsFreeOptions" );
- m_pppdOpenFile = (ppd_file_t*(*)(const char*))
- loadSymbol( "ppdOpenFile" );
- m_pppdClose = (void(*)(ppd_file_t*))
- loadSymbol( "ppdClose" );
- m_phttpConnectEncrypt = (http_t*(*)(const char*, int, http_encryption_t))
- loadSymbol( "httpConnectEncrypt" );
- m_phttpClose = (void(*)(http_t*))
- loadSymbol( "httpClose" );
- m_pippPort = (int(*)())
- loadSymbol( "ippPort" );
- m_pcupsServer = (const char*(*)())
- loadSymbol( "cupsServer" );
- m_pcupsEncryption = (http_encryption_t(*)())
- loadSymbol( "cupsEncryption" );
- m_pcupsUser = (const char*(*)())
- loadSymbol( "cupsUser" );
- m_pcupsSetPasswordCB = (void(*)(const char*(*)(const char*)))
- loadSymbol( "cupsSetPasswordCB" );
- m_pcupsSetUser = (void(*)(const char*))
- loadSymbol( "cupsSetUser" );
- m_pcupsGetOption = (const char*(*)(const char*,int,cups_option_t*))
- loadSymbol( "cupsGetOption" );
-
- if( ! (
- m_pcupsPrintFile &&
- m_pcupsGetDests &&
- m_pcupsSetDests &&
- m_pcupsFreeDests &&
- m_pcupsGetPPD &&
- m_pcupsMarkOptions &&
- m_pcupsAddOption &&
- m_pcupsServer &&
- m_pcupsUser &&
- m_pcupsSetPasswordCB &&
- m_pcupsSetUser &&
- m_pcupsFreeOptions &&
- m_pppdOpenFile &&
- m_pppdClose &&
- m_phttpConnectEncrypt &&
- m_phttpClose &&
- m_pippPort &&
- m_pcupsGetOption
- ) )
- {
- osl_unloadModule( m_pLib );
- m_pLib = NULL;
- }
-}
-
-CUPSWrapper::~CUPSWrapper()
-{
- if( m_pLib )
- osl_unloadModule( m_pLib );
-}
-
-bool CUPSWrapper::isValid()
-{
- return m_pLib != NULL;
-}
-
-typedef const char*(*PPDFunction)(const char*);
struct GetPPDAttribs
{
- PPDFunction m_pFunction;
osl::Condition m_aCondition;
OString m_aParameter;
OString m_aResult;
@@ -276,10 +64,9 @@ struct GetPPDAttribs
bool* m_pResetRunning;
osl::Mutex* m_pSyncMutex;
- GetPPDAttribs( PPDFunction pFn, const char * m_pParameter,
+ GetPPDAttribs( const char * m_pParameter,
bool* pResetRunning, osl::Mutex* pSyncMutex )
- : m_pFunction( pFn ),
- m_aParameter( m_pParameter ),
+ : m_aParameter( m_pParameter ),
m_pResetRunning( pResetRunning ),
m_pSyncMutex( pSyncMutex )
{
@@ -306,7 +93,7 @@ struct GetPPDAttribs
{
// This CUPS method is not at all thread-safe we need
// to dup the pointer to a static buffer it returns ASAP
- OString aResult = m_pFunction( m_aParameter.getStr() );
+ OString aResult = cupsGetPPD(m_aParameter.getStr());
MutexGuard aGuard( *m_pSyncMutex );
m_aResult = aResult;
m_aCondition.set();
@@ -342,7 +129,7 @@ extern "C" {
}
}
-OString CUPSWrapper::cupsGetPPD( const char* pPrinter )
+OString CUPSManager::threadedCupsGetPPD( const char* pPrinter )
{
OString aResult;
@@ -351,8 +138,7 @@ OString CUPSWrapper::cupsGetPPD( const char* pPrinter )
if( ! m_bPPDThreadRunning )
{
m_bPPDThreadRunning = true;
- GetPPDAttribs* pAttribs = new GetPPDAttribs( m_pcupsGetPPD,
- pPrinter,
+ GetPPDAttribs* pAttribs = new GetPPDAttribs( pPrinter,
&m_bPPDThreadRunning,
&m_aGetPPDMutex );
@@ -388,17 +174,10 @@ static const char* setPasswordCallback( const char* pIn )
CUPSManager* CUPSManager::tryLoadCUPS()
{
CUPSManager* pManager = NULL;
- static const char* pEnv = getenv( "SAL_DISABLE_CUPS" );
+ static const char* pEnv = getenv("SAL_DISABLE_CUPS");
- if( ! pEnv || ! *pEnv )
- {
- // try to load CUPS
- CUPSWrapper* pWrapper = new CUPSWrapper();
- if( pWrapper->isValid() )
- pManager = new CUPSManager( pWrapper );
- else
- delete pWrapper;
- }
+ if (!pEnv || !*pEnv)
+ pManager = new CUPSManager();
return pManager;
}
@@ -410,9 +189,8 @@ static void run_dest_thread_stub( void* pThis )
}
}
-CUPSManager::CUPSManager( CUPSWrapper* pWrapper ) :
+CUPSManager::CUPSManager() :
PrinterInfoManager( CUPS ),
- m_pCUPSWrapper( pWrapper ),
m_nDests( 0 ),
m_pDests( NULL ),
m_bNewDests( false )
@@ -430,9 +208,8 @@ CUPSManager::~CUPSManager()
osl_destroyThread( m_aDestThread );
}
- if( m_nDests && m_pDests )
- m_pCUPSWrapper->cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests );
- delete m_pCUPSWrapper;
+ if (m_nDests && m_pDests)
+ cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests );
}
void CUPSManager::runDestThread( void* pThis )
@@ -449,15 +226,15 @@ void CUPSManager::runDests()
// n#722902 - do a fast-failing check for cups working *at all* first
http_t* p_http;
- if( (p_http=m_pCUPSWrapper->httpConnectEncrypt(
- m_pCUPSWrapper->cupsServer(),
- m_pCUPSWrapper->ippPort(),
- m_pCUPSWrapper->cupsEncryption())) != NULL )
+ if( (p_http=httpConnectEncrypt(
+ cupsServer(),
+ ippPort(),
+ cupsEncryption())) != NULL )
{
// neat, cups is up, clean up the canary
- m_pCUPSWrapper->httpClose(p_http);
+ httpClose(p_http);
- int nDests = m_pCUPSWrapper->cupsGetDests( &pDests );
+ int nDests = cupsGetDests( &pDests );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "came out of cupsGetDests\n" );
#endif
@@ -509,7 +286,7 @@ void CUPSManager::initialize()
// (#i65684#, #i65491#)
bool bUsePDF = false;
cups_dest_t* pDest = ((cups_dest_t*)m_pDests);
- const char* pOpt = m_pCUPSWrapper->cupsGetOption( "printer-info",
+ const char* pOpt = cupsGetOption( "printer-info",
pDest->num_options,
pDest->options );
if( pOpt )
@@ -610,7 +387,7 @@ void CUPSManager::initialize()
aRemovePrinters.pop_front();
}
- m_pCUPSWrapper->cupsSetPasswordCB( setPasswordCallback );
+ cupsSetPasswordCB( setPasswordCallback );
}
static void updatePrinterContextInfo( ppd_group_t* pPPDGroup, PPDContext& rContext )
@@ -682,7 +459,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
if( dest_it != m_aCUPSDestMap.end() )
{
cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second;
- OString aPPDFile = m_pCUPSWrapper->cupsGetPPD( pDest->name );
+ OString aPPDFile = threadedCupsGetPPD( pDest->name );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PPD for %s is %s\n", OUStringToOString( aPrinter, osl_getThreadTextEncoding() ).getStr(), aPPDFile.getStr() );
#endif
@@ -691,7 +468,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
OUString aFileName( OStringToOUString( aPPDFile, aEncoding ) );
// update the printer info with context information
- ppd_file_t* pPPD = m_pCUPSWrapper->ppdOpenFile( aPPDFile.getStr() );
+ ppd_file_t* pPPD = ppdOpenFile( aPPDFile.getStr() );
if( pPPD )
{
// create the new parser
@@ -699,7 +476,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
pCUPSParser->m_aFile = rPrinter;
pNewParser = pCUPSParser;
- /*int nConflicts =*/ m_pCUPSWrapper->cupsMarkOptions( pPPD, pDest->num_options, pDest->options );
+ /*int nConflicts =*/ cupsMarkOptions( pPPD, pDest->num_options, pDest->options );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "processing the following options for printer %s (instance %s):\n",
pDest->name, pDest->instance );
@@ -723,7 +500,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
rInfo.m_aContext = rContext;
// clean up the mess
- m_pCUPSWrapper->ppdClose( pPPD );
+ ppdClose( pPPD );
}
#if OSL_DEBUG_LEVEL > 1
else
@@ -858,7 +635,7 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
{
OString aKey = OUStringToOString( pKey->getKey(), RTL_TEXTENCODING_ASCII_US );
OString aValue = OUStringToOString( pValue->m_aOption, RTL_TEXTENCODING_ASCII_US );
- rNumOptions = m_pCUPSWrapper->cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, (cups_option_t**)rOptions );
+ rNumOptions = cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, (cups_option_t**)rOptions );
}
}
}
@@ -866,11 +643,11 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner
if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
{
rtl::OString aVal( rtl::OString::valueOf( sal_Int32( rJob.m_nCopies ) ) );
- rNumOptions = m_pCUPSWrapper->cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions );
+ rNumOptions = cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions );
}
if( ! bBanner )
{
- rNumOptions = m_pCUPSWrapper->cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions );
+ rNumOptions = cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions );
}
}
@@ -906,7 +683,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, (void**)&pOptions );
cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second;
- nJobID = m_pCUPSWrapper->cupsPrintFile( pDest->name,
+ nJobID = cupsPrintFile( pDest->name,
it->second.getStr(),
OUStringToOString( rJobTitle, aEnc ).getStr(),
nNumOptions, pOptions );
@@ -930,7 +707,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
unlink( it->second.getStr() );
m_aSpoolFiles.erase( pFile );
if( pOptions )
- m_pCUPSWrapper->cupsFreeOptions( nNumOptions, pOptions );
+ cupsFreeOptions( nNumOptions, pOptions );
}
return nJobID;
@@ -972,7 +749,7 @@ bool CUPSManager::checkPrintersChanged( bool bWait )
// there is no way to query CUPS whether the printer list has changed
// so get the dest list anew
if( m_nDests && m_pDests )
- m_pCUPSWrapper->cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests );
+ cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests );
m_nDests = 0;
m_pDests = NULL;
runDests();
@@ -1027,7 +804,7 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName )
for( int i = 0; i < m_nDests; i++ )
pDests[i].is_default = 0;
pDests[ nit->second ].is_default = 1;
- m_pCUPSWrapper->cupsSetDests( m_nDests, (cups_dest_t*)m_pDests );
+ cupsSetDests( m_nDests, (cups_dest_t*)m_pDests );
m_aDefaultPrinter = rName;
m_aCUPSMutex.release();
bSuccess = true;
@@ -1072,11 +849,11 @@ bool CUPSManager::writePrinterConfig()
{
OString aName = OUStringToOString( pKey->getKey(), aEncoding );
OString aValue = OUStringToOString( pValue->m_aOption, aEncoding );
- nNewOptions = m_pCUPSWrapper->cupsAddOption( aName.getStr(), aValue.getStr(), nNewOptions, &pNewOptions );
+ nNewOptions = cupsAddOption( aName.getStr(), aValue.getStr(), nNewOptions, &pNewOptions );
}
}
// set PPD options on CUPS dest
- m_pCUPSWrapper->cupsFreeOptions( pDest->num_options, pDest->options );
+ cupsFreeOptions( pDest->num_options, pDest->options );
pDest->num_options = nNewOptions;
pDest->options = pNewOptions;
m_aCUPSMutex.release();
@@ -1084,7 +861,7 @@ bool CUPSManager::writePrinterConfig()
}
if( bDestModified && m_aCUPSMutex.tryToAcquire() )
{
- m_pCUPSWrapper->cupsSetDests( m_nDests, (cups_dest_t*)m_pDests );
+ cupsSetDests( m_nDests, (cups_dest_t*)m_pDests );
m_aCUPSMutex.release();
}
@@ -1111,14 +888,14 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
{
osl::MutexGuard aGuard( m_aCUPSMutex );
- OString aUser = m_pCUPSWrapper->cupsUser();
- OString aServer = m_pCUPSWrapper->cupsServer();
+ OString aUser = cupsUser();
+ OString aServer = cupsServer();
OString aPassword;
if( getpw( aServer, aUser, aPassword ) )
{
m_aPassword = aPassword;
m_aUser = aUser;
- m_pCUPSWrapper->cupsSetUser( m_aUser.getStr() );
+ cupsSetUser( m_aUser.getStr() );
pRet = m_aPassword.getStr();
}
}
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index baec393..42b05fc 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -655,7 +655,7 @@ const PPDParser* PPDParser::getParser( const String& rFile )
PrinterInfoManager& rMgr = PrinterInfoManager::get();
if( rMgr.getType() == PrinterInfoManager::CUPS )
{
-#ifdef HAVE_CUPS_H
+#ifdef ENABLE_CUPS
pNewParser = const_cast<PPDParser*>(static_cast<CUPSManager&>(rMgr).createCUPSParser( aFile ));
#endif
}
commit c20ba023c738c0c76a07c94cb43c0a6d06f12374
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 12 23:24:07 2012 +0100
XubString->OUString
Change-Id: Ic8b191dfb0d14e129dc804aeb4ac14c732e72e6b
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2fa0bb2..876748c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2154,7 +2154,7 @@ inline bool lcl_FormatHasNegColor( const SvNumberformat* pFormat )
inline bool lcl_FormatHasOpenPar( const SvNumberformat* pFormat )
{
- return pFormat && (pFormat->GetFormatstring().Search( '(' ) != STRING_NOTFOUND);
+ return pFormat && (pFormat->GetFormatstring().indexOf('(') != -1);
}
namespace {
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 5b7ab38..0d82c0f 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -242,9 +242,9 @@ class SVL_DLLPUBLIC NfCurrencyEntry
private:
// nDecimalFormat := 0, 1, 2
- // #,##0 or #,##0.00 or #,##0.-- are assigned
- SVL_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&,
- const LocaleDataWrapper&, sal_uInt16 nDecimalFormat ) const;
+ // #,##0 or #,##0.00 or #,##0.-- is returned
+ SVL_DLLPRIVATE OUString Impl_BuildFormatStringNumChars(
+ const LocaleDataWrapper&, sal_uInt16 nDecimalFormat) const;
public:
@@ -268,10 +268,10 @@ public:
sal_Unicode GetZeroChar() const { return cZeroChar; }
/** [$DM-407] (bBank==false) or [$DEM] (bBank==true)
- is assigned to rStr, if bBank==false and
+ is returned. If bBank==false and
bWithoutExtension==true only [$DM] */
- void BuildSymbolString( String& rStr, bool bBank,
- bool bWithoutExtension = false ) const;
+ OUString BuildSymbolString(bool bBank,
+ bool bWithoutExtension = false) const;
/** #,##0.00 [$DM-407] is assigned to rStr, separators
from rLoc, incl. minus sign but without [RED] */
@@ -870,7 +870,7 @@ private:
// Test whether format code already exists, then return index key,
// otherwise NUMBERFORMAT_ENTRY_NOT_FOUND
- SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString,
+ SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const OUString& rString,
sal_uInt32 CLOffset,
LanguageType eLnge );
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 05a30e2..f94e62d 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -221,7 +221,7 @@ public:
LanguageType GetLanguage() const { return maLocale.meLanguage;}
- const String& GetFormatstring() const { return sFormatstring; }
+ const OUString& GetFormatstring() const { return sFormatstring; }
// Build a format string of application defined keywords
String GetMappedFormatstring( const NfKeywordTable& rKeywords,
@@ -458,7 +458,7 @@ public:
private:
ImpSvNumFor NumFor[4]; // Array for the 4 subformats
- String sFormatstring; // The format code string
+ OUString sFormatstring; // The format code string
String sComment; // Comment, since number formatter version 6
double fLimit1; // Value for first condition
double fLimit2; // Value for second condition
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index e459655..cdc689a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -856,7 +856,7 @@ sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
return nOffset;
}
-sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString,
+sal_uInt32 SvNumberFormatter::ImpIsEntry(const OUString& rString,
sal_uInt32 nCLOffset,
LanguageType eLnge)
{
@@ -3322,7 +3322,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat,
*ppEntry = pFoundEntry;
if ( pBank )
*pBank = bFoundBank;
- pFoundEntry->BuildSymbolString( rStr, bFoundBank );
+ rStr = pFoundEntry->BuildSymbolString(bFoundBank);
}
}
if ( !rStr.Len() )
@@ -3778,50 +3778,53 @@ bool NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const
;
}
-void NfCurrencyEntry::BuildSymbolString( String& rStr, bool bBank,
- bool bWithoutExtension ) const
+OUString NfCurrencyEntry::BuildSymbolString(bool bBank,
+ bool bWithoutExtension) const
{
- rStr = '[';
- rStr += '$';
- if ( bBank )
- rStr += aBankSymbol;
+ OUStringBuffer aBuf("[$");
+ if (bBank)
+ aBuf.append(aBankSymbol);
else
{
if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND )
{
- rStr += '"';
- rStr += aSymbol;
- rStr += '"';
+ aBuf.append('"').append(aSymbol).append('"');
}
else
- rStr += aSymbol;
+ {
+ aBuf.append(aSymbol);
+ }
if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM )
{
- rStr += '-';
- rStr += String::CreateFromInt32( sal_Int32( eLanguage ), 16 ).ToUpperAscii();
+ sal_Int32 nLang = static_cast<sal_Int32>(eLanguage);
+ aBuf.append('-').append(
+ OUString::valueOf(nLang, 16).toAsciiUpperCase());
}
}
- rStr += ']';
+ aBuf.append(']');
+ return aBuf.makeStringAndClear();
}
-
-void NfCurrencyEntry::Impl_BuildFormatStringNumChars( String& rStr,
- const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
+OUString NfCurrencyEntry::Impl_BuildFormatStringNumChars(
+ const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat) const
{
- rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) );
- rStr.Insert( rLoc.getNumThousandSep(), 1 );
- if ( nDecimalFormat && nDigits )
+ OUStringBuffer aBuf;
+ aBuf.append('#').append(rLoc.getNumThousandSep()).append("##0");
+ if (nDecimalFormat && nDigits)
{
- rStr += rLoc.getNumDecimalSep();
- rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) );
+ aBuf.append(rLoc.getNumDecimalSep());
+ sal_Unicode cDecimalChar = nDecimalFormat == 2 ? '-' : cZeroChar;
+ for (sal_uInt16 i = 0; i < nDigits; ++i)
+ aBuf.append(cDecimalChar);
}
+ return aBuf.makeStringAndClear();
}
void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, bool bBank,
const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
+ rStr = Impl_BuildFormatStringNumChars(rLoc, nDecimalFormat);
sal_uInt16 nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
rLoc.getCurrPositiveFormat(), nPositiveFormat, bBank );
CompletePositiveFormatString( rStr, bBank, nPosiForm );
@@ -3831,7 +3834,7 @@ void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, bool bBank,
const LocaleDataWrapper& rLoc, sal_uInt16 nDecimalFormat ) const
{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
+ rStr = Impl_BuildFormatStringNumChars(rLoc, nDecimalFormat);
sal_uInt16 nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
rLoc.getCurrNegativeFormat(), nNegativeFormat, bBank );
CompleteNegativeFormatString( rStr, bBank, nNegaForm );
@@ -3841,8 +3844,7 @@ void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, bool bBank,
sal_uInt16 nPosiForm ) const
{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
+ String aSymStr = BuildSymbolString(bBank);
NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm );
}
@@ -3850,8 +3852,7 @@ void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, bool bBank,
void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, bool bBank,
sal_uInt16 nNegaForm ) const
{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
+ String aSymStr = BuildSymbolString(bBank);
NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm );
}
diff --git a/svtools/inc/svtools/fmtfield.hxx b/svtools/inc/svtools/fmtfield.hxx
index d4fd75a..2bef4f3 100644
--- a/svtools/inc/svtools/fmtfield.hxx
+++ b/svtools/inc/svtools/fmtfield.hxx
@@ -125,7 +125,7 @@ public:
void GetColor() const;
- void SetTextValue(const XubString& rText);
+ void SetTextValue(const OUString& rText);
// der String wird in ein double umgewandelt (durch den Formatter) und anschliessen in SetValue gesteckt
sal_Bool IsEmptyFieldEnabled() const { return m_bEnableEmptyField; }
@@ -159,8 +159,8 @@ public:
// Das hier gelieferte Objekt wird allerdings zwischen allen Instanzen der Klasse geteilt (aus Zeit- und Platzgruenden),
// also ist etwas Vorsicht angebracht ...
- void GetFormat(XubString& rFormatString, LanguageType& eLang) const;
- sal_Bool SetFormat(const XubString& rFormatString, LanguageType eLang);
+ OUString GetFormat(LanguageType& eLang) const;
+ sal_Bool SetFormat(const OUString& rFormatString, LanguageType eLang);
// sal_False, wenn der FormatString nicht gesetzt werden konnte (also wahrscheinlich ungueltig ist)
sal_Bool IsStrictFormat() const { return m_bStrictFormat; }
@@ -196,10 +196,10 @@ public:
einfach den Text formatiert ausgeben ...
(der Text wird einfach nur durch den Formatter gejagt und dann gesetzt)
*/
- void SetTextFormatted(const XubString& rText);
+ void SetTextFormatted(const OUString& rText);
String GetTextValue() const;
- void SetDefaultText(const XubString& rDefault) { m_sDefaultText = rDefault; }
+ void SetDefaultText(const OUString& rDefault) { m_sDefaultText = rDefault; }
String GetDefaultText() const { return m_sDefaultText; }
// die bei der letzten Ausgabe-Operation vom Formatter gelieferte Farbe (Ausgabe-Operationen werden getriggert durch
@@ -248,7 +248,7 @@ protected:
virtual void Modify();
// CheckText ueberschreiben fuer Ueberpruefung zur Eingabezeit
- virtual sal_Bool CheckText(const XubString&) const { return sal_True; }
+ virtual sal_Bool CheckText(const OUString&) const { return sal_True; }
// any aspect of the current format has changed
virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
@@ -291,7 +291,7 @@ public:
virtual ~DoubleNumericField();
protected:
- virtual sal_Bool CheckText(const XubString& sText) const;
+ virtual sal_Bool CheckText(const OUString& sText) const;
virtual void FormatChanged(FORMAT_CHANGE_TYPE nWhat);
void ResetConformanceTester();
diff --git a/svtools/inc/svtools/stdmenu.hxx b/svtools/inc/svtools/stdmenu.hxx
index 59d584c..3a936b0 100644
--- a/svtools/inc/svtools/stdmenu.hxx
+++ b/svtools/inc/svtools/stdmenu.hxx
@@ -113,7 +113,7 @@ FontList; FontNameMenu; FontSizeBox
class SVT_DLLPUBLIC FontNameMenu : public PopupMenu
{
private:
- XubString maCurName;
+ OUString maCurName;
Link maSelectHdl;
Link maHighlightHdl;
@@ -126,8 +126,8 @@ public:
void Fill( const FontList* pList );
- void SetCurName( const XubString& rName );
- const XubString& GetCurName() const { return maCurName; }
+ void SetCurName( const OUString& rName );
+ const OUString& GetCurName() const { return maCurName; }
void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
const Link& GetSelectHdl() const { return maSelectHdl; }
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index c59b1a5..d4a4c5b 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -395,7 +395,7 @@ void FormattedField::SetText( const XubString& rStr, const Selection& rNewSelect
}
//------------------------------------------------------------------------------
-void FormattedField::SetTextFormatted(const XubString& rStr)
+void FormattedField::SetTextFormatted(const OUString& rStr)
{
DBG_CHKTHIS(FormattedField, NULL);
@@ -628,9 +628,8 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset
}
else
{
- XubString sOldFormat;
LanguageType aOldLang;
- GetFormat(sOldFormat, aOldLang);
+ OUString sOldFormat = GetFormat(aOldLang);
sal_uInt32 nDestKey = pFormatter->TestNewString(sOldFormat);
if (nDestKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
@@ -652,17 +651,19 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset
}
//------------------------------------------------------------------------------
-void FormattedField::GetFormat(XubString& rFormatString, LanguageType& eLang) const
+OUString FormattedField::GetFormat(LanguageType& eLang) const
{
DBG_CHKTHIS(FormattedField, NULL);
const SvNumberformat* pFormatEntry = ImplGetFormatter()->GetEntry(m_nFormatKey);
DBG_ASSERT(pFormatEntry != NULL, "FormattedField::GetFormat: no number format for the given format key.");
- rFormatString = pFormatEntry ? pFormatEntry->GetFormatstring() : XubString();
+ OUString sFormatString = pFormatEntry ? pFormatEntry->GetFormatstring() : OUString();
eLang = pFormatEntry ? pFormatEntry->GetLanguage() : LANGUAGE_DONTKNOW;
+
+ return sFormatString;
}
//------------------------------------------------------------------------------
-sal_Bool FormattedField::SetFormat(const XubString& rFormatString, LanguageType eLang)
+sal_Bool FormattedField::SetFormat(const OUString& rFormatString, LanguageType eLang)
{
DBG_CHKTHIS(FormattedField, NULL);
sal_uInt32 nNewKey = ImplGetFormatter()->TestNewString(rFormatString, eLang);
@@ -709,8 +710,7 @@ void FormattedField::SetThousandsSep(sal_Bool _bUseSeparator)
// we need the language for the following
LanguageType eLang;
- String sFmtDescription;
- GetFormat(sFmtDescription, eLang);
+ String sFmtDescription = GetFormat(eLang);
// generate a new format ...
ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, _bUseSeparator, IsRed, nPrecision, nAnzLeading);
@@ -753,8 +753,7 @@ void FormattedField::SetDecimalDigits(sal_uInt16 _nPrecision)
// we need the language for the following
LanguageType eLang;
- String sFmtDescription;
- GetFormat(sFmtDescription, eLang);
+ String sFmtDescription = GetFormat(eLang);
// generate a new format ...
ImplGetFormatter()->GenerateFormat(sFmtDescription, m_nFormatKey, eLang, bThousand, IsRed, _nPrecision, nAnzLeading);
@@ -913,7 +912,7 @@ void FormattedField::SetMaxValue(double dMax)
}
//------------------------------------------------------------------------------
-void FormattedField::SetTextValue(const XubString& rText)
+void FormattedField::SetTextValue(const OUString& rText)
{
DBG_CHKTHIS(FormattedField, NULL);
SetText(rText);
@@ -1126,7 +1125,7 @@ void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat)
}
//------------------------------------------------------------------------------
-sal_Bool DoubleNumericField::CheckText(const XubString& sText) const
+sal_Bool DoubleNumericField::CheckText(const OUString& sText) const
{
// We'd like to implement this using the NumberFormatter::IsNumberFormat, but unfortunately, this doesn't
// recognize fragments of numbers (like, for instance "1e", which happens during entering e.g. "1e10")
@@ -1230,9 +1229,8 @@ void DoubleCurrencyField::setPrependCurrSym(sal_Bool _bPrepend)
void DoubleCurrencyField::UpdateCurrencyFormat()
{
// the old settings
- XubString sOldFormat;
LanguageType eLanguage;
- GetFormat(sOldFormat, eLanguage);
+ GetFormat(eLanguage);
sal_Bool bThSep = GetThousandsSep();
sal_uInt16 nDigits = GetDecimalDigits();
diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx
index 8bfe4b4..51af872 100644
--- a/svtools/source/control/stdmenu.cxx
+++ b/svtools/source/control/stdmenu.cxx
@@ -58,7 +58,7 @@ void FontNameMenu::Select()
void FontNameMenu::Highlight()
{
- XubString aTempName = maCurName;
+ OUString aTempName = maCurName;
maCurName = GetItemText( GetCurItemId() );
maHighlightHdl.Call( this );
maCurName = aTempName;
@@ -84,7 +84,7 @@ void FontNameMenu::Fill( const FontList* pList )
sal_uInt16 j = GetItemCount();
while ( j )
{
- XubString aText = GetItemText( GetItemId( j-1 ) );
+ OUString aText = GetItemText( GetItemId( j-1 ) );
if ( rI18nHelper.CompareString( rName, aText ) > 0 )
break;
j--;
@@ -97,7 +97,7 @@ void FontNameMenu::Fill( const FontList* pList )
// -----------------------------------------------------------------------
-void FontNameMenu::SetCurName( const XubString& rName )
+void FontNameMenu::SetCurName(const OUString& rName)
{
maCurName = rName;
@@ -111,7 +111,7 @@ void FontNameMenu::SetCurName( const XubString& rName )
if ( IsItemChecked( nItemId ) )
nChecked = nItemId;
- XubString aText = GetItemText( nItemId );
+ OUString aText = GetItemText( nItemId );
if ( aText == maCurName )
{
CheckItem( nItemId, sal_True );
@@ -240,8 +240,8 @@ void FontSizeMenu::SetCurHeight( long nHeight )
{
mnCurHeight = nHeight;
- // check menue item
- XubString aHeight = Application::GetSettings().GetUILocaleI18nHelper().GetNum( nHeight, 1, sal_True, sal_False );
+ // check menu item
+ OUString aHeight = Application::GetSettings().GetUILocaleI18nHelper().GetNum( nHeight, 1, sal_True, sal_False );
sal_uInt16 nChecked = 0;
sal_uInt16 nItemCount = GetItemCount();
for( sal_uInt16 i = 0; i < nItemCount; i++ )
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 30ff423..c143704 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -940,9 +940,9 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL
if(pTmpCurrencyEntry!=NULL)
{
- pTmpCurrencyEntry->BuildSymbolString(rSymbol,false);
- pTmpCurrencyEntry->BuildSymbolString(rBankSymbol,true);
- pTmpCurrencyEntry->BuildSymbolString(rShortSymbol,bTmpBanking,true);
+ rSymbol = pTmpCurrencyEntry->BuildSymbolString(false);
+ rBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true);
+ rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking,true);
}
SvNumberFormatTable::iterator it = pCurFmtTable->begin();
@@ -1722,9 +1722,8 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin
for(sal_uInt16 i=0;i<nCount;i++)
{
const NfCurrencyEntry* pTmpCurrencyEntry=&rCurrencyTable[i];
- XubString _aSymbol, aBankSymbol;
- pTmpCurrencyEntry->BuildSymbolString(_aSymbol,false);
- pTmpCurrencyEntry->BuildSymbolString(aBankSymbol,true);
+ OUString _aSymbol = pTmpCurrencyEntry->BuildSymbolString(false);
+ OUString aBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true);
if(rFmtString.Search(_aSymbol)!=STRING_NOTFOUND)
{
More information about the Libreoffice-commits
mailing list