summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/brand.cxx81
-rwxr-xr-xvcl/source/app/dbggui.cxx3
-rw-r--r--vcl/source/app/dndhelp.cxx2
-rw-r--r--vcl/source/app/help.cxx14
-rw-r--r--vcl/source/app/i18nhelp.cxx3
-rw-r--r--vcl/source/app/idlemgr.cxx88
-rw-r--r--vcl/source/app/salvtables.cxx2
-rw-r--r--vcl/source/app/session.cxx8
-rw-r--r--vcl/source/app/settings.cxx120
-rw-r--r--vcl/source/app/solarmutex.cxx57
-rw-r--r--vcl/source/app/sound.cxx4
-rw-r--r--vcl/source/app/stdtext.cxx3
-rw-r--r--vcl/source/app/svapp.cxx72
-rw-r--r--vcl/source/app/svdata.cxx24
-rw-r--r--vcl/source/app/svmain.cxx147
-rw-r--r--vcl/source/app/svmainhook.cxx11
-rw-r--r--vcl/source/app/timer.cxx5
-rw-r--r--vcl/source/app/unohelp.cxx28
-rw-r--r--vcl/source/app/unohelp2.cxx3
-rw-r--r--vcl/source/app/vclevent.cxx22
-rw-r--r--vcl/source/components/display.cxx3
-rw-r--r--vcl/source/components/dtranscomp.cxx22
-rw-r--r--vcl/source/components/factory.cxx7
-rw-r--r--vcl/source/components/fontident.cxx3
-rw-r--r--vcl/source/control/button.cxx200
-rw-r--r--vcl/source/control/combobox.cxx15
-rw-r--r--vcl/source/control/ctrl.cxx5
-rw-r--r--[-rwxr-xr-x]vcl/source/control/edit.cxx60
-rw-r--r--vcl/source/control/field.cxx93
-rw-r--r--vcl/source/control/field2.cxx12
-rw-r--r--vcl/source/control/fixbrd.cxx5
-rw-r--r--vcl/source/control/fixed.cxx63
-rw-r--r--vcl/source/control/group.cxx3
-rw-r--r--vcl/source/control/ilstbox.cxx87
-rw-r--r--vcl/source/control/imgctrl.cxx9
-rw-r--r--vcl/source/control/longcurr.cxx3
-rw-r--r--vcl/source/control/lstbox.cxx3
-rw-r--r--vcl/source/control/menubtn.cxx5
-rw-r--r--vcl/source/control/morebtn.cxx43
-rw-r--r--vcl/source/control/scrbar.cxx7
-rw-r--r--vcl/source/control/slider.cxx5
-rw-r--r--vcl/source/control/spinbtn.cxx5
-rw-r--r--vcl/source/control/spinfld.cxx5
-rw-r--r--vcl/source/control/tabctrl.cxx48
-rw-r--r--vcl/source/control/throbber.cxx2
-rw-r--r--vcl/source/fontsubset/cff.cxx64
-rw-r--r--vcl/source/fontsubset/fontsubset.cxx8
-rw-r--r--vcl/source/fontsubset/gsub.cxx7
-rw-r--r--vcl/source/fontsubset/gsub.h3
-rw-r--r--vcl/source/fontsubset/list.c274
-rw-r--r--vcl/source/fontsubset/sft.cxx681
-rw-r--r--vcl/source/fontsubset/ttcr.cxx16
-rw-r--r--vcl/source/fontsubset/ttcr.hxx3
-rw-r--r--vcl/source/fontsubset/xlat.cxx2
-rw-r--r--vcl/source/fontsubset/xlat.hxx2
-rw-r--r--vcl/source/gdi/alpha.cxx3
-rw-r--r--vcl/source/gdi/animate.cxx3
-rw-r--r--vcl/source/gdi/base14.cxx6
-rw-r--r--vcl/source/gdi/bitmap.cxx38
-rw-r--r--vcl/source/gdi/bitmap2.cxx56
-rw-r--r--vcl/source/gdi/bitmap3.cxx10
-rw-r--r--vcl/source/gdi/bitmap4.cxx14
-rw-r--r--vcl/source/gdi/bitmapex.cxx92
-rw-r--r--vcl/source/gdi/bmpacc.cxx5
-rw-r--r--vcl/source/gdi/bmpacc2.cxx3
-rw-r--r--vcl/source/gdi/bmpacc3.cxx3
-rw-r--r--vcl/source/gdi/bmpconv.cxx14
-rw-r--r--vcl/source/gdi/bmpfast.cxx60
-rw-r--r--vcl/source/gdi/configsettings.cxx14
-rw-r--r--vcl/source/gdi/cvtgrf.cxx3
-rw-r--r--vcl/source/gdi/cvtsvm.cxx14
-rw-r--r--vcl/source/gdi/extoutdevdata.cxx3
-rw-r--r--vcl/source/gdi/font.cxx6
-rw-r--r--vcl/source/gdi/gdimtf.cxx254
-rw-r--r--vcl/source/gdi/gfxlink.cxx3
-rw-r--r--vcl/source/gdi/gradient.cxx96
-rw-r--r--vcl/source/gdi/graph.cxx3
-rw-r--r--vcl/source/gdi/graphictools.cxx19
-rw-r--r--vcl/source/gdi/hatch.cxx5
-rw-r--r--vcl/source/gdi/image.cxx79
-rw-r--r--vcl/source/gdi/imagerepository.cxx14
-rw-r--r--vcl/source/gdi/impanmvw.cxx3
-rw-r--r--vcl/source/gdi/impanmvw.hxx3
-rw-r--r--vcl/source/gdi/impbmp.cxx3
-rw-r--r--vcl/source/gdi/impgraph.cxx12
-rw-r--r--vcl/source/gdi/impimage.cxx21
-rw-r--r--vcl/source/gdi/impimagetree.cxx48
-rw-r--r--vcl/source/gdi/impvect.cxx7
-rw-r--r--vcl/source/gdi/impvect.hxx3
-rw-r--r--vcl/source/gdi/jobset.cxx16
-rw-r--r--vcl/source/gdi/lineinfo.cxx3
-rwxr-xr-xvcl/source/gdi/makefile.mk109
-rw-r--r--vcl/source/gdi/mapmod.cxx3
-rw-r--r--vcl/source/gdi/metaact.cxx30
-rw-r--r--vcl/source/gdi/metric.cxx9
-rw-r--r--vcl/source/gdi/octree.cxx3
-rw-r--r--vcl/source/gdi/oldprintadaptor.cxx2
-rw-r--r--vcl/source/gdi/outdev.cxx74
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/outdev2.cxx33
-rwxr-xr-xvcl/source/gdi/outdev3.cxx307
-rw-r--r--vcl/source/gdi/outdev4.cxx100
-rw-r--r--vcl/source/gdi/outdev5.cxx13
-rw-r--r--vcl/source/gdi/outdev6.cxx25
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/outdevnative.cxx7
-rw-r--r--vcl/source/gdi/outmap.cxx92
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx9
-rw-r--r--vcl/source/gdi/pdffontcache.cxx2
-rw-r--r--vcl/source/gdi/pdffontcache.hxx3
-rw-r--r--vcl/source/gdi/pdfwriter.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx167
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx21
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx4
-rw-r--r--vcl/source/gdi/pngread.cxx35
-rw-r--r--vcl/source/gdi/pngwrite.cxx12
-rw-r--r--vcl/source/gdi/print.cxx11
-rw-r--r--vcl/source/gdi/print2.cxx9
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/print3.cxx56
-rw-r--r--vcl/source/gdi/regband.cxx3
-rw-r--r--vcl/source/gdi/region.cxx23
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/salgdilayout.cxx2
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/sallayout.cxx72
-rw-r--r--vcl/source/gdi/salmisc.cxx9
-rw-r--r--vcl/source/gdi/salnativewidgets-none.cxx4
-rw-r--r--[-rwxr-xr-x]vcl/source/gdi/textlayout.cxx5
-rw-r--r--vcl/source/gdi/virdev.cxx14
-rw-r--r--vcl/source/gdi/wall.cxx3
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx177
-rw-r--r--vcl/source/glyphs/gcach_ftyp.hxx32
-rw-r--r--[-rwxr-xr-x]vcl/source/glyphs/gcach_layout.cxx51
-rw-r--r--[-rwxr-xr-x]vcl/source/glyphs/gcach_rbmp.cxx3
-rw-r--r--vcl/source/glyphs/glyphcache.cxx11
-rw-r--r--vcl/source/glyphs/graphite_adaptors.cxx336
-rw-r--r--vcl/source/glyphs/graphite_cache.cxx200
-rw-r--r--vcl/source/glyphs/graphite_features.cxx236
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx977
-rw-r--r--vcl/source/glyphs/graphite_serverfont.cxx104
-rw-r--r--vcl/source/glyphs/graphite_textsrc.cxx13
-rw-r--r--vcl/source/glyphs/graphite_textsrc.hxx14
-rw-r--r--vcl/source/helper/canvasbitmap.cxx65
-rw-r--r--vcl/source/helper/canvastools.cxx19
-rw-r--r--vcl/source/helper/evntpost.cxx3
-rw-r--r--vcl/source/helper/lazydelete.cxx2
-rw-r--r--vcl/source/helper/strhelper.cxx3
-rw-r--r--vcl/source/helper/threadex.cxx5
-rw-r--r--vcl/source/helper/xconnection.cxx24
-rw-r--r--vcl/source/salmain/salmain.cxx5
-rw-r--r--vcl/source/src/btntext.src1
-rw-r--r--vcl/source/src/helptext.src23
-rw-r--r--vcl/source/src/images.src242
-rw-r--r--vcl/source/src/print.src10
-rw-r--r--[-rwxr-xr-x]vcl/source/src/throbber.src0
-rw-r--r--vcl/source/src/units.src3
-rw-r--r--vcl/source/window/abstdlg.cxx5
-rw-r--r--vcl/source/window/accel.cxx108
-rw-r--r--vcl/source/window/accmgr.cxx79
-rw-r--r--vcl/source/window/arrange.cxx2
-rw-r--r--vcl/source/window/brdwin.cxx50
-rw-r--r--vcl/source/window/btndlg.cxx208
-rw-r--r--vcl/source/window/cmdevt.cxx7
-rw-r--r--vcl/source/window/cursor.cxx3
-rw-r--r--vcl/source/window/decoview.cxx2
-rw-r--r--vcl/source/window/dialog.cxx23
-rw-r--r--vcl/source/window/dlgctrl.cxx5
-rw-r--r--vcl/source/window/dndevdis.cxx139
-rw-r--r--vcl/source/window/dndlcon.cxx3
-rw-r--r--vcl/source/window/dockingarea.cxx2
-rw-r--r--vcl/source/window/dockmgr.cxx5
-rw-r--r--vcl/source/window/dockwin.cxx4
-rw-r--r--vcl/source/window/floatwin.cxx10
-rw-r--r--vcl/source/window/introwin.cxx3
-rw-r--r--vcl/source/window/javachild.cxx3
-rw-r--r--vcl/source/window/keycod.cxx3
-rw-r--r--vcl/source/window/keyevent.cxx2
-rw-r--r--[-rwxr-xr-x]vcl/source/window/menu.cxx43
-rw-r--r--vcl/source/window/mnemonic.cxx3
-rw-r--r--vcl/source/window/mnemonicengine.cxx3
-rw-r--r--vcl/source/window/mouseevent.cxx3
-rw-r--r--vcl/source/window/msgbox.cxx90
-rw-r--r--vcl/source/window/popupmenuwindow.cxx2
-rw-r--r--[-rwxr-xr-x]vcl/source/window/printdlg.cxx203
-rw-r--r--vcl/source/window/scrwnd.cxx6
-rw-r--r--vcl/source/window/scrwnd.hxx3
-rw-r--r--vcl/source/window/seleng.cxx85
-rw-r--r--vcl/source/window/split.cxx3
-rw-r--r--vcl/source/window/splitwin.cxx46
-rw-r--r--vcl/source/window/status.cxx228
-rwxr-xr-xvcl/source/window/syschild.cxx11
-rw-r--r--vcl/source/window/syswin.cxx10
-rw-r--r--vcl/source/window/tabdlg.cxx4
-rw-r--r--vcl/source/window/tabpage.cxx10
-rw-r--r--vcl/source/window/taskpanelist.cxx22
-rwxr-xr-xvcl/source/window/toolbox.cxx204
-rw-r--r--vcl/source/window/toolbox2.cxx34
-rwxr-xr-xvcl/source/window/window.cxx298
-rw-r--r--vcl/source/window/window2.cxx115
-rw-r--r--vcl/source/window/window3.cxx3
-rw-r--r--vcl/source/window/winproc.cxx5
-rwxr-xr-xvcl/source/window/wrkwin.cxx17
198 files changed, 3768 insertions, 5590 deletions
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx
new file mode 100644
index 000000000000..1657be61c4ff
--- /dev/null
+++ b/vcl/source/app/brand.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Novell, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Michael Meeks <michael.meeks@novell.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include <rtl/ustring.hxx>
+#include <rtl/bootstrap.hxx>
+#include <rtl/locale.hxx>
+#include <osl/process.h>
+#include <tools/urlobj.hxx>
+#include <tools/stream.hxx>
+#include <vcl/pngread.hxx>
+#include <vcl/svapp.hxx>
+
+namespace {
+ static bool loadPng(const char *pPath, const rtl::OUString &rName, BitmapEx &rBitmap)
+ {
+ rtl::OUString uri = rtl::OUString::createFromAscii( pPath ) + rName;
+ rtl::Bootstrap::expandMacros( uri );
+ INetURLObject aObj( uri );
+ SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
+ if ( !aStrm.GetError() ) {
+ vcl::PNGReader aReader( aStrm );
+ rBitmap = aReader.Read();
+ return !rBitmap.IsEmpty();
+ }
+ else
+ return false;
+ }
+}
+
+bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
+{
+ // TODO - if we want more flexibility we could add a branding path
+ // in an rc file perhaps fallback to "about.bmp"
+ rtl::OUString aBaseName = ( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) +
+ rtl::OUString::createFromAscii( pName ) );
+ rtl::OUString aPng( RTL_CONSTASCII_USTRINGPARAM(".png") );
+
+ rtl_Locale *pLoc = NULL;
+ osl_getProcessLocale (&pLoc);
+ rtl::OLocale aLoc( pLoc );
+
+ rtl::OUString aName = aBaseName + aPng;
+ rtl::OUString aLocaleName = ( aBaseName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("-")) +
+ aLoc.getLanguage() +
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("_")) +
+ aLoc.getCountry() + aPng );
+
+ return ( loadPng ("$BRAND_BASE_DIR/program/edition", aLocaleName, rBitmap) ||
+ loadPng ("$BRAND_BASE_DIR/program", aLocaleName, rBitmap) ||
+ loadPng ("$BRAND_BASE_DIR/program/edition", aName, rBitmap) ||
+ loadPng ("$BRAND_BASE_DIR/program", aName, rBitmap) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 94ebbf3ad9d8..ccc509ced1f1 100755
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2036,3 +2037,5 @@ sal_uInt16 DbgRegisterNamedUserChannel( const XubString& _rChannelUIName, DbgPri
}
#endif // DBG_UTIL
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/dndhelp.cxx b/vcl/source/app/dndhelp.cxx
index d1eb2014b4df..ceaa8f904816 100644
--- a/vcl/source/app/dndhelp.cxx
+++ b/vcl/source/app/dndhelp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -180,3 +181,4 @@ void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::st
mpClient->dropActionChanged( rDTDE );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index ce582916ea62..75bab1a29694 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -381,12 +382,6 @@ HelpTextWindow::~HelpTextWindow()
if( this == ImplGetSVData()->maHelpData.mpHelpWin )
ImplGetSVData()->maHelpData.mpHelpWin = NULL;
-
- if ( maStatusText.Len() )
- {
- ImplSVData* pSVData = ImplGetSVData();
- pSVData->mpApp->HideHelpStatusText();
- }
}
// -----------------------------------------------------------------------
@@ -435,11 +430,6 @@ void HelpTextWindow::SetHelpText( const String& rHelpText )
void HelpTextWindow::ImplShow()
{
ImplDelData aDogTag( this );
- if ( maStatusText.Len() )
- {
- ImplSVData* pSVData = ImplGetSVData();
- pSVData->mpApp->ShowHelpStatusText( maStatusText );
- }
Show( sal_True, SHOW_NOACTIVATE );
if( !aDogTag.IsDelete() )
Update();
@@ -801,3 +791,5 @@ void ImplSetHelpWindowPos( Window* pHelpWin, sal_uInt16 nHelpWinStyle, sal_uInt1
aPos = pWindow->AbsoluteScreenToOutputPixel( aPos );
pHelpWin->SetPosPixel( aPos );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx
index b7ae51615c08..b55a988fa7da 100644
--- a/vcl/source/app/i18nhelp.cxx
+++ b/vcl/source/app/i18nhelp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -187,3 +188,5 @@ String vcl::I18nHelper::GetNum( long nNumber, sal_uInt16 nDecimals, sal_Bool bUs
{
return ImplGetLocaleDataWrapper().getNum( nNumber, nDecimals, bUseThousandSep, bTrailingZeros );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx
index de1c2b985f4a..57547d80a007 100644
--- a/vcl/source/app/idlemgr.cxx
+++ b/vcl/source/app/idlemgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/list.hxx>
#include <vcl/svapp.hxx>
@@ -43,15 +43,13 @@ struct ImplIdleData
sal_Bool mbTimeout;
};
-DECLARE_LIST( ImplIdleList, ImplIdleData* )
-
#define IMPL_IDLETIMEOUT 350
// =======================================================================
ImplIdleMgr::ImplIdleMgr()
{
- mpIdleList = new ImplIdleList( 8, 8, 8 );
+ mpIdleList = new ImplIdleList();
maTimer.SetTimeout( IMPL_IDLETIMEOUT );
maTimer.SetTimeoutHdl( LINK( this, ImplIdleMgr, TimeoutHdl ) );
@@ -62,13 +60,10 @@ ImplIdleMgr::ImplIdleMgr()
ImplIdleMgr::~ImplIdleMgr()
{
// Liste loeschen
- ImplIdleData* pIdleData = mpIdleList->First();
- while ( pIdleData )
- {
- delete pIdleData;
- pIdleData = mpIdleList->Next();
+ for ( size_t i = 0, n = mpIdleList->size(); i < n; ++i ) {
+ delete (*mpIdleList)[ i ];
}
-
+ mpIdleList->clear();
delete mpIdleList;
}
@@ -76,30 +71,30 @@ ImplIdleMgr::~ImplIdleMgr()
sal_Bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority )
{
- sal_uLong nPos = LIST_APPEND;
- ImplIdleData* pIdleData = mpIdleList->First();
- while ( pIdleData )
- {
- // Wenn Link schon existiert, dann gebe sal_False zurueck
- if ( pIdleData->maIdleHdl == rLink )
+ size_t nPos = (size_t)-1;
+ size_t n = mpIdleList->size();
+ for ( size_t i = 0; i < n; ++i ) {
+ // we need to check each element to verify that rLink isn't in the array
+ if ( (*mpIdleList)[ i ]->maIdleHdl == rLink ) {
return sal_False;
-
- // Nach Prioritaet sortieren
- if ( nPriority <= pIdleData->mnPriority )
- nPos = mpIdleList->GetCurPos();
-
- // Schleife nicht beenden, da noch
- // geprueft werden muss, ob sich der Link
- // schon in der Liste befindet
-
- pIdleData = mpIdleList->Next();
+ }
+ if ( nPriority <= (*mpIdleList)[ i ]->mnPriority ) {
+ nPos = i;
+ }
}
- pIdleData = new ImplIdleData;
+ ImplIdleData* pIdleData = new ImplIdleData;
pIdleData->maIdleHdl = rLink;
pIdleData->mnPriority = nPriority;
pIdleData->mbTimeout = sal_False;
- mpIdleList->Insert( pIdleData, nPos );
+
+ if ( nPos < mpIdleList->size() ) {
+ ImplIdleList::iterator it = mpIdleList->begin();
+ ::std::advance( it, nPos );
+ mpIdleList->insert( it, pIdleData );
+ } else {
+ mpIdleList->push_back( pIdleData );
+ }
// Wenn Timer noch nicht gestartet ist, dann starten
if ( !maTimer.IsActive() )
@@ -112,21 +107,16 @@ sal_Bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority )
void ImplIdleMgr::RemoveIdleHdl( const Link& rLink )
{
- ImplIdleData* pIdleData = mpIdleList->First();
- while ( pIdleData )
- {
- if ( pIdleData->maIdleHdl == rLink )
- {
- mpIdleList->Remove();
- delete pIdleData;
+ for ( ImplIdleList::iterator it = mpIdleList->begin(); it < mpIdleList->end(); ++it ) {
+ if ( (*it)->maIdleHdl == rLink ) {
+ delete *it;
+ mpIdleList->erase( it );
break;
}
-
- pIdleData = mpIdleList->Next();
}
// keine Handdler mehr da
- if ( !mpIdleList->Count() )
+ if ( mpIdleList->empty() )
maTimer.Stop();
}
@@ -134,20 +124,22 @@ void ImplIdleMgr::RemoveIdleHdl( const Link& rLink )
IMPL_LINK( ImplIdleMgr, TimeoutHdl, Timer*, EMPTYARG )
{
- ImplIdleData* pIdleData = mpIdleList->First();
- while ( pIdleData )
- {
- if ( !pIdleData->mbTimeout )
- {
+ for ( size_t i = 0; i < mpIdleList->size(); ++i ) {
+ ImplIdleData* pIdleData = (*mpIdleList)[ i ];
+ if ( !pIdleData->mbTimeout ) {
pIdleData->mbTimeout = sal_True;
pIdleData->maIdleHdl.Call( GetpApp() );
- // Kann im Handler entfernt worden sein
- if ( mpIdleList->GetPos( pIdleData ) != LIST_ENTRY_NOTFOUND )
- pIdleData->mbTimeout = sal_False;
+ // May have been removed in the handler
+ for ( size_t j = 0; j < mpIdleList->size(); ++j ) {
+ if ( (*mpIdleList)[ j ] == pIdleData ) {
+ pIdleData->mbTimeout = sal_False;
+ break;
+ }
+ }
}
-
- pIdleData = mpIdleList->Next();
}
return 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3bb06c03ebdb..d30637f1e54e 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -161,3 +162,4 @@ SalMenuItem::~SalMenuItem()
{
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx
index 780d91c4e41a..afcbab4bcc71 100644
--- a/vcl/source/app/session.cxx
+++ b/vcl/source/app/session.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,7 +54,8 @@ namespace css = com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::frame;
-using namespace rtl;
+
+using ::rtl::OUString;
SalSession::~SalSession()
{
@@ -366,7 +368,7 @@ OUString SAL_CALL vcl_session_getImplementationName()
Sequence< rtl::OUString > SAL_CALL vcl_session_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.frame.SessionManagerClient");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.SessionManagerClient"));
return aRet;
}
@@ -378,3 +380,5 @@ css::uno::Reference< XInterface > SAL_CALL vcl_session_createInstance( const css
return css::uno::Reference< XInterface >(pSVData->xSMClient, UNO_QUERY );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 55974b57815c..64cdeab7b61f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-
+#include <svsys.h>
#include "tools/debug.hxx"
#include "i18npool/mslangid.hxx"
@@ -48,17 +49,10 @@
#include "unotools/confignode.hxx"
#include "unotools/syslocaleoptions.hxx"
-#ifdef WNT
-#include "tools/prewin.h"
-#include <windows.h>
-#include "tools/postwin.h"
-#endif
+using ::rtl::OUString;
#include "svdata.hxx"
#include "impimagetree.hxx"
-
-using namespace rtl;
-
// =======================================================================
DBG_NAME( AllSettings )
@@ -436,6 +430,7 @@ ImplStyleData::ImplStyleData()
mnAutoMnemonic = 1;
mnToolbarIconSize = STYLE_TOOLBAR_ICONSIZE_UNKNOWN;
mnSymbolsStyle = STYLE_SYMBOLS_AUTO;
+ mnUseImagesInMenus = STYLE_MENUIMAGES_AUTO;
mnPreferredSymbolsStyle = STYLE_SYMBOLS_AUTO;
mpFontOptions = NULL;
@@ -536,7 +531,9 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
mnUseFlatMenues = rData.mnUseFlatMenues;
mnAutoMnemonic = rData.mnAutoMnemonic;
mnUseImagesInMenus = rData.mnUseImagesInMenus;
+ mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus;
+ mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus;
mnToolbarIconSize = rData.mnToolbarIconSize;
mnSymbolsStyle = rData.mnSymbolsStyle;
mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle;
@@ -562,8 +559,8 @@ void ImplStyleData::SetStandardStyles()
maPushButtonFont = aStdFont;
maFieldFont = aStdFont;
maIconFont = aStdFont;
- maFloatTitleFont = aStdFont;
aStdFont.SetWeight( WEIGHT_BOLD );
+ maFloatTitleFont = aStdFont;
maTitleFont = aStdFont;
maFaceColor = Color( COL_LIGHTGRAY );
@@ -623,8 +620,9 @@ void ImplStyleData::SetStandardStyles()
mnUseSystemUIFonts = 1;
mnUseFlatBorders = 0;
mnUseFlatMenues = 0;
- mnUseImagesInMenus = (sal_uInt16)sal_True;
+ mbPreferredUseImagesInMenus = sal_True;
mnSkipDisabledInMenus = (sal_uInt16)sal_False;
+ mnAcceleratorsInContextMenus = sal_True;
Gradient aGrad( GRADIENT_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
maWorkspaceGradient = Wallpaper( aGrad );
@@ -696,36 +694,39 @@ void StyleSettings::Set3DColors( const Color& rColor )
{
switch ( nStyle )
{
- case STYLE_SYMBOLS_DEFAULT: return ::rtl::OUString::createFromAscii( "default" );
- case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString::createFromAscii( "hicontrast" );
- case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" );
- case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" );
- case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" );
- case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" );
- case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" );
+ case STYLE_SYMBOLS_DEFAULT: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"));
+ case STYLE_SYMBOLS_HICONTRAST: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hicontrast"));
+ case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango")); // industrial is dead
+ case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("crystal"));
+ case STYLE_SYMBOLS_TANGO: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango"));
+ case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("oxygen"));
+ case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("classic"));
+ case STYLE_SYMBOLS_HUMAN: return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("human"));
}
- return ::rtl::OUString::createFromAscii( "auto" );
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("auto"));
}
// -----------------------------------------------------------------------
sal_uLong StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) const
{
- if ( rName == ::rtl::OUString::createFromAscii( "default" ) )
+ if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default")) )
return STYLE_SYMBOLS_DEFAULT;
- else if ( rName == ::rtl::OUString::createFromAscii( "hicontrast" ) )
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hicontrast")) )
return STYLE_SYMBOLS_HICONTRAST;
- else if ( rName == ::rtl::OUString::createFromAscii( "industrial" ) )
- return STYLE_SYMBOLS_INDUSTRIAL;
- else if ( rName == ::rtl::OUString::createFromAscii( "crystal" ) )
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("industrial")) )
+ return STYLE_SYMBOLS_TANGO; // industrial is dead
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("crystal")) )
return STYLE_SYMBOLS_CRYSTAL;
- else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) )
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tango")) )
return STYLE_SYMBOLS_TANGO;
- else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) )
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("oxygen")) )
return STYLE_SYMBOLS_OXYGEN;
- else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) )
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("classic")) )
return STYLE_SYMBOLS_CLASSIC;
+ else if ( rName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("human")) )
+ return STYLE_SYMBOLS_HUMAN;
return STYLE_SYMBOLS_AUTO;
}
@@ -811,7 +812,8 @@ sal_uLong StyleSettings::GetAutoSymbolsStyle() const
if( bCont )
{
- if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
+ if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) ||
+ rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "windows" ) )
nRet = STYLE_SYMBOLS_TANGO;
else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
nRet = STYLE_SYMBOLS_CRYSTAL;
@@ -851,12 +853,28 @@ sal_uLong StyleSettings::GetAutoSymbolsStyle() const
bool StyleSettings::CheckSymbolStyle( sal_uLong nStyle ) const
{
+ if ( nStyle == STYLE_SYMBOLS_INDUSTRIAL )
+ return false; // industrial is dead
+
static ImplImageTreeSingletonRef aImageTree;
return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) );
}
// -----------------------------------------------------------------------
+sal_Bool StyleSettings::GetUseImagesInMenus() const
+{
+ // icon mode selected in Tools -> Options... -> OpenOffice.org -> View
+ sal_uInt16 nStyle = mpData->mnUseImagesInMenus;
+
+ if ( nStyle == STYLE_MENUIMAGES_AUTO )
+ return GetPreferredUseImagesInMenus();
+
+ return (sal_Bool)nStyle;
+}
+
+// -----------------------------------------------------------------------
+
void StyleSettings::SetStandardStyles()
{
CopyData();
@@ -1063,7 +1081,9 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const
(mpData->maFieldFont == rSet.mpData->maFieldFont) &&
(mpData->maIconFont == rSet.mpData->maIconFont) &&
(mpData->mnUseImagesInMenus == rSet.mpData->mnUseImagesInMenus) &&
+ (mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) &&
(mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) &&
+ (mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) &&
(mpData->maFontColor == rSet.mpData->maFontColor ))
return sal_True;
else
@@ -1253,7 +1273,7 @@ void MiscSettings::SetDisablePrinting( sal_Bool bEnable )
vcl::SettingsConfigItem::get()->
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DesktopManagement" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisablePrinting" ) ),
- rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) );
+ bEnable ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false" )) );
mpData->mnDisablePrinting = bEnable ? 1 : 0;
}
}
@@ -1309,7 +1329,7 @@ void MiscSettings::SetEnableATToolSupport( sal_Bool bEnable )
vcl::SettingsConfigItem::get()->
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Accessibility" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableATToolSupport" ) ),
- rtl::OUString::createFromAscii( bEnable ? "true" : "false" ) );
+ bEnable ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false" )) );
mpData->mnEnableATT = bEnable ? 1 : 0;
}
}
@@ -1525,8 +1545,6 @@ ImplAllSettingsData::ImplAllSettingsData()
meUILanguage = LANGUAGE_SYSTEM;
mpLocaleDataWrapper = NULL;
mpUILocaleDataWrapper = NULL;
- mpCollatorWrapper = NULL;
- mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() );
@@ -1552,8 +1570,6 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) :
// called
mpLocaleDataWrapper = NULL;
mpUILocaleDataWrapper = NULL;
- mpCollatorWrapper = NULL;
- mpUICollatorWrapper = NULL;
mpI18nHelper = NULL;
mpUII18nHelper = NULL;
}
@@ -1566,10 +1582,6 @@ ImplAllSettingsData::~ImplAllSettingsData()
delete mpLocaleDataWrapper;
if ( mpUILocaleDataWrapper )
delete mpUILocaleDataWrapper;
- if ( mpCollatorWrapper )
- delete mpCollatorWrapper;
- if ( mpUICollatorWrapper )
- delete mpUICollatorWrapper;
if ( mpI18nHelper )
delete mpI18nHelper;
if ( mpUII18nHelper )
@@ -1890,11 +1902,11 @@ sal_Bool AllSettings::GetLayoutRTL() const
nUIMirroring = 0; // ask configuration only once
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
vcl::unohelper::GetMultiServiceFactory(),
- OUString::createFromAscii( "org.openoffice.Office.Common/I18N/CTL" ) ); // note: case sensisitive !
+ OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/I18N/CTL")) ); // note: case sensisitive !
if ( aNode.isValid() )
{
sal_Bool bTmp = sal_Bool();
- ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "UIMirroring" ) );
+ ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("UIMirroring")) );
if( aValue >>= bTmp )
{
// found true or false; if it was nil, nothing is changed
@@ -1997,32 +2009,6 @@ const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
return *mpData->mpUII18nHelper;
}
-
-// -----------------------------------------------------------------------
-/*
-const CollatorWrapper& AllSettings::GetCollatorWrapper() const
-{
- if ( !mpData->mpCollatorWrapper )
- {
- ((AllSettings*)this)->mpData->mpCollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
- ((AllSettings*)this)->mpData->mpCollatorWrapper->loadDefaultCollator( GetLocale(), 0 );
- }
- return *mpData->mpCollatorWrapper;
-}
-*/
-// -----------------------------------------------------------------------
-/*
-const CollatorWrapper& AllSettings::GetUICollatorWrapper() const
-{
- if ( !mpData->mpUICollatorWrapper )
- {
- ((AllSettings*)this)->mpData->mpUICollatorWrapper = new CollatorWrapper( vcl::unohelper::GetMultiServiceFactory() );
- ((AllSettings*)this)->mpData->mpUICollatorWrapper->loadDefaultCollator( GetUILocale(), 0 );
- }
- return *mpData->mpUICollatorWrapper;
-}
-*/
-
void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
{
AllSettings aAllSettings( Application::GetSettings() );
@@ -2042,3 +2028,5 @@ void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint )
Application::SetSettings( aAllSettings );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/solarmutex.cxx b/vcl/source/app/solarmutex.cxx
new file mode 100644
index 000000000000..6423a74e6c61
--- /dev/null
+++ b/vcl/source/app/solarmutex.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <vcl/solarmutex.hxx>
+
+using namespace vcl;
+
+SolarMutexObject::SolarMutexObject() : m_solarMutex( osl_createMutex() )
+{
+}
+
+SolarMutexObject::~SolarMutexObject()
+{
+ osl_destroyMutex( m_solarMutex );
+}
+
+void SolarMutexObject::acquire()
+{
+ osl_acquireMutex( m_solarMutex );
+}
+
+sal_Bool SolarMutexObject::tryToAcquire()
+{
+ return osl_tryToAcquireMutex( m_solarMutex );
+}
+
+void SolarMutexObject::release()
+{
+ osl_releaseMutex( m_solarMutex );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/vcl/source/app/sound.cxx b/vcl/source/app/sound.cxx
index 9c9caa81da49..5fe5b5d38143 100644
--- a/vcl/source/app/sound.cxx
+++ b/vcl/source/app/sound.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,6 @@
#include <unotools/localfilehelper.hxx>
#include <unotools/ucbstreamhelper.hxx>
-
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/salbtype.hxx>
@@ -57,3 +57,5 @@ void Sound::Beep( SoundType eType, Window* pWindow )
else
pWindow->ImplGetFrame()->Beep( eType );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx
index bbe09eb1b411..d33fbd7da71f 100644
--- a/vcl/source/app/stdtext.cxx
+++ b/vcl/source/app/stdtext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -64,3 +65,5 @@ void ShowServiceNotAvailableError( Window* pParent,
aBox.Execute();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index da70672b7b2d..fe536addac98 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,8 +40,6 @@
#include "rtl/tencinfo.h"
#include "rtl/instance.hxx"
-#include "vos/process.hxx"
-#include "vos/mutex.hxx"
#include "tools/tools.h"
#include "tools/debug.hxx"
@@ -78,6 +77,8 @@
#include "com/sun/star/awt/XToolkit.hpp"
#include "com/sun/star/uno/XNamingService.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "osl/mutex.hxx"
+#include "osl/process.h"
#include <utility>
@@ -145,7 +146,6 @@ namespace
}
-// #include <usr/refl.hxx>
class Reflection;
@@ -272,12 +272,6 @@ void Application::ShowStatusText( const XubString& )
// -----------------------------------------------------------------------
-void Application::ShowHelpStatusText( const XubString& )
-{
-}
-
-// -----------------------------------------------------------------------
-
void Application::ActivateExtHelp()
{
}
@@ -296,24 +290,23 @@ void Application::HideStatusText()
// -----------------------------------------------------------------------
-void Application::HideHelpStatusText()
+void Application::FocusChanged()
{
}
// -----------------------------------------------------------------------
-void Application::FocusChanged()
+void Application::DataChanged( const DataChangedEvent& )
{
}
// -----------------------------------------------------------------------
-
-void Application::DataChanged( const DataChangedEvent& )
+void Application::Init()
{
}
// -----------------------------------------------------------------------
-void Application::Init()
+void Application::InitFinished()
{
}
@@ -327,18 +320,16 @@ void Application::DeInit()
sal_uInt16 Application::GetCommandLineParamCount()
{
- vos::OStartupInfo aStartInfo;
- return (sal_uInt16)aStartInfo.getCommandArgCount();
+ return (sal_uInt16)osl_getCommandArgCount();
}
// -----------------------------------------------------------------------
XubString Application::GetCommandLineParam( sal_uInt16 nParam )
{
- vos::OStartupInfo aStartInfo;
- rtl::OUString aParam;
- aStartInfo.getCommandArg( nParam, aParam );
- return XubString( aParam );
+ rtl::OUString aParam;
+ osl_getCommandArg( nParam, &aParam.pData );
+ return aParam;
}
// -----------------------------------------------------------------------
@@ -357,10 +348,8 @@ const XubString& Application::GetAppFileName()
static String aAppFileName;
if( !aAppFileName.Len() )
{
- vos::OStartupInfo aStartInfo;
- ::rtl::OUString aExeFileName;
-
- aStartInfo.getExecutableFile( aExeFileName );
+ rtl::OUString aExeFileName;
+ osl_getExecutableFile( &aExeFileName.pData );
// convert path to native file format
rtl::OUString aNativeFileName;
@@ -527,7 +516,7 @@ void Application::Quit()
// -----------------------------------------------------------------------
-vos::IMutex& Application::GetSolarMutex()
+osl::SolarMutex& Application::GetSolarMutex()
{
ImplSVData* pSVData = ImplGetSVData();
return *(pSVData->mpDefInst->GetYieldMutex());
@@ -535,7 +524,7 @@ vos::IMutex& Application::GetSolarMutex()
// -----------------------------------------------------------------------
-vos::OThread::TThreadIdentifier Application::GetMainThreadIdentifier()
+oslThreadIdentifier Application::GetMainThreadIdentifier()
{
return ImplGetSVData()->mnMainThreadId;
}
@@ -850,8 +839,7 @@ void Application::ImplCallEventListeners( sal_uLong nEvent, Window *pWin, void*
VclWindowEvent aEvent( pWin, nEvent, pData );
if ( pSVData->maAppData.mpEventListeners )
- if ( !pSVData->maAppData.mpEventListeners->empty() )
- pSVData->maAppData.mpEventListeners->Call( &aEvent );
+ pSVData->maAppData.mpEventListeners->Call( &aEvent );
}
// -----------------------------------------------------------------------
@@ -861,8 +849,7 @@ void Application::ImplCallEventListeners( VclSimpleEvent* pEvent )
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maAppData.mpEventListeners )
- if ( !pSVData->maAppData.mpEventListeners->empty() )
- pSVData->maAppData.mpEventListeners->Call( pEvent );
+ pSVData->maAppData.mpEventListeners->Call( pEvent );
}
// -----------------------------------------------------------------------
@@ -872,7 +859,7 @@ void Application::AddEventListener( const Link& rEventListener )
ImplSVData* pSVData = ImplGetSVData();
if( !pSVData->maAppData.mpEventListeners )
pSVData->maAppData.mpEventListeners = new VclEventListeners;
- pSVData->maAppData.mpEventListeners->push_back( rEventListener );
+ pSVData->maAppData.mpEventListeners->addListener( rEventListener );
}
// -----------------------------------------------------------------------
@@ -881,7 +868,7 @@ void Application::RemoveEventListener( const Link& rEventListener )
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maAppData.mpEventListeners )
- pSVData->maAppData.mpEventListeners->remove( rEventListener );
+ pSVData->maAppData.mpEventListeners->removeListener( rEventListener );
}
// -----------------------------------------------------------------------
@@ -890,7 +877,7 @@ void Application::AddKeyListener( const Link& rKeyListener )
ImplSVData* pSVData = ImplGetSVData();
if( !pSVData->maAppData.mpKeyListeners )
pSVData->maAppData.mpKeyListeners = new VclEventListeners;
- pSVData->maAppData.mpKeyListeners->push_back( rKeyListener );
+ pSVData->maAppData.mpKeyListeners->addListener( rKeyListener );
}
// -----------------------------------------------------------------------
@@ -899,7 +886,7 @@ void Application::RemoveKeyListener( const Link& rKeyListener )
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maAppData.mpKeyListeners )
- pSVData->maAppData.mpKeyListeners->remove( rKeyListener );
+ pSVData->maAppData.mpKeyListeners->removeListener( rKeyListener );
}
// -----------------------------------------------------------------------
@@ -913,8 +900,7 @@ sal_Bool Application::HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyE
sal_Bool bProcessed = sal_False;
if ( pSVData->maAppData.mpKeyListeners )
- if ( !pSVData->maAppData.mpKeyListeners->empty() )
- bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent );
+ bProcessed = pSVData->maAppData.mpKeyListeners->Process( &aEvent );
return bProcessed;
}
@@ -923,7 +909,7 @@ sal_Bool Application::HandleKey( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyE
sal_uLong Application::PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* pKeyEvent )
{
- const ::vos::OGuard aGuard( GetSolarMutex() );
+ const SolarMutexGuard aGuard;
sal_uLong nEventId = 0;
if( pWin && pKeyEvent )
@@ -950,7 +936,7 @@ sal_uLong Application::PostKeyEvent( sal_uLong nEvent, Window *pWin, KeyEvent* p
sal_uLong Application::PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEvent* pMouseEvent )
{
- const ::vos::OGuard aGuard( GetSolarMutex() );
+ const SolarMutexGuard aGuard;
sal_uLong nEventId = 0;
if( pWin && pMouseEvent )
@@ -985,7 +971,7 @@ sal_uLong Application::PostMouseEvent( sal_uLong nEvent, Window *pWin, MouseEven
IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData )
{
- const ::vos::OGuard aGuard( GetSolarMutex() );
+ const SolarMutexGuard aGuard;
ImplPostEventData* pData = static_cast< ImplPostEventData * >( pCallData );
const void* pEventData;
sal_uLong nEvent;
@@ -1048,7 +1034,7 @@ IMPL_STATIC_LINK_NOINSTANCE( Application, PostEventHandler, void*, pCallData )
void Application::RemoveMouseAndKeyEvents( Window* pWin )
{
- const ::vos::OGuard aGuard( GetSolarMutex() );
+ const SolarMutexGuard aGuard;
// remove all events for specific window, watch for destruction of internal data
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
@@ -1072,7 +1058,7 @@ void Application::RemoveMouseAndKeyEvents( Window* pWin )
sal_Bool Application::IsProcessedMouseOrKeyEvent( sal_uLong nEventId )
{
- const ::vos::OGuard aGuard( GetSolarMutex() );
+ const SolarMutexGuard aGuard;
// find event
::std::list< ImplPostEventPair >::iterator aIter( aPostedEventList.begin() );
@@ -1601,7 +1587,7 @@ Window* Application::GetDefDialogParent()
// check for corrupted window hierarchy, #122232#, may be we now crash somewhere else
if( !pWin->mpWindowImpl )
{
- DBG_ERROR( "Window hierarchy corrupted!" );
+ OSL_FAIL( "Window hierarchy corrupted!" );
pSVData->maWinData.mpFocusWin = NULL; // avoid further access
return NULL;
}
@@ -2091,3 +2077,5 @@ void Application::SetPropertyHandler( PropertyHandler* p )
void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
{
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 51bbbef353a8..409b4dee1da7 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,11 +31,12 @@
#include <string.h>
-#include "rtl/instance.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
-#include "osl/process.h"
-#include "osl/file.hxx"
+#include <osl/file.hxx>
+#include <osl/mutex.hxx>
+#include <rtl/process.h>
#include "tools/debug.hxx"
#include "tools/resary.hxx"
@@ -53,7 +55,6 @@
#include "vcl/unohelp.hxx"
#include "vcl/button.hxx" // for Button::GetStandardText
#include "vcl/dockwin.hxx" // for DockingManager
-
#include "salinst.hxx"
#include "salframe.hxx"
#include "svdata.hxx"
@@ -81,7 +82,7 @@ namespace css = com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::awt;
-using namespace rtl;
+using ::rtl::OUString;
// =======================================================================
@@ -130,7 +131,7 @@ void ImplInitSVData()
{
rtl::OUString aArg;
osl_getCommandArg( i, &aArg.pData );
- if( aArg.equalsAscii( "-enableautomation" ) )
+ if( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-enableautomation" ) ) )
{
pImplSVData->mbIsTestTool = true;
break;
@@ -331,7 +332,7 @@ com::sun::star::uno::Any AccessBridgeCurrentContext::getValueByName( const rtl::
throw (com::sun::star::uno::RuntimeException)
{
com::sun::star::uno::Any ret;
- if( Name.equalsAscii( "java-vm.interaction-handler" ) )
+ if( Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "java-vm.interaction-handler" ) ) )
{
// Currently, for accessbility no interaction handler shall be offered.
// There may be introduced later on a handler using native toolkits
@@ -392,14 +393,14 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
new AccessBridgeCurrentContext( com::sun::star::uno::getCurrentContext() ) );
pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
- OUString::createFromAscii( "com.sun.star.accessibility.AccessBridge" ),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessBridge")),
arguments
);
}
else
{
pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
- OUString::createFromAscii( "com.sun.star.accessibility.AccessBridge" ),
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessBridge")),
arguments
);
}
@@ -521,11 +522,11 @@ bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
String aTitle;
String aMessage(ResId(SV_ACCESSERROR_BRIDGE_MSG, *pResMgr));
- if( 0 == e.Message.compareTo(::rtl::OUString::createFromAscii("ClassNotFound"), 13) )
+ if( 0 == e.Message.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ClassNotFound")), 13) )
{
aTitle = String(ResId(SV_ACCESSERROR_MISSING_BRIDGE, *pResMgr));
}
- else if( 0 == e.Message.compareTo(::rtl::OUString::createFromAscii("NoSuchMethod"), 12) )
+ else if( 0 == e.Message.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NoSuchMethod")), 12) )
{
aTitle = String(ResId(SV_ACCESSERROR_WRONG_VERSION, *pResMgr));
}
@@ -599,3 +600,4 @@ void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadc
AllSettings::LocaleSettingsChanged( nHint );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index d819b52f7944..b54ebd855433 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -55,10 +56,9 @@
#include "vcl/lazydelete.hxx"
#ifdef WNT
-#include <tools/prewin.h>
+#include <svsys.h>
#include <process.h> // for _beginthreadex
#include <ole2.h> // for _beginthreadex
-#include <tools/postwin.h>
#endif
// [ed 5/14/02 Add in explicit check for quartz graphics. OS X will define
@@ -86,6 +86,7 @@
#include "impimagetree.hxx"
#include "xconnection.hxx"
+#include "osl/process.h"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/lang/XComponent.hpp"
@@ -97,31 +98,14 @@
#include "rtl/strbuf.hxx"
#endif
-namespace {
-
-namespace css = com::sun::star;
-
-}
-
-using namespace ::rtl;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-
+using ::rtl::OUString;
+using namespace ::com::sun::star;
// =======================================================================
-class ImplVCLExceptionHandler : public ::vos::OSignalHandler
-{
-public:
- virtual ::vos::OSignalHandler::TSignalAction SAL_CALL signal( ::vos::OSignalHandler::TSignalInfo* pInfo );
-};
-
-// -----------------------------------------------------------------------
-
-::vos::OSignalHandler::TSignalAction SAL_CALL ImplVCLExceptionHandler::signal( ::vos::OSignalHandler::TSignalInfo* pInfo )
+oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo)
{
- static sal_Bool bIn = sal_False;
+ static bool bIn = false;
// Wenn wir nocheinmal abstuerzen, verabschieden wir uns gleich
if ( !bIn )
@@ -152,9 +136,9 @@ public:
if ( nVCLException )
{
- bIn = sal_True;
+ bIn = true;
- ::vos::OGuard aLock(&Application::GetSolarMutex());
+ SolarMutexGuard aLock;
// Timer nicht mehr anhalten, da ansonsten die UAE-Box
// auch nicht mehr gepaintet wird
@@ -166,17 +150,18 @@ public:
pSVData->mpApp->Exception( nVCLException );
Application::SetSystemWindowMode( nOldMode );
}
- bIn = sal_False;
+ bIn = false;
- return vos::OSignalHandler::TAction_CallNextHandler;
+ return osl_Signal_ActCallNextHdl;
}
}
- return vos::OSignalHandler::TAction_CallNextHandler;
+ return osl_Signal_ActCallNextHdl;
+
}
// =======================================================================
-sal_Bool ImplSVMain()
+int ImplSVMain()
{
// The 'real' SVMain()
RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::SVMain" );
@@ -185,8 +170,9 @@ sal_Bool ImplSVMain()
DBG_ASSERT( pSVData->mpApp, "no instance of class Application" );
- css::uno::Reference<XMultiServiceFactory> xMS;
+ uno::Reference<lang::XMultiServiceFactory> xMS;
+ int nReturn = EXIT_FAILURE;
sal_Bool bInit = InitVCL( xMS );
@@ -194,7 +180,7 @@ sal_Bool ImplSVMain()
{
// Application-Main rufen
pSVData->maAppData.mbInAppMain = sal_True;
- pSVData->mpApp->Main();
+ nReturn = pSVData->mpApp->Main();
pSVData->maAppData.mbInAppMain = sal_False;
}
@@ -209,7 +195,7 @@ sal_Bool ImplSVMain()
// be some events in the AWT EventQueue, which need the SolarMutex which
// - on the other hand - is destroyed in DeInitVCL(). So empty the queue
// here ..
- css::uno::Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY);
+ uno::Reference< lang::XComponent > xComponent(pSVData->mxAccessBridge, uno::UNO_QUERY);
if( xComponent.is() )
{
sal_uLong nCount = Application::ReleaseSolarMutex();
@@ -219,17 +205,17 @@ sal_Bool ImplSVMain()
}
DeInitVCL();
- return bInit;
+ return nReturn;
}
-sal_Bool SVMain()
+int SVMain()
{
// #i47888# allow for alternative initialization as required for e.g. MacOSX
- extern sal_Bool ImplSVMainHook( sal_Bool* );
+ extern sal_Bool ImplSVMainHook( int* );
- sal_Bool bInit;
- if( ImplSVMainHook( &bInit ) )
- return bInit;
+ int nRet;
+ if( ImplSVMainHook( &nRet ) )
+ return nRet;
else
return ImplSVMain();
}
@@ -237,12 +223,12 @@ sal_Bool SVMain()
// before SVInit is called
static Application * pOwnSvApp = NULL;
// Exception handler. pExceptionHandler != NULL => VCL already inited
-ImplVCLExceptionHandler * pExceptionHandler = NULL;
+oslSignalHandler pExceptionHandler = NULL;
class Application_Impl : public Application
{
public:
- void Main(){};
+ int Main() { return EXIT_SUCCESS; };
};
class DesktopEnvironmentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
@@ -259,13 +245,13 @@ private:
com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext;
};
-Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (RuntimeException)
+uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (uno::RuntimeException)
{
- Any retVal;
+ uno::Any retVal;
- if ( 0 == Name.compareToAscii( "system.desktop-environment" ) )
+ if (Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("system.desktop-environment")))
{
- retVal = makeAny( Application::GetDesktopEnvironment() );
+ retVal = uno::makeAny( Application::GetDesktopEnvironment() );
}
else if( m_xNextContext.is() )
{
@@ -303,11 +289,7 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang
pSVData->maAppData.mxMSF = rSMgr;
// Main-Thread-Id merken
- pSVData->mnMainThreadId = ::vos::OThread::getCurrentIdentifier();
-
- vos::OStartupInfo aStartInfo;
- rtl::OUString aExeFileName;
-
+ pSVData->mnMainThreadId = ::osl::Thread::getCurrentIdentifier();
// Sal initialisieren
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ ::CreateSalInstance" );
@@ -328,7 +310,8 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang
// Den AppFileName gleich holen und absolut machen, bevor das
// WorkingDirectory sich aendert...
- aStartInfo.getExecutableFile( aExeFileName );
+ rtl::OUString aExeFileName;
+ osl_getExecutableFile( &aExeFileName.pData );
// convert path to native file format
rtl::OUString aNativeFileName;
@@ -341,7 +324,7 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang
pSVData->maGDIData.mpGrfConverter = new GraphicConverter;
// Exception-Handler setzen
- pExceptionHandler = new ImplVCLExceptionHandler();
+ pExceptionHandler = osl_addSignalHandler(VCLExceptionSignal_impl, NULL);
// Debug-Daten initialisieren
DBGGUI_INIT();
@@ -349,6 +332,33 @@ sal_Bool InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang
return sal_True;
}
+namespace
+{
+
+/** Serves for destroying the VCL UNO wrapper as late as possible. This avoids
+ crash at exit in some special cases when a11y is enabled (e.g., when
+ a bundled extension is registered/deregistered during startup, forcing exit
+ while the app is still in splash screen.)
+ */
+class VCLUnoWrapperDeleter : public cppu::WeakImplHelper1<com::sun::star::lang::XEventListener>
+{
+ virtual void SAL_CALL disposing(lang::EventObject const& rSource) throw(uno::RuntimeException);
+};
+
+void
+VCLUnoWrapperDeleter::disposing(lang::EventObject const& /* rSource */)
+ throw(uno::RuntimeException)
+{
+ ImplSVData* const pSVData = ImplGetSVData();
+ if (pSVData && pSVData->mpUnoWrapper)
+ {
+ pSVData->mpUnoWrapper->Destroy();
+ pSVData->mpUnoWrapper = NULL;
+ }
+}
+
+}
+
void DeInitVCL()
{
ImplSVData* pSVData = ImplGetSVData();
@@ -388,7 +398,7 @@ void DeInitVCL()
ImplImageTreeSingletonRef()->shutDown();
- delete pExceptionHandler;
+ osl_removeSignalHandler( pExceptionHandler);
pExceptionHandler = NULL;
// Debug Daten zuruecksetzen
@@ -413,11 +423,6 @@ void DeInitVCL()
delete pSVData->maWinData.mpMsgBoxImgList;
pSVData->maWinData.mpMsgBoxImgList = NULL;
}
- if ( pSVData->maWinData.mpMsgBoxHCImgList )
- {
- delete pSVData->maWinData.mpMsgBoxHCImgList;
- pSVData->maWinData.mpMsgBoxHCImgList = NULL;
- }
if ( pSVData->maCtrlData.mpCheckImgList )
{
delete pSVData->maCtrlData.mpCheckImgList;
@@ -458,32 +463,32 @@ void DeInitVCL()
delete pSVData->maCtrlData.mpDisclosurePlus;
pSVData->maCtrlData.mpDisclosurePlus = NULL;
}
- if ( pSVData->maCtrlData.mpDisclosurePlusHC )
- {
- delete pSVData->maCtrlData.mpDisclosurePlusHC;
- pSVData->maCtrlData.mpDisclosurePlusHC = NULL;
- }
if ( pSVData->maCtrlData.mpDisclosureMinus )
{
delete pSVData->maCtrlData.mpDisclosureMinus;
pSVData->maCtrlData.mpDisclosureMinus = NULL;
}
- if ( pSVData->maCtrlData.mpDisclosureMinusHC )
- {
- delete pSVData->maCtrlData.mpDisclosureMinusHC;
- pSVData->maCtrlData.mpDisclosureMinusHC = NULL;
- }
if ( pSVData->mpDefaultWin )
{
delete pSVData->mpDefaultWin;
pSVData->mpDefaultWin = NULL;
}
- // #114285# Moved here from ImplDeInitSVData...
if ( pSVData->mpUnoWrapper )
{
- pSVData->mpUnoWrapper->Destroy();
- pSVData->mpUnoWrapper = NULL;
+ try
+ {
+ uno::Reference<lang::XComponent> const xDesktop(
+ comphelper::createProcessComponent(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))),
+ uno::UNO_QUERY_THROW)
+ ;
+ xDesktop->addEventListener(new VCLUnoWrapperDeleter());
+ }
+ catch (uno::Exception const&)
+ {
+ // ignore
+ }
}
pSVData->maAppData.mxMSF.clear();
@@ -648,3 +653,5 @@ void JoinMainLoopThread()
#endif
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svmainhook.cxx b/vcl/source/app/svmainhook.cxx
index 789af7efbe2b..dd446125a7aa 100644
--- a/vcl/source/app/svmainhook.cxx
+++ b/vcl/source/app/svmainhook.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,7 @@
#ifndef MACOSX
-sal_Bool ImplSVMainHook( sal_Bool * )
+sal_Bool ImplSVMainHook( int * )
{
return sal_False; // indicate that ImplSVMainHook is not implemented
}
@@ -56,7 +57,7 @@ static void SourceContextCallBack( void *pInfo )
struct ThreadContext
{
- sal_Bool* pRet;
+ int* pRet;
CFRunLoopRef* pRunLoopRef;
};
@@ -75,7 +76,7 @@ static void RunSVMain(void *pData)
_exit( 0 );
}
-sal_Bool ImplSVMainHook( sal_Bool *pbInit )
+sal_Bool ImplSVMainHook( int *pnInit )
{
// Mac OS X requires that any Cocoa code have a CFRunLoop started in the
// primordial thread. Since all of the AWT classes in Java 1.4 and higher
@@ -86,7 +87,7 @@ sal_Bool ImplSVMainHook( sal_Bool *pbInit )
CFRunLoopRef runLoopRef = CFRunLoopGetCurrent();
ThreadContext tcx;
- tcx.pRet = pbInit; // the return value
+ tcx.pRet = pnInit; // the return value
tcx.pRunLoopRef = &runLoopRef;
oslThread hThreadID = osl_createThread(RunSVMain, &tcx);
@@ -114,3 +115,5 @@ sal_Bool ImplSVMainHook( sal_Bool *pbInit )
#endif // MACOSX
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/timer.cxx b/vcl/source/app/timer.cxx
index ec421651637e..fc2242522433 100644
--- a/vcl/source/app/timer.cxx
+++ b/vcl/source/app/timer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -318,7 +319,7 @@ void Timer::Start()
}
else if( !mpTimerData->mpSVTimer ) // TODO: remove when guilty found
{
- DBG_ERROR( "Timer::Start() on a destroyed Timer!" );
+ OSL_FAIL( "Timer::Start() on a destroyed Timer!" );
}
else
{
@@ -376,3 +377,5 @@ AutoTimer& AutoTimer::operator=( const AutoTimer& rTimer )
Timer::operator=( rTimer );
return *this;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx
index c67abda51f60..57508219d8de 100644
--- a/vcl/source/app/unohelp.cxx
+++ b/vcl/source/app/unohelp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,7 +46,6 @@
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
-#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/awt/XExtendedToolkit.hpp>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -103,7 +103,7 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact
{
pSVData->maAppData.mxMSF = ::cppu::createRegistryServiceFactory( aTempFileName, rtl::OUString(), sal_False );
uno::Reference < registry::XImplementationRegistration > xReg(
- pSVData->maAppData.mxMSF->createInstance( OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )), uno::UNO_QUERY );
+ pSVData->maAppData.mxMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))), uno::UNO_QUERY );
if( xReg.is() )
{
@@ -116,7 +116,7 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact
try
{
xReg->registerImplementation(
- OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),aComponentPathString, NULL );
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")),aComponentPathString, NULL );
}
catch( ::com::sun::star::uno::Exception & )
{
@@ -142,7 +142,7 @@ uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator()
uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory();
if ( xMSF.is() )
{
- uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
+ uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) );
if ( xI.is() )
{
uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) );
@@ -158,7 +158,7 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte
uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory();
if ( xMSF.is() )
{
- uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.CharacterClassification" ) );
+ uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.CharacterClassification")) );
if ( xI.is() )
{
uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCharacterClassification >*)0) );
@@ -168,22 +168,6 @@ uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacte
return xB;
}
-uno::Reference < i18n::XCollator > vcl::unohelper::CreateCollator()
-{
- uno::Reference < i18n::XCollator > xB;
- uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory();
- if ( xMSF.is() )
- {
- uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.i18n.Collator" ) );
- if ( xI.is() )
- {
- uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XCollator >*)0) );
- x >>= xB;
- }
- }
- return xB;
-}
-
::rtl::OUString vcl::unohelper::CreateLibraryName( const sal_Char* pModName, sal_Bool bSUPD )
{
// create variable library name suffixes
@@ -234,3 +218,5 @@ void vcl::unohelper::NotifyAccessibleStateEventGlobally( const ::com::sun::star:
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/unohelp2.cxx b/vcl/source/app/unohelp2.cxx
index 514d95032d6f..1fe4158433a0 100644
--- a/vcl/source/app/unohelp2.cxx
+++ b/vcl/source/app/unohelp2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -110,3 +111,5 @@ namespace vcl { namespace unohelper {
}
}} // namespace vcl::unohelper
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 33f22a3a50d5..0ce3cc90f633 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -58,8 +59,11 @@ Reference<XAccessible> VclAccessibleEvent::GetAccessible() const
void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
{
+ if ( m_aListeners.empty() )
+ return;
+
// Copy the list, because this can be destroyed when calling a Link...
- std::list<Link> aCopy( *this );
+ std::list<Link> aCopy( m_aListeners );
std::list<Link>::iterator aIter( aCopy.begin() );
if( pEvent->IsA( VclWindowEvent::StaticType() ) )
{
@@ -83,9 +87,12 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const
{
+ if ( m_aListeners.empty() )
+ return sal_False;
+
sal_Bool bProcessed = sal_False;
// Copy the list, because this can be destroyed when calling a Link...
- std::list<Link> aCopy( *this );
+ std::list<Link> aCopy( m_aListeners );
std::list<Link>::iterator aIter( aCopy.begin() );
while ( aIter != aCopy.end() )
{
@@ -99,6 +106,16 @@ sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const
return bProcessed;
}
+void VclEventListeners::addListener( const Link& rListener )
+{
+ m_aListeners.push_back( rListener );
+}
+
+void VclEventListeners::removeListener( const Link& rListener )
+{
+ m_aListeners.remove( rListener );
+}
+
VclEventListeners2::VclEventListeners2()
{
}
@@ -150,3 +167,4 @@ void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent )
m_aIterators.pop_back();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/components/display.cxx b/vcl/source/components/display.cxx
index 6d7653968229..39f2613ac6b5 100644
--- a/vcl/source/components/display.cxx
+++ b/vcl/source/components/display.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -343,3 +344,5 @@ Sequence< OUString > SAL_CALL DisplayAccess::getSupportedServiceNames( ) throw
}
} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx
index f988c58f953e..b089db6e387e 100644
--- a/vcl/source/components/dtranscomp.cxx
+++ b/vcl/source/components/dtranscomp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,8 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include "vos/mutex.hxx"
-
#include "osl/mutex.hxx"
#include "vcl/svapp.hxx"
@@ -147,7 +146,7 @@ rtl::OUString GenericClipboard::getImplementationName_static()
Sequence< rtl::OUString > GenericClipboard::getSupportedServiceNames_static()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard"));
return aRet;
}
@@ -274,7 +273,7 @@ Reference< XInterface > ClipboardFactory::createInstance() throw()
Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Sequence< Any >& arguments ) throw()
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateClipboard( arguments );
return xResult;
}
@@ -284,7 +283,7 @@ Reference< XInterface > ClipboardFactory::createInstanceWithArguments( const Seq
Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames()
{
Sequence< OUString > aRet(1);
- aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.clipboard.SystemClipboard");
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard"));
return aRet;
}
@@ -337,13 +336,13 @@ public:
static Sequence< OUString > getSupportedServiceNames_static()
{
Sequence< OUString > aRet( 1 );
- aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDragSource" );
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.GenericDragSource"));
return aRet;
}
static OUString getImplementationName_static()
{
- return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDragSource" );
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.VclGenericDragSource"));
}
};
@@ -412,7 +411,7 @@ OUString SAL_CALL DragSource_getImplementationName()
Reference< XInterface > SAL_CALL DragSource_createInstance( const Reference< XMultiServiceFactory >& )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDragSource();
return xResult;
}
@@ -449,13 +448,13 @@ public:
static Sequence< OUString > getSupportedServiceNames_static()
{
Sequence< OUString > aRet( 1 );
- aRet[0] = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.GenericDropTarget" );
+ aRet[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.GenericDropTarget"));
return aRet;
}
static OUString getImplementationName_static()
{
- return OUString::createFromAscii( "com.sun.star.datatransfer.dnd.VclGenericDropTarget" );
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.VclGenericDropTarget"));
}
};
@@ -527,7 +526,7 @@ OUString SAL_CALL DropTarget_getImplementationName()
Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMultiServiceFactory >& )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
Reference< XInterface > xResult = ImplGetSVData()->mpDefInst->CreateDropTarget();
return xResult;
}
@@ -553,3 +552,4 @@ Reference< XInterface > SalInstance::CreateDropTarget()
return Reference< XInterface >( ( cppu::OWeakObject * )new vcl::GenericDropTarget() );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
index 48fb3aac653a..04b0e122cbce 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,12 +29,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
#include <tools/debug.hxx>
-#ifndef _OSL_MUTEX_HXX
#include <osl/mutex.hxx>
-#endif
-#ifndef _RTL_USTRBUF_HXX
#include <rtl/ustrbuf.hxx>
-#endif
#include <uno/dispatcher.h> // declaration of generic uno interface
#include <uno/mapping.hxx> // mapping stuff
#include <cppuhelper/factory.hxx>
@@ -163,3 +160,5 @@ extern "C" {
}
} /* extern "C" */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx
index 2cbea1628f4e..6afadbbe267e 100644
--- a/vcl/source/components/fontident.cxx
+++ b/vcl/source/components/fontident.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -209,3 +210,5 @@ Sequence< OUString > SAL_CALL FontIdentificator::getSupportedServiceNames() thro
}
} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1a6439a0502e..c6cd35fed964 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -78,9 +79,7 @@ public:
sal_Bool mbSmallSymbol;
Image maImage;
- Image maImageHC;
BitmapEx* mpBitmapEx;
- BitmapEx* mpBitmapExHC;
ImageAlign meImageAlign;
SymbolAlign meSymbolAlign;
@@ -96,7 +95,6 @@ ImplCommonButtonData::ImplCommonButtonData()
mbSmallSymbol = sal_False;
mpBitmapEx = NULL;
- mpBitmapExHC = NULL;
meImageAlign = IMAGEALIGN_TOP;
meSymbolAlign = SYMBOLALIGN_LEFT;
}
@@ -105,7 +103,6 @@ ImplCommonButtonData::ImplCommonButtonData()
ImplCommonButtonData::~ImplCommonButtonData()
{
delete mpBitmapEx;
- delete mpBitmapExHC;
}
// =======================================================================
@@ -181,8 +178,16 @@ XubString Button::GetStandardText( StandardButtonType eButton )
ResMgr* pResMgr = ImplGetResMgr();
if( pResMgr )
{
- ResId aResId( aResIdAry[(sal_uInt16)eButton].nResId, *pResMgr );
+ sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId;
+ ResId aResId( nResId, *pResMgr );
aText = String( aResId );
+
+ // Windows (apparently) has some magic auto-accelerator evil around
+ // ok / cancel so add this only for Unix
+#ifdef UNX
+ if( nResId == SV_BUTTONTEXT_OK || nResId == SV_BUTTONTEXT_CANCEL )
+ aText.Insert( String::CreateFromAscii("~"), 0 );
+#endif
}
else
{
@@ -200,51 +205,24 @@ XubString Button::GetStandardHelpText( StandardButtonType /* eButton */ )
return aHelpText;
}
// -----------------------------------------------------------------------
-sal_Bool Button::SetModeImage( const Image& rImage, BmpColorMode eMode )
+sal_Bool Button::SetModeImage( const Image& rImage )
{
- if( eMode == BMP_COLOR_NORMAL )
+ if ( rImage != mpButtonData->maImage )
{
- if ( rImage != mpButtonData->maImage )
- {
- delete mpButtonData->mpBitmapEx;
+ delete mpButtonData->mpBitmapEx;
- mpButtonData->mpBitmapEx = NULL;
- mpButtonData->maImage = rImage;
-
- StateChanged( STATE_CHANGE_DATA );
- }
- }
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- if( rImage != mpButtonData->maImageHC )
- {
- delete mpButtonData->mpBitmapExHC;
+ mpButtonData->mpBitmapEx = NULL;
+ mpButtonData->maImage = rImage;
- mpButtonData->mpBitmapExHC = NULL;
- mpButtonData->maImageHC = rImage;
-
- StateChanged( STATE_CHANGE_DATA );
- }
+ StateChanged( STATE_CHANGE_DATA );
}
- else
- return sal_False;
-
return sal_True;
}
// -----------------------------------------------------------------------
-const Image Button::GetModeImage( BmpColorMode eMode ) const
+const Image Button::GetModeImage( ) const
{
- if( eMode == BMP_COLOR_NORMAL )
- {
- return mpButtonData->maImage;
- }
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- return mpButtonData->maImageHC;
- }
- else
- return Image();
+ return mpButtonData->maImage;
}
// -----------------------------------------------------------------------
@@ -270,43 +248,24 @@ ImageAlign Button::GetImageAlign() const
}
// -----------------------------------------------------------------------
-sal_Bool Button::SetModeBitmap( const BitmapEx& rBitmap, BmpColorMode eMode )
+sal_Bool Button::SetModeBitmap( const BitmapEx& rBitmap )
{
- if ( SetModeImage( rBitmap, eMode ) )
+ if ( SetModeImage( rBitmap ) )
{
- if( eMode == BMP_COLOR_NORMAL )
- {
- if ( !mpButtonData->mpBitmapEx )
- mpButtonData->mpBitmapEx = new BitmapEx( rBitmap );
- }
- else if ( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- if ( !mpButtonData->mpBitmapExHC )
- mpButtonData->mpBitmapExHC = new BitmapEx( rBitmap );
- }
- else
- return sal_False;
-
+ if ( !mpButtonData->mpBitmapEx )
+ mpButtonData->mpBitmapEx = new BitmapEx( rBitmap );
return sal_True;
}
return sal_False;
}
// -----------------------------------------------------------------------
-BitmapEx Button::GetModeBitmap( BmpColorMode eMode ) const
+BitmapEx Button::GetModeBitmap( ) const
{
BitmapEx aBmp;
- if ( eMode == BMP_COLOR_NORMAL )
- {
- if ( mpButtonData->mpBitmapEx )
- aBmp = *( mpButtonData->mpBitmapEx );
- }
- else if ( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- if ( mpButtonData->mpBitmapExHC )
- aBmp = *( mpButtonData->mpBitmapExHC );
- }
+ if ( mpButtonData->mpBitmapEx )
+ aBmp = *( mpButtonData->mpBitmapEx );
return aBmp;
}
@@ -420,15 +379,6 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
Image *pImage = &(mpButtonData->maImage);
BitmapEx *pBitmapEx = mpButtonData->mpBitmapEx;
- if( !!(mpButtonData->maImageHC) )
- {
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- pImage = &(mpButtonData->maImageHC);
- pBitmapEx = mpButtonData->mpBitmapExHC;
- }
- }
-
if ( pBitmapEx && ( pDev->GetOutDevType() == OUTDEV_PRINTER ) )
{
// Die Groesse richtet sich nach dem Bildschirm, soll auf
@@ -480,21 +430,21 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
if ( bDrawText )
{
- if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) ||
- ( eImageAlign == IMAGEALIGN_LEFT ) ||
- ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) ||
- ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) ||
- ( eImageAlign == IMAGEALIGN_RIGHT ) ||
- ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) )
+ if ( ( eImageAlign == IMAGEALIGN_LEFT_TOP ) ||
+ ( eImageAlign == IMAGEALIGN_LEFT ) ||
+ ( eImageAlign == IMAGEALIGN_LEFT_BOTTOM ) ||
+ ( eImageAlign == IMAGEALIGN_RIGHT_TOP ) ||
+ ( eImageAlign == IMAGEALIGN_RIGHT ) ||
+ ( eImageAlign == IMAGEALIGN_RIGHT_BOTTOM ) )
{
aRect.Right() -= ( aImageSize.Width() + nImageSep );
}
- else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) ||
- ( eImageAlign == IMAGEALIGN_TOP ) ||
- ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) ||
- ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) ||
- ( eImageAlign == IMAGEALIGN_BOTTOM ) ||
- ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) )
+ else if ( ( eImageAlign == IMAGEALIGN_TOP_LEFT ) ||
+ ( eImageAlign == IMAGEALIGN_TOP ) ||
+ ( eImageAlign == IMAGEALIGN_TOP_RIGHT ) ||
+ ( eImageAlign == IMAGEALIGN_BOTTOM_LEFT ) ||
+ ( eImageAlign == IMAGEALIGN_BOTTOM ) ||
+ ( eImageAlign == IMAGEALIGN_BOTTOM_RIGHT ) )
{
aRect.Bottom() -= ( aImageSize.Height() + nImageSep );
}
@@ -515,7 +465,7 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
}
}
- aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width();
+ aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width();
aMax.Height() = aTSSize.Height() > aImageSize.Height() ? aTSSize.Height() : aImageSize.Height();
// Now calculate the output area for the image and the text acording to the image align flags
@@ -681,9 +631,9 @@ void Button::ImplSetFocusRect( const Rectangle &rFocusRect )
aFocusRect.Bottom()++;
}
- if ( aFocusRect.Left() < aOutputRect.Left() ) aFocusRect.Left() = aOutputRect.Left();
- if ( aFocusRect.Top() < aOutputRect.Top() ) aFocusRect.Top() = aOutputRect.Top();
- if ( aFocusRect.Right() > aOutputRect.Right() ) aFocusRect.Right() = aOutputRect.Right();
+ if ( aFocusRect.Left() < aOutputRect.Left() ) aFocusRect.Left() = aOutputRect.Left();
+ if ( aFocusRect.Top() < aOutputRect.Top() ) aFocusRect.Top() = aOutputRect.Top();
+ if ( aFocusRect.Right() > aOutputRect.Right() ) aFocusRect.Right() = aOutputRect.Right();
if ( aFocusRect.Bottom() > aOutputRect.Bottom() ) aFocusRect.Bottom() = aOutputRect.Bottom();
mpButtonData->maFocusRect = aFocusRect;
@@ -722,6 +672,7 @@ SymbolAlign Button::ImplGetSymbolAlign() const
{
return mpButtonData->meSymbolAlign;
}
+
// -----------------------------------------------------------------------
void Button::ImplSetSmallSymbol( sal_Bool bSmall )
{
@@ -811,10 +762,10 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle )
if ( !(nStyle & WB_NOGROUP) &&
(!pPrevWindow ||
- ((pPrevWindow->GetType() != WINDOW_PUSHBUTTON) &&
- (pPrevWindow->GetType() != WINDOW_OKBUTTON) &&
+ ((pPrevWindow->GetType() != WINDOW_PUSHBUTTON ) &&
+ (pPrevWindow->GetType() != WINDOW_OKBUTTON ) &&
(pPrevWindow->GetType() != WINDOW_CANCELBUTTON) &&
- (pPrevWindow->GetType() != WINDOW_HELPBUTTON)) ) )
+ (pPrevWindow->GetType() != WINDOW_HELPBUTTON )) ) )
nStyle |= WB_GROUP;
return nStyle;
}
@@ -2147,9 +2098,6 @@ void RadioButton::ImplInitSettings( sal_Bool bFont,
}
}
-//---------------------------------------------------------------------
-//--- 12.03.2003 18:46:14 ---------------------------------------------
-
void RadioButton::DrawRadioButtonState( )
{
ImplDrawRadioButtonState( );
@@ -2173,7 +2121,6 @@ void RadioButton::ImplInvalidateOrDrawRadioButtonState()
void RadioButton::ImplDrawRadioButtonState()
{
- sal_uInt16 nButtonStyle = 0;
sal_Bool bNativeOK = sal_False;
// no native drawing for image radio buttons
@@ -2221,12 +2168,12 @@ if ( bNativeOK == sal_False )
Rectangle aImageRect = maStateRect;
Size aImageSize = maImage.GetSizePixel();
sal_Bool bEnabled = IsEnabled();
+ sal_uInt16 nButtonStyle = FRAME_DRAW_DOUBLEIN;
aImageSize.Width() = CalcZoom( aImageSize.Width() );
aImageSize.Height() = CalcZoom( aImageSize.Height() );
// Border und Selektionsstatus ausgeben
- nButtonStyle = FRAME_DRAW_DOUBLEIN;
aImageRect = aDecoView.DrawFrame( aImageRect, nButtonStyle );
if ( (ImplGetButtonState() & BUTTON_DRAW_PRESSED) || !bEnabled )
SetFillColor( rStyleSettings.GetFaceColor() );
@@ -2240,13 +2187,7 @@ if ( bNativeOK == sal_False )
if ( !bEnabled )
nButtonStyle |= IMAGE_DRAW_DISABLE;
- // check for HC mode
Image *pImage = &maImage;
- if( !!maImageHC )
- {
- if( rStyleSettings.GetHighContrastMode() )
- pImage = &maImageHC;
- }
Point aImagePos( aImageRect.TopLeft() );
aImagePos.X() += (aImageRect.GetWidth()-aImageSize.Width())/2;
@@ -2804,7 +2745,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize
}
else
{
- DBG_ERROR( "RadioButton::Draw() - not implemented for RadioButton with Image" );
+ OSL_FAIL( "RadioButton::Draw() - not implemented for RadioButton with Image" );
}
}
@@ -2942,38 +2883,21 @@ void RadioButton::Toggle()
// -----------------------------------------------------------------------
-sal_Bool RadioButton::SetModeRadioImage( const Image& rImage, BmpColorMode eMode )
-{
- if( eMode == BMP_COLOR_NORMAL )
+sal_Bool RadioButton::SetModeRadioImage( const Image& rImage )
{
if ( rImage != maImage )
{
maImage = rImage;
StateChanged( STATE_CHANGE_DATA );
}
-}
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- if( maImageHC != rImage )
- {
- maImageHC = rImage;
- StateChanged( STATE_CHANGE_DATA );
- }
- }
- else
- return sal_False;
-
return sal_True;
}
// -----------------------------------------------------------------------
-const Image& RadioButton::GetModeRadioImage( BmpColorMode eMode ) const
+const Image& RadioButton::GetModeRadioImage( ) const
{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maImageHC;
- else
- return maImage;
+ return maImage;
}
// -----------------------------------------------------------------------
@@ -3126,10 +3050,11 @@ Image RadioButton::GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlag
ResMgr* pResMgr = ImplGetResMgr();
pSVData->maCtrlData.mpRadioImgList = new ImageList();
if( pResMgr )
- LoadThemedImageList( rStyleSettings,
+ LoadThemedImageList( rStyleSettings,
pSVData->maCtrlData.mpRadioImgList,
- ResId( SV_RESID_BITMAP_RADIO+nStyle, *pResMgr ), 6 );
- pSVData->maCtrlData.mnRadioStyle = nStyle;
+ ResId( SV_RESID_BITMAP_RADIO+nStyle, *pResMgr ), 6
+ );
+ pSVData->maCtrlData.mnRadioStyle = nStyle;
}
sal_uInt16 nId;
@@ -3213,13 +3138,13 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
if ( aSize.Height() < aTextSize.Height() )
aSize.Height() = aTextSize.Height();
}
- else if ( !maImage )
- {
+// else if ( !maImage )
+// {
/* da ansonsten im Writer die Control zu weit oben haengen
aSize.Width() += 2;
aSize.Height() += 2;
*/
- }
+// }
return CalcWindowSize( aSize );
}
@@ -4300,18 +4225,11 @@ void DisclosureButton::ImplDrawCheckBoxState()
ImplSVCtrlData& rCtrlData( ImplGetSVData()->maCtrlData );
if( ! rCtrlData.mpDisclosurePlus )
rCtrlData.mpDisclosurePlus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS ) ) );
- if( ! rCtrlData.mpDisclosurePlusHC )
- rCtrlData.mpDisclosurePlusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS_HC ) ) );
if( ! rCtrlData.mpDisclosureMinus )
rCtrlData.mpDisclosureMinus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS ) ) );
- if( ! rCtrlData.mpDisclosureMinusHC )
- rCtrlData.mpDisclosureMinusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS_HC ) ) );
Image* pImg = NULL;
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- pImg = IsChecked() ? rCtrlData.mpDisclosureMinusHC : rCtrlData.mpDisclosurePlusHC;
- else
- pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
+ pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus;
DBG_ASSERT( pImg, "no disclosure image" );
if( ! pImg )
@@ -4347,4 +4265,4 @@ void DisclosureButton::KeyInput( const KeyEvent& rKEvt )
Button::KeyInput( rKEvt );
}
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 2d6cb76b0512..c01092749e73 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,6 @@
#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
-
#include <vcl/decoview.hxx>
#include <vcl/lstbox.h>
#include <vcl/button.hxx>
@@ -44,7 +44,7 @@
#include <controldata.hxx>
// =======================================================================
-
+
inline sal_uLong ImplCreateKey( sal_uInt16 nPos )
{
// Key = Pos+1, wegen Pos 0
@@ -66,7 +66,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText,
}
// =======================================================================
-
+
ComboBox::ComboBox( WindowType nType ) :
Edit( nType )
{
@@ -212,7 +212,7 @@ void ComboBox::ImplInit( Window* pParent, WinBits nStyle )
Window* pLBParent = this;
if ( mpFloatWin )
pLBParent = mpFloatWin;
- mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE );
+ mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL );
mpImplLB->SetPosPixel( Point() );
mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) );
mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) );
@@ -467,7 +467,10 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
mbSyntheticModify = sal_True;
Modify();
mbSyntheticModify = sal_False;
- Select();
+ if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
+ {
+ Select();
+ }
}
return 0;
@@ -1587,3 +1590,5 @@ long ComboBox::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const
return nIndex;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 26ef9b076d8c..c9497abaef61 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <comphelper/processfactory.hxx>
-#include <tools/diagnose_ex.h>
#include <tools/rc.h>
-
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
#include <vcl/ctrl.hxx>
@@ -586,3 +585,5 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec
_rTargetDevice.Pop();
#endif
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index cd8d64516919..665448c4f3c9 100755..100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -45,7 +46,7 @@
#include <subedit.hxx>
#include <controldata.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <com/sun/star/i18n/XBreakIterator.hpp>
@@ -56,15 +57,11 @@
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#ifndef _COM_SUN_STAR_DATATRANSFER_DND_DNDCONSTANS_HPP_
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
-#endif
#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
-#ifndef _COM_SUN_STAR_I18N_XEXTENDEDINPUTSEQUENCECHECKER_HDL_
#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
-#endif
#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -77,6 +74,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
#include <rtl/memory.h>
+#include <sal/macros.h>
#include <vcl/unohelp.hxx>
#include <vcl/unohelp2.hxx>
@@ -514,7 +512,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
if( aText.Len() )
{
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
@@ -801,7 +799,7 @@ uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const
// if ( !xBI.is() )
{
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
+ uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) );
if ( xI.is() )
{
Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) );
@@ -821,7 +819,7 @@ uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenc
// if ( !xISC.is() )
{
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- uno::Reference < XInterface > xI = xMSF->createInstance( OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
+ uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.InputSequenceChecker")) );
if ( xI.is() )
{
Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) );
@@ -883,12 +881,12 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_
// determine if input-sequence-checking should be applied or not
//
- static OUString sModule( OUString::createFromAscii( "/org.openoffice.Office.Common/I18N" ) );
- static OUString sRelNode( OUString::createFromAscii( "CTL" ) );
- static OUString sCTLSequenceChecking( OUString::createFromAscii( "CTLSequenceChecking" ) );
- static OUString sCTLSequenceCheckingRestricted( OUString::createFromAscii( "CTLSequenceCheckingRestricted" ) );
- static OUString sCTLSequenceCheckingTypeAndReplace( OUString::createFromAscii( "CTLSequenceCheckingTypeAndReplace" ) );
- static OUString sCTLFont( OUString::createFromAscii( "CTLFont" ) );
+ static OUString sModule( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/I18N") );
+ static OUString sRelNode( RTL_CONSTASCII_USTRINGPARAM("CTL") );
+ static OUString sCTLSequenceChecking( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceChecking") );
+ static OUString sCTLSequenceCheckingRestricted( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingRestricted") );
+ static OUString sCTLSequenceCheckingTypeAndReplace( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingTypeAndReplace") );
+ static OUString sCTLFont( RTL_CONSTASCII_USTRINGPARAM("CTLFont") );
//
sal_Bool bCTLSequenceChecking = sal_False;
sal_Bool bCTLSequenceCheckingRestricted = sal_False;
@@ -1178,7 +1176,7 @@ void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible )
if( aText.Len() )
{
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
@@ -1302,7 +1300,7 @@ xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos ) const
sal_Int32 nDXBuffer[256];
sal_Int32* pDXBuffer = NULL;
sal_Int32* pDX = nDXBuffer;
- if( 2*aText.Len() > xub_StrLen(sizeof(nDXBuffer)/sizeof(nDXBuffer[0])) )
+ if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
{
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
pDX = pDXBuffer;
@@ -2936,13 +2934,17 @@ PopupMenu* Edit::CreatePopupMenu()
return new PopupMenu();
PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) );
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ if ( rStyleSettings.GetAcceleratorsInContextMenus() )
+ {
+ pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) );
+ }
return pPopup;
}
@@ -2956,7 +2958,7 @@ void Edit::DeletePopupMenu( PopupMenu* pMenu )
// ::com::sun::star::datatransfer::dnd::XDragGestureListener
void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException)
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aVclGuard;
if ( !IsTracking() && maSelection.Len() &&
!(GetStyle() & WB_PASSWORD) && (!mpDDInfo || mpDDInfo->bStarterOfDD == sal_False) ) // Kein Mehrfach D&D
@@ -2994,7 +2996,7 @@ void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::Dra
// ::com::sun::star::datatransfer::dnd::XDragSourceListener
void Edit::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException)
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aVclGuard;
if ( rDSDE.DropSuccess && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
{
@@ -3020,7 +3022,7 @@ void Edit::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDro
// ::com::sun::star::datatransfer::dnd::XDropTargetListener
void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aVclGuard;
sal_Bool bChanges = sal_False;
if ( !mbReadOnly && mpDDInfo )
@@ -3089,14 +3091,14 @@ void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragE
void Edit::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException)
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aVclGuard;
ImplHideDDCursor();
}
void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aVclGuard;
Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
@@ -3158,3 +3160,5 @@ Selection Edit::GetSurroundingTextSelection() const
{
return GetSelection();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index fd69457c8026..e34aa3752895 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,7 +51,6 @@
#include "rtl/math.hxx"
-
#include <unotools/localedatawrapper.hxx>
using namespace ::com::sun::star;
@@ -699,9 +699,15 @@ sal_Int64 NumericFormatter::Denormalize( sal_Int64 nValue ) const
{
sal_Int64 nFactor = ImplPower10( GetDecimalDigits() );
if( nValue < 0 )
- return ((nValue-(nFactor/2)) / nFactor );
+ {
+ sal_Int64 nHalf = nValue < ( SAL_MIN_INT64 + nFactor )? 0 : nFactor/2;
+ return ((nValue-nHalf) / nFactor );
+ }
else
- return ((nValue+(nFactor/2)) / nFactor );
+ {
+ sal_Int64 nHalf = nValue > ( SAL_MAX_INT64 - nFactor )? 0 : nFactor/2;
+ return ((nValue+nHalf) / nFactor );
+ }
}
// -----------------------------------------------------------------------
@@ -1176,29 +1182,32 @@ static FieldUnit ImplMetricGetUnit( const XubString& rStr )
}
#define K *1000L
-#define M *1000000L
+#define M *1000000LL
#define X *5280L
-static const sal_Int64 aImplFactor[FUNIT_MILE+1][FUNIT_MILE+1] =
+// twip in km = 254 / 14 400 000 000
+// expressions too big for default size 32 bit need LL to avoid overflow
+
+static const sal_Int64 aImplFactor[FUNIT_LINE+1][FUNIT_LINE+1] =
{ /*
-mm/100 mm cm m km twip point pica inch foot mile */
-{ 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
-{ 1, 1, 10, 1 K, 1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X },
-{ 1, 1, 1, 100, 100 K, 254, 254, 254, 254, 254*12, 254*12 X },
-{ 1, 1, 1, 1, 1 K, 254, 254, 254, 254, 254*12, 254*12 X },
-{ 1, 1, 1, 1, 1, 0, 254, 254, 254, 254*12, 254*12 X },
-{ 1440,144 K,144 K,14400 K, 0, 1, 20, 240, 1440,1440*12,1440*12 X },
-{ 72, 7200, 7200, 720 K, 720 M, 1, 1, 12, 72, 72*12, 72*12 X },
-{ 6, 600, 600, 60 K, 60 M, 1, 1, 1, 6, 6*12, 6*12 X },
-{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 12, 12 X },
-{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 X },
-{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 }
+mm/100 mm cm m km twip point pica inch foot mile char line */
+{ 1, 100, 1 K, 100 K, 100 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X , 53340, 396240},
+{ 1, 1, 10, 1 K, 1 M, 2540, 2540, 2540, 2540,2540*12,2540*12 X , 5334, 396240},
+{ 1, 1, 1, 100, 100 K, 254, 254, 254, 254, 254*12, 254*12 X , 5334, 39624},
+{ 1, 1, 1, 1, 1 K, 254, 254, 254, 254, 254*12, 254*12 X , 533400, 39624},
+{ 1, 1, 1, 1, 1, 254, 254, 254, 254, 254*12, 254*12 X ,533400 K, 39624},
+{ 1440,144 K,144 K,14400 K,14400LL M, 1, 20, 240, 1440,1440*12,1440*12 X , 210, 3120},
+{ 72, 7200, 7200, 720 K, 720 M, 1, 1, 12, 72, 72*12, 72*12 X , 210, 156},
+{ 6, 600, 600, 60 K, 60 M, 1, 1, 1, 6, 6*12, 6*12 X , 210, 10},
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 12, 12 X , 210, 45},
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 X , 210, 45},
+{ 1, 100, 100, 10 K, 10 M, 1, 1, 1, 1, 1, 1 , 210, 45},
+{ 144, 1440,14400, 14400, 14400, 1, 20, 240, 1440,1440*12, 1440*12 X, 1, 156 },
+{ 720,72000,72000, 7200 K,7200LL M, 20, 10, 13, 11, 11*12, 11*12 X, 105, 1 }
};
-
#undef X
#undef M
#undef K
-// twip in km 254/14400 M
static FieldUnit eDefaultUnit = FUNIT_NONE;
@@ -1235,7 +1244,7 @@ static FieldUnit ImplMap2FieldUnit( MapUnit meUnit, long& nDecDigits )
case MAP_TWIP :
return FUNIT_TWIP;
default:
- DBG_ERROR( "default eInUnit" );
+ OSL_FAIL( "default eInUnit" );
break;
}
return FUNIT_NONE;
@@ -1251,13 +1260,18 @@ static double nonValueDoubleToValueDouble( double nValue )
sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
FieldUnit eInUnit, FieldUnit eOutUnit )
{
+ double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue(
+ (double)nValue, mnBaseValue, nDecDigits, eInUnit, eOutUnit ) );
+
// caution: precision loss in double cast
- return static_cast<sal_Int64>(
- // #150733# cast double to sal_Int64 can throw a
- // EXCEPTION_FLT_INVALID_OPERATION on Windows
- nonValueDoubleToValueDouble(
- ConvertDoubleValue( (double)nValue, mnBaseValue, nDecDigits,
- eInUnit, eOutUnit ) ) );
+ sal_Int64 nLong = static_cast<sal_Int64>( nDouble );
+
+ if ( nDouble >= (double)SAL_MAX_INT64 )
+ nLong = SAL_MAX_INT64;
+ else if ( nDouble <= (double)SAL_MIN_INT64 )
+ nLong = SAL_MIN_INT64;
+
+ return nLong;
}
// -----------------------------------------------------------------------
@@ -1266,8 +1280,6 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits,
MapUnit eInUnit, FieldUnit eOutUnit )
{
return static_cast<sal_Int64>(
- // #150733# cast double to sal_Int64 can throw a
- // EXCEPTION_FLT_INVALID_OPERATION on Windows
nonValueDoubleToValueDouble(
ConvertDoubleValue( nValue, nDigits, eInUnit, eOutUnit ) ) );
}
@@ -1278,8 +1290,6 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits,
FieldUnit eInUnit, MapUnit eOutUnit )
{
return static_cast<sal_Int64>(
- // #150733# cast double to sal_Int64 can throw a
- // EXCEPTION_FLT_INVALID_OPERATION on Windows
nonValueDoubleToValueDouble(
ConvertDoubleValue( nValue, nDigits, eInUnit, eOutUnit ) ) );
}
@@ -1348,7 +1358,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
eInUnit == MAP_APPFONT ||
eInUnit == MAP_RELATIVE )
{
- DBG_ERROR( "invalid parameters" );
+ OSL_FAIL( "invalid parameters" );
return nValue;
}
@@ -1405,7 +1415,7 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
eOutUnit == MAP_APPFONT ||
eOutUnit == MAP_RELATIVE )
{
- DBG_ERROR( "invalid parameters" );
+ OSL_FAIL( "invalid parameters" );
return nValue;
}
@@ -1424,7 +1434,6 @@ double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
{
while ( nDecDigits )
{
- nValue += 5;
nValue /= 10;
nDecDigits--;
}
@@ -1775,6 +1784,22 @@ MetricField::~MetricField()
{
}
+void MetricField::SetUnit( FieldUnit nNewUnit )
+{
+ sal_Int64 nRawMax = GetMax( nNewUnit );
+ sal_Int64 nMax = Denormalize( nRawMax );
+ sal_Int64 nMin = Denormalize( GetMin( nNewUnit ) );
+ sal_Int64 nFirst = Denormalize( GetFirst( nNewUnit ) );
+ sal_Int64 nLast = Denormalize( GetLast( nNewUnit ) );
+
+ MetricFormatter::SetUnit( nNewUnit );
+
+ SetMax( Normalize( nMax ), nNewUnit );
+ SetMin( Normalize( nMin ), nNewUnit );
+ SetFirst( Normalize( nFirst ), nNewUnit );
+ SetLast( Normalize( nLast ), nNewUnit );
+}
+
// -----------------------------------------------------------------------
void MetricField::SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit )
@@ -2508,3 +2533,5 @@ sal_Int64 CurrencyBox::GetValue() const
// Implementation not inline, because it is a virtual Function
return CurrencyFormatter::GetValue();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 9aac58e1a30a..69a3fdbdce9d 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <tools/debug.hxx>
#include <tools/rc.h>
-
#include <vcl/svapp.hxx>
#include <vcl/sound.hxx>
#include <vcl/event.hxx>
@@ -1298,7 +1298,7 @@ static sal_Bool ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFie
default:
{
- DBG_ERROR( "DateFormat???" );
+ OSL_FAIL( "DateFormat???" );
}
}
}
@@ -1434,7 +1434,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate,
break;
default:
{
- DBG_ERROR( "DateFormat???" );
+ OSL_FAIL( "DateFormat???" );
}
}
@@ -1607,7 +1607,7 @@ void DateField::ImplDateSpinArea( sal_Bool bUp )
}
break;
default:
- DBG_ERROR( "invalid conversion" );
+ OSL_FAIL( "invalid conversion" );
break;
}
}
@@ -3300,7 +3300,7 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat )
SetFormat( TIMEF_SEC );
}
break;
- default: DBG_ERROR( "ExtTimeFieldFormat unknown!" );
+ default: OSL_FAIL( "ExtTimeFieldFormat unknown!" );
}
if ( GetField() && GetField()->GetText().Len() )
@@ -3464,3 +3464,5 @@ sal_uInt16 TimeBox::GetTimePos( const Time& rTime ) const
bSec = b100Sec = sal_True;
return ComboBox::GetEntryPos( ImplGetLocaleDataWrapper().getTime( rTime, bSec, b100Sec ) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/fixbrd.cxx b/vcl/source/control/fixbrd.cxx
index cc621e16175d..4efbbe2deee1 100644
--- a/vcl/source/control/fixbrd.cxx
+++ b/vcl/source/control/fixbrd.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_RC_H
#include <tools/rc.h>
-#endif
#include <vcl/event.hxx>
#include <vcl/fixbrd.hxx>
@@ -234,3 +233,5 @@ void FixedBorder::SetBorderType( sal_uInt16 nType )
Invalidate();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 5455f9410f54..514589d0660b 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -507,17 +508,14 @@ void FixedLine::ImplDraw( bool bLayout )
{
if( !pVector )
{
- long nX = 0;
- long nY = 0;
-
if ( nWinStyle & WB_VERT )
{
- nX = (aOutSize.Width()-1)/2;
+ long nX = (aOutSize.Width()-1)/2;
aDecoView.DrawSeparator( Point( nX, 0 ), Point( nX, aOutSize.Height()-1 ) );
}
else
{
- nY = (aOutSize.Height()-1)/2;
+ long nY = (aOutSize.Height()-1)/2;
aDecoView.DrawSeparator( Point( 0, nY ), Point( aOutSize.Width()-1, nY ), false );
}
}
@@ -784,11 +782,6 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, sal_uLong /* nDrawFlags */,
sal_uInt16 nStyle = 0;
Bitmap* pBitmap = &maBitmap;
Color aCol;
- if( !!maBitmapHC )
- {
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- pBitmap = &maBitmapHC;
- }
if( nStyle & IMAGE_DRAW_COLORTRANSFORM )
{
@@ -910,28 +903,17 @@ void FixedBitmap::SetBitmap( const Bitmap& rBitmap )
// -----------------------------------------------------------------------
-sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap, BmpColorMode eMode )
+sal_Bool FixedBitmap::SetModeBitmap( const Bitmap& rBitmap )
{
- if( eMode == BMP_COLOR_NORMAL )
- SetBitmap( rBitmap );
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- maBitmapHC = rBitmap;
- StateChanged( STATE_CHANGE_DATA );
- }
- else
- return sal_False;
+ SetBitmap( rBitmap );
return sal_True;
}
// -----------------------------------------------------------------------
-const Bitmap& FixedBitmap::GetModeBitmap( BmpColorMode eMode) const
+const Bitmap& FixedBitmap::GetModeBitmap( ) const
{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maBitmapHC;
- else
- return maBitmap;
+ return maBitmap;
}
// =======================================================================
@@ -1035,11 +1017,6 @@ void FixedImage::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
Image *pImage = &maImage;
Color aCol;
- if( !!maImageHC )
- {
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- pImage = &maImageHC;
- }
// Haben wir ueberhaupt ein Image
if ( !(!(*pImage)) )
@@ -1070,7 +1047,7 @@ void FixedImage::Paint( const Rectangle& )
Size FixedImage::GetOptimalSize( WindowSizeType ) const
{
- const Image* pImage = GetSettings().GetStyleSettings().GetHighContrastMode() ? &maImageHC : &maImage;
+ const Image* pImage = &maImage;
return pImage->GetSizePixel();
}
@@ -1165,31 +1142,17 @@ void FixedImage::SetImage( const Image& rImage )
// -----------------------------------------------------------------------
-sal_Bool FixedImage::SetModeImage( const Image& rImage, BmpColorMode eMode )
+sal_Bool FixedImage::SetModeImage( const Image& rImage )
{
- if( eMode == BMP_COLOR_NORMAL )
- SetImage( rImage );
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- {
- if( maImageHC != rImage )
- {
- maImageHC = rImage;
- StateChanged( STATE_CHANGE_DATA );
- }
- }
- else
- return sal_False;
+ SetImage( rImage );
return sal_True;
}
// -----------------------------------------------------------------------
-const Image& FixedImage::GetModeImage( BmpColorMode eMode ) const
+const Image& FixedImage::GetModeImage( ) const
{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maImageHC;
- else
- return maImage;
+ return maImage;
}
// -----------------------------------------------------------------------
@@ -1199,3 +1162,5 @@ Point FixedImage::CalcImagePos( const Point& rPos,
{
return ImplCalcPos( GetStyle(), rPos, rObjSize, rWinSize );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx
index 6bf4d519a64b..3de86f5a2cd5 100644
--- a/vcl/source/control/group.cxx
+++ b/vcl/source/control/group.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -134,6 +135,7 @@ GroupBox::GroupBox( Window* pParent, const ResId& rResId ) :
void GroupBox::ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
const Point& rPos, const Size& rSize, bool bLayout )
{
+ OSL_TRACE("GroupBox::ImplDraw Y %d, X %d", rPos.Y(), rPos.X() );
long nTop;
long nTextOff;
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
@@ -320,3 +322,4 @@ void GroupBox::DataChanged( const DataChangedEvent& rDCEvt )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 016facae8e2c..a6cd7b980620 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,6 +48,10 @@
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <rtl/instance.hxx>
+#include <comphelper/string.hxx>
+#include <comphelper/processfactory.hxx>
+
#define MULTILINE_ENTRY_DRAW_FLAGS ( TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_VCENTER )
using namespace ::com::sun::star;
@@ -145,17 +150,29 @@ void ImplEntryList::SelectEntry( sal_uInt16 nPos, sal_Bool bSelect )
}
}
-// -----------------------------------------------------------------------
-
-uno::Reference< i18n::XCollator > ImplGetCollator (lang::Locale &rLocale)
+namespace
{
- static uno::Reference< i18n::XCollator > xCollator;
- if ( !xCollator.is() )
- xCollator = vcl::unohelper::CreateCollator();
- if( xCollator.is() )
- xCollator->loadDefaultCollator (rLocale, 0);
+ struct theSorter
+ : public rtl::StaticWithInit< comphelper::string::NaturalStringSorter, theSorter >
+ {
+ comphelper::string::NaturalStringSorter operator () ()
+ {
+ return comphelper::string::NaturalStringSorter(
+ ::comphelper::getProcessComponentContext(),
+ Application::GetSettings().GetLocale());
+ }
+ };
+}
- return xCollator;
+namespace vcl
+{
+ namespace unohelper
+ {
+ const comphelper::string::NaturalStringSorter& getNaturalStringSorterForAppLocale()
+ {
+ return theSorter::get();
+ }
+ }
}
sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry, sal_Bool bSort )
@@ -169,8 +186,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
}
else
{
- lang::Locale aLocale = Application::GetSettings().GetLocale();
- uno::Reference< i18n::XCollator > xCollator = ImplGetCollator(aLocale);
+ const comphelper::string::NaturalStringSorter &rSorter = theSorter::get();
const XubString& rStr = pNewEntry->maStr;
sal_uLong nLow, nHigh, nMid;
@@ -183,9 +199,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
{
// XXX even though XCollator::compareString returns a sal_Int32 the only
// defined values are {-1, 0, 1} which is compatible with StringCompare
- StringCompare eComp = xCollator.is() ?
- (StringCompare)xCollator->compareString (rStr, pTemp->maStr)
- : COMPARE_EQUAL;
+ StringCompare eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
// Schnelles Einfuegen bei sortierten Daten
if ( eComp != COMPARE_LESS )
@@ -197,7 +211,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
nLow = mnMRUCount;
pTemp = (ImplEntryType*)GetEntry( (sal_uInt16)nLow );
- eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr);
+ eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
if ( eComp != COMPARE_GREATER )
{
Insert( pNewEntry, (sal_uLong)0 );
@@ -211,7 +225,7 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
nMid = (nLow + nHigh) / 2;
pTemp = (ImplEntryType*)GetObject( nMid );
- eComp = (StringCompare)xCollator->compareString (rStr, pTemp->maStr);
+ eComp = (StringCompare)rSorter.compare(rStr, pTemp->maStr);
if ( eComp == COMPARE_LESS )
nHigh = nMid-1;
@@ -234,8 +248,8 @@ sal_uInt16 ImplEntryList::InsertEntry( sal_uInt16 nPos, ImplEntryType* pNewEntry
}
catch (uno::RuntimeException& )
{
- // XXX this is arguable, if the exception occured because pNewEntry is
- // garbage you wouldn't insert it. If the exception occured because the
+ // XXX this is arguable, if the exception occurred because pNewEntry is
+ // garbage you wouldn't insert it. If the exception occurred because the
// Collator implementation is garbage then give the user a chance to see
// his stuff
Insert( pNewEntry, (sal_uLong)0 );
@@ -2747,25 +2761,17 @@ ImplWin::ImplWin( Window* pParent, WinBits nWinStyle ) :
// -----------------------------------------------------------------------
-sal_Bool ImplWin::SetModeImage( const Image& rImage, BmpColorMode eMode )
+sal_Bool ImplWin::SetModeImage( const Image& rImage )
{
- if( eMode == BMP_COLOR_NORMAL )
- SetImage( rImage );
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- maImageHC = rImage;
- else
- return sal_False;
+ SetImage( rImage );
return sal_True;
}
// -----------------------------------------------------------------------
-const Image& ImplWin::GetModeImage( BmpColorMode eMode ) const
+const Image& ImplWin::GetModeImage( ) const
{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maImageHC;
- else
- return maImage;
+ return maImage;
}
// -----------------------------------------------------------------------
@@ -2782,7 +2788,6 @@ void ImplWin::MouseButtonDown( const MouseEvent& )
{
if( IsEnabled() )
{
-// Control::MouseButtonDown( rMEvt );
MBDown();
}
}
@@ -2944,12 +2949,6 @@ void ImplWin::DrawEntry( sal_Bool bDrawImage, sal_Bool bDrawText, sal_Bool bDraw
// check for HC mode
Image *pImage = &maImage;
- if( !!maImageHC )
- {
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- pImage = &maImageHC;
- }
-
if ( !IsZoom() )
{
DrawImage( aPtImg, *pImage, nStyle );
@@ -3183,6 +3182,11 @@ Size ImplListBoxFloatingWindow::CalcFloatSize()
long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
aFloatSz.Width() += nSBWidth;
}
+
+ long nDesktopWidth = GetDesktopRectPixel().getWidth();
+ if (aFloatSz.Width() > nDesktopWidth)
+ // Don't exceed the desktop width.
+ aFloatSz.Width() = nDesktopWidth;
}
if ( aFloatSz.Height() > nMaxHeight )
@@ -3209,6 +3213,13 @@ Size ImplListBoxFloatingWindow::CalcFloatSize()
aFloatSz.Height() = nInnerHeight + nTop + nBottom;
}
+ if (aFloatSz.Width() < aSz.Width())
+ {
+ // The max width of list box entries exceeds the window width.
+ // Account for the scroll bar height.
+ long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ aFloatSz.Height() += nSBWidth;
+ }
return aFloatSz;
}
@@ -3262,3 +3273,5 @@ void ImplListBoxFloatingWindow::StartFloat( sal_Bool bStartTracking )
mpImplLB->GetMainWindow()->ImplClearLayoutData();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index faeb460c46e4..7f304e335f54 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -104,13 +105,8 @@ void ImageControl::ImplDraw( OutputDevice& rDev, sal_uLong nDrawFlags, const Poi
nStyle |= IMAGE_DRAW_DISABLE;
}
- const Image& rImage( GetModeImage( BMP_COLOR_NORMAL ) );
- const Image& rImageHC( GetModeImage( BMP_COLOR_HIGHCONTRAST ) );
-
+ const Image& rImage( GetModeImage() );
const Image* pImage = &rImage;
- if ( !!rImageHC && GetSettings().GetStyleSettings().GetHighContrastMode() )
- pImage = &rImageHC;
-
const Rectangle aDrawRect( rPos, rSize );
if ( !*pImage )
{
@@ -229,3 +225,4 @@ void ImageControl::LoseFocus()
GetWindow( WINDOW_BORDER )->Invalidate();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 40b897bbb35c..34048a1c60ce 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -855,3 +856,5 @@ sal_uInt16 LongCurrencyBox::GetValuePos( BigInt nValue ) const
}
// =======================================================================
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 94d865f79bc1..9b31913756e4 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1650,3 +1651,5 @@ MultiListBox::MultiListBox( Window* pParent, const ResId& rResId ) :
Show();
EnableMultiSelection( sal_True );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 5996a5b2d1b1..13513f62b719 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_RC_H
#include <tools/rc.h>
-#endif
#include <vcl/decoview.hxx>
#include <vcl/event.hxx>
#include <vcl/menu.hxx>
@@ -238,3 +237,5 @@ void MenuButton::SetPopupMenu( PopupMenu* pNewMenu )
// diese Funktion zur 6.0 inline werden
mpMenu = pNewMenu;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index f03136394512..f40bc376d5e0 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,15 +30,12 @@
#include "precompiled_vcl.hxx"
#include <vcl/morebtn.hxx>
-#ifndef _SV_RD_H
#include <tools/rc.h>
-#endif
-
-
+#include <vector>
// =======================================================================
-DECLARE_LIST( ImplMoreWindowList, Window* )
+typedef ::std::vector< Window* > ImplMoreWindowList;
struct ImplMoreButtonData
{
@@ -150,7 +148,6 @@ void MoreButton::Click()
{
Window* pParent = GetParent();
Size aSize( pParent->GetSizePixel() );
- Window* pWindow = (mpMBData->mpItemList) ? mpMBData->mpItemList->First() : NULL;
long nDeltaPixel = LogicToPixel( Size( 0, mnDelta ), meUnit ).Height();
// Status aendern
@@ -165,10 +162,10 @@ void MoreButton::Click()
if ( mbState )
{
// Fenster anzeigen
- while ( pWindow )
- {
- pWindow->Show();
- pWindow = mpMBData->mpItemList->Next();
+ if ( mpMBData->mpItemList ) {
+ for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
+ (*mpMBData->mpItemList)[ i ]->Show();
+ }
}
// Dialogbox anpassen
@@ -195,10 +192,10 @@ void MoreButton::Click()
pParent->SetSizePixel( aSize );
// Fenster nicht mehr anzeigen
- while ( pWindow )
- {
- pWindow->Hide();
- pWindow = mpMBData->mpItemList->Next();
+ if ( mpMBData->mpItemList ) {
+ for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
+ (*mpMBData->mpItemList)[ i ]->Hide();
+ }
}
}
}
@@ -208,9 +205,9 @@ void MoreButton::Click()
void MoreButton::AddWindow( Window* pWindow )
{
if ( !mpMBData->mpItemList )
- mpMBData->mpItemList = new ImplMoreWindowList( 1024, 16, 16 );
+ mpMBData->mpItemList = new ImplMoreWindowList();
- mpMBData->mpItemList->Insert( pWindow, LIST_APPEND );
+ mpMBData->mpItemList->push_back( pWindow );
if ( mbState )
pWindow->Show();
@@ -222,8 +219,17 @@ void MoreButton::AddWindow( Window* pWindow )
void MoreButton::RemoveWindow( Window* pWindow )
{
- if ( mpMBData->mpItemList )
- mpMBData->mpItemList->Remove( pWindow );
+ if ( mpMBData->mpItemList ) {
+ for ( ImplMoreWindowList::iterator it = mpMBData->mpItemList->begin();
+ it < mpMBData->mpItemList->end();
+ ++it
+ ) {
+ if ( *it == pWindow ) {
+ mpMBData->mpItemList->erase( it );
+ break;
+ }
+ }
+ }
}
// -----------------------------------------------------------------------
@@ -278,3 +284,4 @@ XubString MoreButton::GetLessText() const
return PushButton::GetText();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 17ecbd4a6ce8..6e87647eb8df 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,10 +40,9 @@
#include "rtl/string.hxx"
#include "tools/rc.h"
+using ::rtl::OUString;
-using namespace rtl;
-
/* #i77549#
HACK: for scrollbars in case of thumb rect, page up and page down rect we
abuse the HitTestNativeControl interface. All theming engines but aqua
@@ -245,7 +245,6 @@ void ScrollBar::ImplUpdateRects( sal_Bool bUpdate )
}
else
{
- Size aScrBarSize = GetOutputSizePixel();
if ( GetStyle() & WB_HORZ )
{
const long nSpace = maTrackRect.Right() - maTrackRect.Left();
@@ -1590,3 +1589,5 @@ void ScrollBarBox::DataChanged( const DataChangedEvent& rDCEvt )
Invalidate();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index 0058acc005c7..71eeeae665d4 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,9 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_RC_H
#include <tools/rc.h>
-#endif
#include <vcl/event.hxx>
#include <vcl/decoview.hxx>
#include <vcl/slider.hxx>
@@ -1080,3 +1079,5 @@ Size Slider::CalcWindowSizePixel()
}
return aSize;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/spinbtn.cxx b/vcl/source/control/spinbtn.cxx
index 52b3fdca9730..50265e911f80 100644
--- a/vcl/source/control/spinbtn.cxx
+++ b/vcl/source/control/spinbtn.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -322,8 +323,6 @@ void SpinButton::MouseMove( const MouseEvent& rMEvt )
void SpinButton::KeyInput( const KeyEvent& rKEvt )
{
- KeyCode aCode = rKEvt.GetKeyCode();
-
if ( !rKEvt.GetKeyCode().GetModifier() )
{
switch ( rKEvt.GetKeyCode().GetCode() )
@@ -548,3 +547,5 @@ long SpinButton::PreNotify( NotifyEvent& rNEvt )
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index ed0bb4374c53..adbb2ad0ae0a 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -697,7 +698,6 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
long nBottom1 = aSize.Height()/2;
long nBottom2 = aSize.Height()-1;
long nTop2 = nBottom1;
- long nTop1 = 0;
if ( !(aSize.Height() & 0x01) )
nBottom1--;
@@ -742,6 +742,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
}
else
{
+ long nTop1 = 0;
aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) );
rSpinUpArea = Rectangle( aSize.Width(), nTop1, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 );
@@ -1092,3 +1093,5 @@ void SpinField::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
pDev->SetSettings( aOldSettings );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 6cc07e85ffb7..765907721ed6 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -46,7 +47,7 @@
#include "svdata.hxx"
#include "window.h"
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <vector>
// =======================================================================
@@ -76,8 +77,8 @@ struct ImplTabItem
struct ImplTabCtrlData
{
- std::hash_map< int, int > maLayoutPageIdToLine;
- std::hash_map< int, int > maLayoutLineToPageId;
+ boost::unordered_map< int, int > maLayoutPageIdToLine;
+ boost::unordered_map< int, int > maLayoutLineToPageId;
std::vector< Rectangle > maTabRectangles;
Point maItemsOffset; // offset of the tabitems
std::vector< ImplTabItem > maItemList;
@@ -161,6 +162,18 @@ const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) c
// -----------------------------------------------------------------------
+WinBits TabControl::ImplInitStyle( WinBits nStyle )
+{
+ if ( !(nStyle & WB_NOTABSTOP) )
+ nStyle |= WB_TABSTOP;
+ if ( !(nStyle & WB_NOGROUP) )
+ nStyle |= WB_GROUP;
+
+ return nStyle;
+}
+
+// -----------------------------------------------------------------------
+
void TabControl::ImplInitSettings( sal_Bool bFont,
sal_Bool bForeground, sal_Bool bBackground )
{
@@ -215,6 +228,7 @@ TabControl::TabControl( Window* pParent, WinBits nStyle ) :
Control( WINDOW_TABCONTROL )
{
ImplInit( pParent, nStyle );
+ OSL_TRACE("*** TABCONTROL no notabs? %s", ( GetStyle() & WB_NOBORDER ) ? "true" : "false" );
}
// -----------------------------------------------------------------------
@@ -607,7 +621,13 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId )
if ( pPage )
{
- pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ if ( ( GetStyle() & WB_NOBORDER ) )
+ {
+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
+ pPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
+ }
+ else
+ pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
// activate page here so the conbtrols can be switched
// also set the help id of the parent window to that of the tab page
@@ -662,6 +682,12 @@ sal_Bool TabControl::ImplPosCurTabPage()
ImplTabItem* pItem = ImplGetItem( GetCurPageId() );
if ( pItem && pItem->mpTabPage )
{
+ if ( ( GetStyle() & WB_NOBORDER ) )
+ {
+ Rectangle aRectNoTab( (const Point&)Point( 0, 0 ), GetSizePixel() );
+ pItem->mpTabPage->SetPosSizePixel( aRectNoTab.TopLeft(), aRectNoTab.GetSize() );
+ return sal_True;
+ }
Rectangle aRect = ImplGetTabRect( TAB_PAGERECT );
pItem->mpTabPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
return sal_True;
@@ -1055,7 +1081,8 @@ void TabControl::KeyInput( const KeyEvent& rKEvt )
void TabControl::Paint( const Rectangle& rRect )
{
- ImplPaint( rRect, false );
+ if ( !( GetStyle() & WB_NOBORDER ) )
+ ImplPaint( rRect, false );
}
// -----------------------------------------------------------------------
@@ -1083,7 +1110,6 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout )
// Draw the TabPage border
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Rectangle aCurRect;
- long nTopOff = 1;
aRect.Left() -= TAB_OFFSET;
aRect.Top() -= TAB_OFFSET;
aRect.Right() += TAB_OFFSET;
@@ -1125,6 +1151,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout )
}
else
{
+ long nTopOff = 1;
if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
SetLineColor( rStyleSettings.GetLightColor() );
else
@@ -1487,6 +1514,10 @@ void TabControl::StateChanged( StateChangedType nType )
ImplInitSettings( sal_False, sal_False, sal_True );
Invalidate();
}
+ else if ( nType == STATE_CHANGE_STYLE )
+ {
+ SetStyle( ImplInitStyle( GetStyle() ) );
+ }
}
// -----------------------------------------------------------------------
@@ -2083,7 +2114,7 @@ Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex ) cons
if( HasLayoutData() )
{
- std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId );
+ boost::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId );
if( it != mpTabCtrlData->maLayoutPageIdToLine.end() )
{
Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second );
@@ -2148,7 +2179,7 @@ Rectangle TabControl::GetTabPageBounds( sal_uInt16 nPage ) const
if( HasLayoutData() )
{
- std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage );
+ boost::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage );
if( it != mpTabCtrlData->maLayoutPageIdToLine.end() )
{
if( it->second >= 0 && it->second < static_cast<int>(mpTabCtrlData->maTabRectangles.size()) )
@@ -2214,3 +2245,4 @@ void TabControl::SetMinimumSizePixel( const Size& i_rSize )
// -----------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx
index 6ebd02cb5de1..a55fdb3eb379 100644
--- a/vcl/source/control/throbber.cxx
+++ b/vcl/source/control/throbber.cxx
@@ -300,7 +300,7 @@ void Throbber::setImageList( const Sequence< Reference< XGraphic > >& rImageList
//----------------------------------------------------------------------------------------------------------------------
IMPL_LINK( Throbber, TimeOutHdl, void*, EMPTYARG )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
if ( maImageList.empty() )
return 0;
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 45172002bff6..cc6b41b0841b 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -154,12 +155,6 @@ static const char* pStringIds[] = {
// --------------------------------------------------------------------
-#if 0 // TODO: use them
-static const char* pStdEncNames[] = {
- "ISOAdobe", "Expert", "ExpertSubSet"
-};
-#endif
-
// --------------------------------------------------------------------
// TOP DICT keywords (also covers PRIV DICT keywords)
@@ -617,15 +612,19 @@ void CffSubsetterContext::readDictOp( void)
const U8 c = *mpReadPtr;
if( c <= 21 ) {
int nOpId = *(mpReadPtr++);
- const char* pCmdName;
+ const char* pCmdName = 0;
if( nOpId != 12)
- pCmdName = pDictOps[ nOpId];
+ pCmdName = pDictOps[nOpId];
else {
const U8 nExtId = *(mpReadPtr++);
- pCmdName = pDictEscs[ nExtId];
+ if (nExtId < 39)
+ pCmdName = pDictEscs[nExtId];
nOpId = 900 + nExtId;
}
+ if (!pCmdName) // skip reserved operators
+ return;
+
//TODO: if( nStackIdx > 0)
switch( *pCmdName) {
default: fprintf( stderr, "unsupported DictOp.type=\'%c\'\n", *pCmdName); break;
@@ -1244,32 +1243,23 @@ void CffSubsetterContext::convertOneTypeEsc( void)
}
case TYPE2OP::HFLEX1: {
assert( mnStackIdx == 9);
-#if 0 // emulate hflex1 as straight line
- const ValType* pX = &mnValStack[ mnStackIdx];
- const ValType fDX = pX[-9] + pX[-7] + pX[-5] + pX[-4] + pX[-3] + pX[-1];
- writeType1Val( fDX);
- writeTypeOp( TYPE1OP::HLINETO);
-#else // emulate hflex1 as two curves
+
writeCurveTo( mnStackIdx, -9, -8, -7, -6, -5, 0);
writeCurveTo( mnStackIdx, -4, 0, -3, -2, -1, 0);
// TODO: emulate hflex1 using othersubr call
-#endif
+
mnStackIdx -= 9;
}
break;
case TYPE2OP::HFLEX: {
assert( mnStackIdx == 7);
ValType* pX = &mnValStack[ mnStackIdx];
-#if 0 // emulate hflex as straight line
- const ValType fDX = pX[-7] + pX[-6] + pX[-4] + pX[-3] + pX[-2] + pX[-1];
- writeType1Val( fDX);
- writeTypeOp( TYPE1OP::HLINETO);
-#else // emulate hflex as two curves
+
pX[+1] = -pX[-5]; // temp: +dy5==-dy2
writeCurveTo( mnStackIdx, -7, 0, -6, -5, -4, 0);
writeCurveTo( mnStackIdx, -3, 0, -2, +1, -1, 0);
// TODO: emulate hflex using othersubr call
-#endif
+
mnStackIdx -= 7;
}
break;
@@ -1317,13 +1307,12 @@ void CffSubsetterContext::callType2Subr( bool bGlobal, int nSubrNumber)
const U8* const pOldReadPtr = mpReadPtr;
const U8* const pOldReadEnd = mpReadEnd;
- int nLen = 0;
if( bGlobal ) {
nSubrNumber += mnGlobalSubrBias;
- nLen = seekIndexData( mnGlobalSubrBase, nSubrNumber);
+ seekIndexData( mnGlobalSubrBase, nSubrNumber);
} else {
nSubrNumber += mpCffLocal->mnLocalSubrBias;
- nLen = seekIndexData( mpCffLocal->mnLocalSubrBase, nSubrNumber);
+ seekIndexData( mpCffLocal->mnLocalSubrBase, nSubrNumber);
}
while( mpReadPtr < mpReadEnd)
@@ -1391,13 +1380,7 @@ if( mbSawError) {
writeType1Val( -350);
writeType1Val( 700);
writeTypeOp( TYPE1OP::RLINETO);
-#if 0
- writeType1Val( -300);
- writeType1Val( -800);
- writeTypeOp( TYPE1OP::RLINETO);
-#else
writeTypeOp( TYPE1OP::CLOSEPATH);
-#endif
writeTypeOp( TYPE1OP::ENDCHAR);
}
#else // useful for manually encoding charstrings
@@ -1771,6 +1754,7 @@ int CffSubsetterContext::getFDSelect( int nGlyphIndex) const
assert( nRangeCount <= mnCharStrCount);
U16 nPrev = (pReadPtr[2]<<8) + pReadPtr[3];
assert( nPrev == 0);
+ (void)nPrev;
pReadPtr += 4;
// TODO? binary search
for( int i = 0; i < nRangeCount; ++i) {
@@ -2065,7 +2049,7 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
return;
// emit the line head
- mpPtr += sprintf( mpPtr, pLineHead);
+ mpPtr += sprintf( mpPtr, "%s", pLineHead);
// emit the vector values
ValVector::value_type aVal = 0;
for( ValVector::const_iterator it = rVector.begin();;) {
@@ -2078,7 +2062,7 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
// emit the last value
mpPtr += dbl2str( mpPtr, aVal);
// emit the line tail
- mpPtr += sprintf( mpPtr, pLineTail);
+ mpPtr += sprintf( mpPtr, "%s", pLineTail);
}
// --------------------------------------------------------------------
@@ -2128,13 +2112,6 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, "%%!FontType1-1.0: %s 001.003\n", rEmitter.maSubsetName);
// emit TOPDICT
-#if 0 // improve PS Type1 caching?
- nOfs += sprintf( &aT1Str[nOfs],
- "FontDirectory/%s known{/%s findfont dup/UniqueID known{dup\n"
- "/UniqueID get %d eq exch/FontType get 1 eq and}{pop false}ifelse\n"
- "{save true}{false}ifelse}\n{false}ifelse\n",
- pFamilyName, pFamilyName, nUniqueId);
-#endif
pOut += sprintf( pOut,
"11 dict begin\n" // TODO: dynamic entry count for TOPDICT
"/FontType 1 def\n"
@@ -2158,10 +2135,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
" /FamilyName (%s) readonly def\n"
"end readonly def\n",
pFullName, pFamilyName);
-#if 0 // TODO: use an standard Type1 encoding if possible
- pOut += sprintf( pOut,
- "/Encoding StandardEncoding def\n");
-#else
+
pOut += sprintf( pOut,
"/Encoding 256 array\n"
"0 1 255 {1 index exch /.notdef put} for\n");
@@ -2170,7 +2144,6 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, "dup %d /%s put\n", pReqEncoding[i], pGlyphName);
}
pOut += sprintf( pOut, "readonly def\n");
-#endif
pOut += sprintf( pOut,
// TODO: more topdict entries
"currentdict end\n"
@@ -2416,3 +2389,4 @@ bool FontSubsetInfo::CreateFontSubsetFromCff( GlyphWidth* pOutGlyphWidths )
// ====================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/fontsubset.cxx b/vcl/source/fontsubset/fontsubset.cxx
index 26382e245996..494d739010da 100644
--- a/vcl/source/fontsubset/fontsubset.cxx
+++ b/vcl/source/fontsubset/fontsubset.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -116,7 +117,7 @@ bool FontSubsetInfo::CreateFontSubset(
case NO_FONT:
// fall trough
default:
- DBG_ERROR( "unhandled type in CreateFontSubset()");
+ OSL_FAIL( "unhandled type in CreateFontSubset()");
break;
}
@@ -173,14 +174,11 @@ bool FontSubsetInfo::CreateFontSubsetFromSfnt( sal_Int32* pOutGlyphWidths )
// TODO: replace dummy implementation
bool FontSubsetInfo::CreateFontSubsetFromType1( sal_Int32* pOutGlyphWidths)
{
-#if 0
- // TODO: replace dummy implementation when someone needs this
-#else
(void)pOutGlyphWidths;
fprintf(stderr,"CreateFontSubsetFromType1: replace dummy implementation\n");
-#endif
return false;
}
// ====================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx
index 403e64768872..da0d84cec089 100644
--- a/vcl/source/fontsubset/gsub.cxx
+++ b/vcl/source/fontsubset/gsub.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,9 +48,9 @@ typedef sal_uInt8 FT_Byte;
typedef std::map<sal_uInt16,sal_uInt16> GlyphSubstitution;
-inline long NEXT_Long( const unsigned char* &p )
+inline sal_uInt32 NEXT_Long( const unsigned char* &p )
{
- long nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3];
+ sal_uInt32 nVal = (p[0]<<24) + (p[1]<<16) + (p[2]<<8) + p[3];
p += 4;
return nVal;
}
@@ -356,3 +357,5 @@ int HasVerticalGSUB( struct _TrueTypeFont* pTTFile )
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/gsub.h b/vcl/source/fontsubset/gsub.h
index 9d552ce45701..bb4543f372da 100644
--- a/vcl/source/fontsubset/gsub.h
+++ b/vcl/source/fontsubset/gsub.h
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -42,3 +43,5 @@ void ReleaseGSUB( struct vcl::_TrueTypeFont* pTTFile );
}
#endif /* _PSP_GSUB_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/list.c b/vcl/source/fontsubset/list.c
index 3b55b4dfee15..def5faa7b553 100644
--- a/vcl/source/fontsubset/list.c
+++ b/vcl/source/fontsubset/list.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,20 +35,12 @@
/*[]---------------------------------------------------[]*/
#include <stdlib.h>
-
-#if OSL_DEBUG_LEVEL == 0
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-
#include <assert.h>
#ifdef MALLOC_TRACE
#include <stdio.h>
#include </usr/local/include/malloc.h>
#endif
-/* #define TEST */
#include "list.h"
/*- private data types */
@@ -100,31 +93,6 @@ static lnode *appendPrim(list this, void *el)
this->aCount++;
return ptr;
}
-#ifdef TEST
-static lnode *prependPrim(list this, void *el)
-{
- lnode *ptr = newNode(el);
- lnode *flink, **blink;
-
- if (this->head != 0) {
- blink = &(this->head->prev);
- flink = this->head;
- } else {
- blink = &this->tail;
- flink = 0;
- this->cptr = ptr; /*- list was empty - set current to this element */
- }
-
- *blink = ptr;
- this->head = ptr;
-
- ptr->next = flink;
- ptr->prev = 0;
-
- this->aCount++;
- return ptr;
-}
-#endif
/*- public methods */
list listNewEmpty(void) /*- default ctor */
@@ -139,32 +107,6 @@ list listNewEmpty(void) /*- default ctor */
return this;
}
-#ifdef TEST
-list listNewCopy(list l) /*- copy ctor */
-{
- lnode *ptr, *c;
- list this;
- assert(l != 0);
-
- this = malloc(sizeof(struct _list));
- assert(this != 0);
-
- ptr = l->head;
-
- this->aCount = 0;
- this->eDtor = 0;
- this->head = this->tail = this->cptr = 0;
-
- while (ptr) {
- c = appendPrim(this, ptr->value);
- if (ptr == l->cptr) this->cptr = c;
- ptr = ptr->next;
- }
-
- return this;
-}
-#endif
-
void listDispose(list this) /*- dtor */
{
assert(this != 0);
@@ -198,36 +140,6 @@ int listIsEmpty(list this)
return this->aCount == 0;
}
-
-#ifdef TEST
-int listAtFirst(list this)
-{
- assert(this != 0);
- return this->cptr == this->head;
-}
-
-int listAtLast(list this)
-{
- assert(this != 0);
- return this->cptr == this->tail;
-}
-
-int listPosition(list this)
-{
- int res = 0;
- lnode *ptr;
- assert(this != 0);
-
- ptr = this->head;
-
- while (ptr != this->cptr) {
- ptr = ptr->next;
- res++;
- }
-
- return res;
-}
-#endif
int listFind(list this, void *el)
{
lnode *ptr;
@@ -311,59 +223,7 @@ list listAppend(list this, void *el)
appendPrim(this, el);
return this;
}
-#ifdef TEST
-list listPrepend(list this, void *el)
-{
- assert(this != 0);
-
- prependPrim(this, el);
- return this;
-}
-
-list listInsertAfter(list this, void *el)
-{
- lnode *ptr;
- assert(this != 0);
-
- if (this->cptr == 0) return listAppend(this, el);
-
- ptr = newNode(el);
-
- ptr->prev = this->cptr;
- ptr->next = this->cptr->next;
- this->cptr->next = ptr;
-
- if (ptr->next != 0) {
- ptr->next->prev = ptr;
- } else {
- this->tail = ptr;
- }
- this->aCount++;
- return this;
-}
-
-list listInsertBefore(list this, void *el)
-{
- lnode *ptr;
- assert(this != 0);
-
- if (this->cptr == 0) return listAppend(this, el);
-
- ptr = newNode(el);
- ptr->prev = this->cptr->prev;
- ptr->next = this->cptr;
- this->cptr->prev = ptr;
-
- if (ptr->prev != 0) {
- ptr->prev->next = ptr;
- } else {
- this->head = ptr;
- }
- this->aCount++;
- return this;
-}
-#endif
list listRemove(list this)
{
lnode *ptr = 0;
@@ -408,134 +268,4 @@ list listClear(list this)
return this;
}
-#ifdef TEST
-
-void listForAll(list this, void (*f)(void *))
-{
- lnode *ptr = this->head;
- while (ptr) {
- f(ptr->value);
- ptr = ptr->next;
- }
-}
-
-
-#include <stdio.h>
-
-void printlist(list l)
-{
- int saved;
- assert(l != 0);
- saved = listPosition(l);
-
- printf("[ ");
-
- if (!listIsEmpty(l)) {
- listToFirst(l);
- do {
- printf("%d ", (int) listCurrent(l));
- } while (listNext(l));
- }
-
- printf("]\n");
-
- listPositionAt(l, saved);
-}
-
-void printstringlist(list l)
-{
- int saved;
- assert(l != 0);
- saved = listPosition(l);
-
- printf("[ ");
-
- if (!listIsEmpty(l)) {
- listToFirst(l);
- do {
- printf("'%s' ", (char *) listCurrent(l));
- } while (listNext(l));
- }
-
- printf("]\n");
-
- listPositionAt(l, saved);
-}
-
-void printstat(list l)
-{
- printf("count: %d, position: %d, isEmpty: %d, atFirst: %d, atLast: %d.\n",
- listCount(l), listPosition(l), listIsEmpty(l), listAtFirst(l), listAtLast(l));
-}
-
-void allfunc(void *e)
-{
- printf("%d ", e);
-}
-
-void edtor(void *ptr)
-{
- printf("element dtor: 0x%08x\n", ptr);
- free(ptr);
-}
-
-int main()
-{
- list l1, l2;
- char *ptr;
- int i;
-
-#ifdef MALLOC_TRACE
- mal_leaktrace(1);
- mal_debug(2);
-#endif
-
- l1 = listNewEmpty();
- printstat(l1);
-
- listAppend(l1, 1);
- printstat(l1);
-
- listAppend(l1, 2);
- printstat(l1);
-
- listAppend(l1, 3);
- printstat(l1);
-
- printlist(l1);
-
- listToFirst(l1);
- listInsertBefore(l1, -5);
- printlist(l1);
-
- l2 = listNewCopy(l1);
- printlist(l2);
-
- listForAll(l2, allfunc);
- printf("\n");
-
- listClear(l1);
- listSetElementDtor(l1, edtor);
-
- for(i=0; i<10; i++) {
- ptr = malloc(20);
- snprintf(ptr, 20, "element # %d", i);
- listAppend(l1, ptr);
- }
-
- printstringlist(l1);
-
-
- listDispose(l1);
- listDispose(l2);
-
-#ifdef MALLOC_TRACE
- mal_dumpleaktrace(stdout);
-#endif
-
-
- return 0;
-}
-#endif
-
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index c94aad3cbab6..4e3f8ceb0cf2 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,11 +36,6 @@
*
*/
-#if OSL_DEBUG_LEVEL == 0
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
#include <assert.h>
#include <stdlib.h>
@@ -64,10 +60,6 @@
#include <osl/endian.h>
#include <algorithm>
-#ifdef TEST7
-#include <ctype.h>
-#endif
-
namespace vcl
{
@@ -675,10 +667,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
glyphlist.push_back( index );
-#ifdef DEBUG2
- fprintf(stderr,"glyphlist: += %d\n", index);
-#endif
-
if ((np = GetTTGlyphOutline(ttf, index, &nextComponent, 0, &glyphlist)) == 0)
{
/* XXX that probably indicates a corrupted font */
@@ -688,18 +676,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
#endif
}
-#ifdef DEBUG2
- fprintf(stderr,"%d [", (int)glyphlist.size() );
- for( std::vector< sal_uInt32 >::const_iterator it = glyphlist.begin();
- it != glyphlist.end(); ++it )
- {
- fprintf( stderr,"%d ", (int) *it );
- }
- fprintf(stderr, "]\n");
- if( ! glyphlist.empty() )
- fprintf(stderr, "glyphlist: -= %d\n", (int) glyphlist.back());
-
-#endif
if( ! glyphlist.empty() )
glyphlist.pop_back();
@@ -729,23 +705,14 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
b = c = 0;
if (flags & WE_HAVE_A_SCALE) {
-#ifdef DEBUG2
- fprintf(stderr, "WE_HAVE_A_SCALE\n");
-#endif
a = GetInt16(ptr, 0, 1) << 2;
d = a;
ptr += 2;
} else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
-#ifdef DEBUG2
- fprintf(stderr, "WE_HAVE_AN_X_AND_Y_SCALE\n");
-#endif
a = GetInt16(ptr, 0, 1) << 2;
d = GetInt16(ptr, 2, 1) << 2;
ptr += 4;
} else if (flags & WE_HAVE_A_TWO_BY_TWO) {
-#ifdef DEBUG2
- fprintf(stderr, "WE_HAVE_A_TWO_BY_TWO\n");
-#endif
a = GetInt16(ptr, 0, 1) << 2;
b = GetInt16(ptr, 2, 1) << 2;
c = GetInt16(ptr, 4, 1) << 2;
@@ -771,18 +738,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
assert(!"ARGS_ARE_XY_VALUES is not implemented!!!\n");
}
-#ifdef DEBUG2
- fprintf(stderr, "a: %f, b: %f, c: %f, d: %f, e: %f, f: %f, m: %f, n: %f\n",
- ((double) a) / 65536,
- ((double) b) / 65536,
- ((double) c) / 65536,
- ((double) d) / 65536,
- ((double) e) / 65536,
- ((double) f) / 65536,
- ((double) m) / 65536,
- ((double) n) / 65536);
-#endif
-
for (i=0; i<np; i++) {
F16Dot16 t;
ControlPoint cp;
@@ -792,10 +747,6 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
t = fixedMulDiv(b, nextComponent[i].x << 16, n) + fixedMulDiv(d, nextComponent[i].y << 16, n) + (f << 16);
cp.y = (sal_Int16)(fixedMul(t, n) >> 16);
-#ifdef DEBUG2
- fprintf(stderr, "( %d %d ) -> ( %d %d )\n", nextComponent[i].x, nextComponent[i].y, cp.x, cp.y);
-#endif
-
myPoints.push_back( cp );
}
@@ -857,21 +808,6 @@ static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint
res = GetCompoundTTOutline(ttf, glyphID, pointArray, metrics, glyphlist ? *glyphlist : aPrivList );
}
-#ifdef DEBUG3
- {
- int i;
- FILE *out = fopen("points.dat", "a");
- assert(out != 0);
- fprintf(out, "Glyph: %d\nPoints: %d\n", glyphID, res);
- for (i=0; i<res; i++) {
- fprintf(out, "%c ", ((*pointArray)[i].flags & 0x8000) ? 'X' : '.');
- fprintf(out, "%c ", ((*pointArray)[i].flags & 1) ? '+' : '-');
- fprintf(out, "%d %d\n", (*pointArray)[i].x, (*pointArray)[i].y);
- }
- fclose(out);
- }
-#endif
-
return res;
}
@@ -1332,7 +1268,7 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, sal_uInt32 c) {
sal_uInt16 * idDelta;
/* sal_uInt16 * glyphIdArray; */
sal_uInt16 * idRangeOffset;
- sal_uInt16 * glyphIndexArray;
+ /*sal_uInt16 * glyphIndexArray;*/
sal_uInt16 *CMAP4 = (sal_uInt16 *) cmap;
/* sal_uInt16 GEbinsearch(sal_uInt16 *ar, sal_uInt16 length, sal_uInt16 toSearch); */
@@ -1350,7 +1286,7 @@ static sal_uInt32 getGlyph4(const sal_uInt8 *cmap, sal_uInt32 c) {
}
idDelta = startCode + segCount;
idRangeOffset = idDelta + segCount;
- glyphIndexArray = idRangeOffset + segCount;
+ /*glyphIndexArray = idRangeOffset + segCount;*/
if(Int16FromMOTA(idRangeOffset[i]) != 0) {
c = Int16FromMOTA(*(&(idRangeOffset[i]) + (Int16FromMOTA(idRangeOffset[i])/2 + (c - Int16FromMOTA(startCode[i])))));
@@ -1545,79 +1481,6 @@ static void GetKern(TrueTypeFont *ttf)
return;
}
-#ifdef TEST5
-/* KernGlyphsPrim?() functions expect the caller to ensure the validity of their arguments and
- * that x and y elements of the kern array are initialized to zeroes
- */
-static void KernGlyphsPrim1(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern)
-{
- (void)ttf; /* avoid warning */
- (void)glyphs; /* avoid warning */
- (void)nglyphs; /* avoid warning */
- (void)wmode; /* avoid warning */
- (void)nglyphs; /* avoid warning */
- (void)kern; /* avoid warning */
- fprintf(stderr, "MacOS kerning tables have not been implemented yet!\n");
-}
-
-static void KernGlyphsPrim2(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern)
-{
- sal_uInt32 i, j;
- sal_uInt32 gpair;
-
- if( ! nglyphs )
- return;
-
- for (i = 0; i < (sal_uInt32)nglyphs - 1; i++) {
- gpair = (glyphs[i] << 16) | glyphs[i+1];
-#ifdef DEBUG2
- /* All fonts with MS kern table that I've seen so far contain just one kern subtable.
- * MS kern documentation is very poor and I doubt that font developers will be using
- * several subtables. I expect them to be using OpenType tables instead.
- * According to MS documention, format 2 subtables are not supported by Windows and OS/2.
- */
- if (ttf->nkern > 1) {
- fprintf(stderr, "KernGlyphsPrim2: %d kern tables found.\n", ttf->nkern);
- }
-#endif
- for (j = 0; j < ttf->nkern; j++) {
- sal_uInt16 coverage = GetUInt16(ttf->kerntables[j], 4, 1);
- sal_uInt8 *ptr;
- int npairs;
- sal_uInt32 t;
- int l, r, k;
-
- if (! ((coverage & 1) ^ wmode)) continue;
- if ((coverage & 0xFFFE) != 0) {
-#ifdef DEBUG2
- fprintf(stderr, "KernGlyphsPrim2: coverage flags are not supported: %04X.\n", coverage);
-#endif
- continue;
- }
- ptr = ttf->kerntables[j];
- npairs = GetUInt16(ptr, 6, 1);
- ptr += 14;
- l = 0;
- r = npairs;
- do {
- k = (l + r) >> 1;
- t = GetUInt32(ptr, k * 6, 1);
- if (gpair >= t) l = k + 1;
- if (gpair <= t) r = k - 1;
- } while (l <= r);
- if (l - r == 2) {
- if (!wmode) {
- kern[i].x = XUnits(ttf->unitsPerEm, GetInt16(ptr, 4 + (l-1) * 6, 1));
- } else {
- kern[i].y = XUnits(ttf->unitsPerEm, GetInt16(ptr, 4 + (l-1) * 6, 1));
- }
- /* !wmode ? kern[i].x : kern[i].y = GetInt16(ptr, 4 + (l-1) * 6, 1); */
- }
- }
- }
-}
-#endif
-
/*- Public functions */ /*FOLD00*/
int CountTTCFonts(const char* fname)
@@ -1753,10 +1616,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
return SF_TTFORMAT;
}
-#ifdef DEBUG2
- fprintf(stderr, "tdoffset: %d\n", tdoffset);
-#endif
-
/* magic number */
t->tag = TTFontClassTag;
@@ -1841,7 +1700,7 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
{
#if OSL_DEBUG_LEVEL > 1
if( t->tables[i] )
- fprintf( stderr, "font file %s has bad table offset %d (tagnum=%d)\n", t->fname, (sal_uInt8*)t->tables[i]-t->ptr, i );
+ fprintf( stderr, "font file %s has bad table offset %" SAL_PRI_PTRDIFFT "d (tagnum=%d)\n", t->fname, (sal_uInt8*)t->tables[i]-t->ptr, i );
#endif
t->tlens[i] = 0;
t->tables[i] = NULL;
@@ -1918,8 +1777,6 @@ static int doOpenTTFont( sal_uInt32 facenum, TrueTypeFont* t )
void CloseTTFont(TrueTypeFont *ttf) /*FOLD01*/
{
- if (ttf->tag != TTFontClassTag) return;
-
#if !defined(WIN32) && !defined(OS2)
if( ttf->fname )
munmap((char *) ttf->ptr, ttf->fsize);
@@ -2057,7 +1914,7 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO
fprintf(outf, h02, modname, modver, modextra);
fprintf(outf, h09, ttf->psname);
- fprintf(outf, h10);
+ fprintf(outf, "%s", h10);
fprintf(outf, h11, fname);
/* fprintf(outf, h12, 4000000); */
@@ -2072,17 +1929,17 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO
*/
fprintf(outf, h17, rtl_crc32(0, ttf->ptr, ttf->fsize), nGlyphs, rtl_crc32(0, glyphArray, nGlyphs * 2), rtl_crc32(0, encoding, nGlyphs));
- fprintf(outf, h13);
+ fprintf(outf, "%s", h13);
fprintf(outf, h14, XUnits(UPEm, GetInt16(table, 36, 1)), XUnits(UPEm, GetInt16(table, 38, 1)), XUnits(UPEm, GetInt16(table, 40, 1)), XUnits(UPEm, GetInt16(table, 42, 1)));
- fprintf(outf, h15);
+ fprintf(outf, "%s", h15);
for (i = 0; i < nGlyphs; i++) {
fprintf(outf, h16, encoding[i], i);
}
fprintf(outf, h30, nGlyphs+1);
- fprintf(outf, h31);
- fprintf(outf, h32);
+ fprintf(outf, "%s", h31);
+ fprintf(outf, "%s", h32);
for (i = 0; i < nGlyphs; i++) {
fprintf(outf, h33, i);
@@ -2130,14 +1987,14 @@ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, /*FO
}
if (n > 0) fprintf(outf, "\tfill\n"); /* if glyph is not a whitespace character */
- fprintf(outf, h34);
+ fprintf(outf, "%s", h34);
free(pa);
free(path);
}
- fprintf(outf, h35);
+ fprintf(outf, "%s", h35);
- fprintf(outf, h40);
+ fprintf(outf, "%s", h40);
fprintf(outf, h41, fname);
return SF_OK;
@@ -2740,23 +2597,6 @@ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info)
}
}
-#ifdef TEST5
-void KernGlyphs(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern)
-{
- int i;
-
- if (!nglyphs || !glyphs || !kern) return;
-
- for (i = 0; i < nglyphs-1; i++) kern[i].x = kern[i].y = 0;
-
- switch (ttf->kerntype) {
- case KT_APPLE_NEW: KernGlyphsPrim1(ttf, glyphs, nglyphs, wmode, kern); return;
- case KT_MICROSOFT: KernGlyphsPrim2(ttf, glyphs, nglyphs, wmode, kern); return;
- default: return;
- }
-}
-#endif
-
GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID)
{
const sal_uInt8* glyf = getTable(ttf, O_glyf);
@@ -2861,10 +2701,6 @@ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr)
}
else
{
-#ifdef DEBUG
- fprintf( stderr, "found invalid name record %d with name id %d for file %s\n",
- i, rec[i].nameID, ttf->fname );
-#endif
rec[i].sptr = 0;
rec[i].slen = 0;
}
@@ -2889,471 +2725,54 @@ void DisposeNameRecords(NameRecord* nr, int n)
free(nr);
}
-} // namespace vcl
-
-
-#ifdef TEST1
-/* This example creates a subset of a TrueType font with two encoded characters */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- int r;
-
- /* Array of Unicode source characters */
- sal_uInt16 chars[2];
-
- /* Encoding vector maps character encoding to the ordinal number
- * of the glyph in the output file */
- sal_uInt8 encoding[2];
-
- /* This array is for glyph IDs that source characters map to */
- sal_uInt16 g[2];
-
-
- if (ac < 2) return 0;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
-
- /* We want to create the output file that only contains two Unicode characters:
- * L'a' and L'A' */
-
- chars[0] = L'a';
- chars[1] = L'A';
-
- /* Figure out what glyphs do these characters map in our font */
- MapString(fnt, chars, 2, g);
-
- /* Encode the characters. Value of encoding[i] is the number 0..255 which maps to glyph i of the
- * newly generated font */
- encoding[0] = chars[0];
- encoding[1] = chars[1];
-
-
- /* Generate a subset */
- CreateT3FromTTGlyphs(fnt, stdout, 0, g, encoding, 2, 0);
-
- /* Now call the dtor for the font */
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-#ifdef TEST2
-/* This example extracts first 224 glyphs from a TT fonts and encodes them starting at 32 */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- int i, r;
-
- /* Array of Unicode source characters */
- sal_uInt16 glyphs[224];
-
- /* Encoding vector maps character encoding to the ordinal number
- * of the glyph in the output file */
- sal_uInt8 encoding[224];
-
-
-
- for (i=0; i<224; i++) {
- glyphs[i] = i;
- encoding[i] = 32 + i;
- }
-
- if (ac < 2) return 0;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
-
- /* Encode the characters. Value of encoding[i] is the number 0..255 which maps to glyph i of the
- * newly generated font */
-
- /* Generate a subset */
- CreateT3FromTTGlyphs(fnt, stdout, 0, glyphs, encoding, 224, 0);
-
- /* Now call the dtor for the font */
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-#ifdef TEST3
-/* Glyph metrics example */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- int i, r;
- sal_uInt16 glyphs[224];
- TTSimpleGlyphMetrics *m;
-
- for (i=0; i<224; i++) {
- glyphs[i] = i;
- }
-
- if (ac < 2) return 0;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- if ((m = GetTTSimpleGlyphMetrics(fnt, glyphs, 224, 0)) == 0) {
- printf("Requested metrics is not available\n");
- } else {
- for (i=0; i<224; i++) {
- printf("%d. advWid: %5d, LSBear: %5d\n", i, m[i].adv, m[i].sb);
- }
- }
-
- /* Now call the dtor for the font */
- free(m);
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-#ifdef TEST4
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- TTGlobalFontInfo info;
- int i, r;
-
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- printf("Font file: %s\n", av[1]);
-
-#ifdef PRINT_KERN
- switch (fnt->kerntype) {
- case KT_MICROSOFT:
- printf("\tkern: MICROSOFT, ntables: %d.", fnt->nkern);
- if (fnt->nkern) {
- printf(" [");
- for (i=0; i<fnt->nkern; i++) {
- printf("%04X ", GetUInt16(fnt->kerntables[i], 4, 1));
- }
- printf("]");
- }
- printf("\n");
- break;
-
- case KT_APPLE_NEW:
- printf("\tkern: APPLE_NEW, ntables: %d.", fnt->nkern);
- if (fnt->nkern) {
- printf(" [");
- for (i=0; i<fnt->nkern; i++) {
- printf("%04X ", GetUInt16(fnt->kerntables[i], 4, 1));
- }
- printf("]");
- }
- printf("\n");
- break;
-
- case KT_NONE:
- printf("\tkern: none.\n");
- break;
-
- default:
- printf("\tkern: unrecoginzed.\n");
- break;
- }
- printf("\n");
-#endif
-
- GetTTGlobalFontInfo(fnt, &info);
- printf("\tfamily name: `%s`\n", info.family);
- printf("\tsubfamily name: `%s`\n", info.subfamily);
- printf("\tpostscript name: `%s`\n", info.psname);
- printf("\tweight: %d\n", info.weight);
- printf("\twidth: %d\n", info.width);
- printf("\tpitch: %d\n", info.pitch);
- printf("\titalic angle: %d\n", info.italicAngle);
- printf("\tbouding box: [%d %d %d %d]\n", info.xMin, info.yMin, info.xMax, info.yMax);
- printf("\tascender: %d\n", info.ascender);
- printf("\tdescender: %d\n", info.descender);
- printf("\tlinegap: %d\n", info.linegap);
- printf("\tvascent: %d\n", info.vascent);
- printf("\tvdescent: %d\n", info.vdescent);
- printf("\ttypoAscender: %d\n", info.typoAscender);
- printf("\ttypoDescender: %d\n", info.typoDescender);
- printf("\ttypoLineGap: %d\n", info.typoLineGap);
- printf("\twinAscent: %d\n", info.winAscent);
- printf("\twinDescent: %d\n", info.winDescent);
- printf("\tUnicode ranges:\n");
- for (i = 0; i < 32; i++) {
- if ((info.ur1 >> i) & 1) {
- printf("\t\t\t%s\n", UnicodeRangeName(i));
- }
- }
- for (i = 0; i < 32; i++) {
- if ((info.ur2 >> i) & 1) {
- printf("\t\t\t%s\n", UnicodeRangeName(i+32));
- }
- }
- for (i = 0; i < 32; i++) {
- if ((info.ur3 >> i) & 1) {
- printf("\t\t\t%s\n", UnicodeRangeName(i+64));
- }
- }
- for (i = 0; i < 32; i++) {
- if ((info.ur4 >> i) & 1) {
- printf("\t\t\t%s\n", UnicodeRangeName(i+96));
- }
- }
-
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-#ifdef TEST5
-/* Kerning example */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- sal_uInt16 g[224];
- KernData d[223];
- int r, i, k = 0;
-
- g[k++] = 11;
- g[k++] = 36;
- g[k++] = 11;
- g[k++] = 98;
- g[k++] = 11;
- g[k++] = 144;
- g[k++] = 41;
- g[k++] = 171;
- g[k++] = 51;
- g[k++] = 15;
-
- if (ac < 2) return 0;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- KernGlyphs(fnt, g, k, 0, d);
-
- for (i = 0; i < k-1; i++) {
- printf("%3d %3d: [%3d %3d]\n", g[i], g[i+1], d[i].x, d[i].y);
- }
-
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-
-
-#ifdef TEST6
-/* This example extracts a single glyph from a font */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- int r, i;
-
- sal_uInt16 glyphs[256];
- sal_uInt8 encoding[256];
-
- for (i=0; i<256; i++) {
- glyphs[i] = 512 + i;
- encoding[i] = i;
- }
-
-#if 0
- i=0;
- glyphs[i++] = 2001;
- glyphs[i++] = 2002;
- glyphs[i++] = 2003;
- glyphs[i++] = 2004;
- glyphs[i++] = 2005;
- glyphs[i++] = 2006;
- glyphs[i++] = 2007;
- glyphs[i++] = 2008;
- glyphs[i++] = 2009;
- glyphs[i++] = 2010;
- glyphs[i++] = 2011;
- glyphs[i++] = 2012;
- glyphs[i++] = 2013;
- glyphs[i++] = 2014;
- glyphs[i++] = 2015;
- glyphs[i++] = 2016;
- glyphs[i++] = 2017;
- glyphs[i++] = 2018;
- glyphs[i++] = 2019;
- glyphs[i++] = 2020;
-
-
- r = 97;
- i = 0;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
- encoding[i++] = r++;
-#endif
-
- if (ac < 2) return 0;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- /* Generate a subset */
- CreateT3FromTTGlyphs(fnt, stdout, 0, glyphs, encoding, 256, 0);
-
- fprintf(stderr, "UnitsPerEm: %d.\n", fnt->unitsPerEm);
-
- /* Now call the dtor for the font */
- CloseTTFont(fnt);
- return 0;
-}
-#endif
-
-#ifdef TEST7
-/* NameRecord extraction example */
-int main(int ac, char **av)
+bool getTTCoverage(
+ boost::dynamic_bitset<sal_uInt32> &rUnicodeRange,
+ boost::dynamic_bitset<sal_uInt32> &rCodePageRange,
+ const unsigned char* pTable, size_t nLength)
{
- TrueTypeFont *fnt;
- int r, i, j, n;
- NameRecord *nr;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- if ((n = GetTTNameRecords(fnt, &nr)) == 0) {
- fprintf(stderr, "No name records in the font.\n");
- return 0;
- }
-
- printf("Number of name records: %d.\n", n);
- for (i = 0; i < n; i++) {
- printf("%d %d %04X %d [", nr[i].platformID, nr[i].encodingID, nr[i].languageID, nr[i].nameID);
- for (j=0; j<nr[i].slen; j++) {
- printf("%c", isprint(nr[i].sptr[j]) ? nr[i].sptr[j] : '.');
+ bool bRet = false;
+ sal_uInt16 nVersion = GetUInt16(pTable, 0, 1);
+ // parse OS/2 header
+ if ( nVersion >= 0x0001 && nLength >= 58 )
+ {
+ rUnicodeRange.append(GetUInt32(pTable, 42, 1));
+ rUnicodeRange.append(GetUInt32(pTable, 46, 1));
+ rUnicodeRange.append(GetUInt32(pTable, 50, 1));
+ rUnicodeRange.append(GetUInt32(pTable, 54, 1));
+ bRet = true;
+ if (nLength >= 86)
+ {
+ rCodePageRange.append(GetUInt32(pTable, 78, 1));
+ rCodePageRange.append(GetUInt32(pTable, 82, 1));
}
- printf("]\n");
}
-
-
- DisposeNameRecords(nr, n);
- CloseTTFont(fnt);
- return 0;
+ return bRet;
}
-#endif
-#ifdef TEST8
-/* TrueType -> TrueType subsetting */
-int main(int ac, char **av)
+void getTTScripts(std::vector< sal_uInt32 > &rScriptTags, const unsigned char* pTable, size_t nLength)
{
- TrueTypeFont *fnt;
- sal_uInt16 glyphArray[] = { 0, 98, 99, 22, 24, 25, 26, 27, 28, 29, 30, 31, 1270, 1289, 34};
- sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46};
- int r;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- CreateTTFromTTGlyphs(fnt, "subfont.ttf", glyphArray, encoding, 15, 0, 0, TTCF_AutoName | TTCF_IncludeOS2);
-
-
- CloseTTFont(fnt);
-
- return 0;
-}
-#endif
-
-#ifdef TEST9
-/* TrueType -> Type42 subsetting */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- /*
- sal_uInt16 glyphArray[] = { 0, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};
- sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46};
- */
- sal_uInt16 glyphArray[] = { 0, 6711, 6724, 11133, 11144, 14360, 26, 27, 28, 29, 30, 31, 1270, 1289, 34};
- sal_uInt8 encoding[] = {32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46};
- int r;
-
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
-
- CreateT42FromTTGlyphs(fnt, stdout, "testfont", glyphArray, encoding, 15);
-
- CloseTTFont(fnt);
-
- return 0;
-}
-#endif
-
-#ifdef TEST10
-/* Component glyph test */
-int main(int ac, char **av)
-{
- TrueTypeFont *fnt;
- int r, i;
- list glyphlist = listNewEmpty();
-
+ if (nLength < 6)
+ return;
- if ((r = OpenTTFont(av[1], 0, &fnt)) != SF_OK) {
- fprintf(stderr, "Error %d opening font file: `%s`.\n", r, av[1]);
- return 0;
- }
+ // parse GSUB/GPOS header
+ const sal_uInt16 nOfsScriptList = GetUInt16(pTable, 4, 1);
- for (i = 0; i < fnt->nglyphs; i++) {
- r = GetTTGlyphComponents(fnt, i, glyphlist);
- if (r > 1) {
- printf("%d -> ", i);
- listToFirst(glyphlist);
- do {
- printf("%d ", (int) listCurrent(glyphlist));
- } while (listNext(glyphlist));
- printf("\n");
- } else {
- printf("%d: single glyph.\n", i);
- }
- listClear(glyphlist);
+ // parse Script Table
+ const sal_uInt16 nCntScript = GetUInt16(pTable, nOfsScriptList, 1);
+ sal_uInt32 nCurrentPos = nOfsScriptList+2;
+ for( sal_uInt16 nScriptIndex = 0;
+ nScriptIndex < nCntScript && nLength >= 6; ++nScriptIndex,
+ nLength-=6 )
+ {
+ sal_uInt32 nTag = GetUInt32(pTable, nCurrentPos, 1);
+ nCurrentPos+=6;
+ rScriptTags.push_back(nTag); // e.g. hani/arab/kana/hang
}
- CloseTTFont(fnt);
- listDispose(glyphlist);
-
- return 0;
+ std::sort(rScriptTags.begin(), rScriptTags.end());
+ rScriptTags.erase(std::unique(rScriptTags.begin(), rScriptTags.end()), rScriptTags.end());
}
-#endif
+} // namespace vcl
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index badf9fb496b0..7a785b9bf99f 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1543,19 +1544,6 @@ static void ProcessTables(TrueTypeCreator *tt)
PutUInt16(maxCompositePoints, pMaxpData, 10, 1);
PutUInt16(maxCompositeContours, pMaxpData, 12, 1);
-#if 0
- /* XXX do not overwrite the existing data. Fix: re-calculate these numbers here */
- PutUInt16(2, maxp->data, 14, 1); /* maxZones is always 2 */
- PutUInt16(0, maxp->data, 16, 1); /* maxTwilightPoints */
- PutUInt16(0, maxp->data, 18, 1); /* maxStorage */
- PutUInt16(0, maxp->data, 20, 1); /* maxFunctionDefs */
- PutUint16(0, maxp->data, 22, 1); /* maxInstructionDefs */
- PutUint16(0, maxp->data, 24, 1); /* maxStackElements */
- PutUint16(0, maxp->data, 26, 1); /* maxSizeOfInstructions */
- PutUint16(0, maxp->data, 28, 1); /* maxComponentElements */
- PutUint16(0, maxp->data, 30, 1); /* maxComponentDepth */
-#endif
-
/*
* Generate an htmx table and update hhea table
*/
@@ -1664,3 +1652,5 @@ int main(void)
return 0;
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/ttcr.hxx b/vcl/source/fontsubset/ttcr.hxx
index 69583ecdbdda..b2beb0549174 100644
--- a/vcl/source/fontsubset/ttcr.hxx
+++ b/vcl/source/fontsubset/ttcr.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -259,3 +260,5 @@ extern "C"
}
#endif /* __TTCR_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/xlat.cxx b/vcl/source/fontsubset/xlat.cxx
index 108c69cee8c7..1df7a5a2fdde 100644
--- a/vcl/source/fontsubset/xlat.cxx
+++ b/vcl/source/fontsubset/xlat.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -219,3 +220,4 @@ void TranslateString16(sal_uInt16 *src, sal_uInt16 *dst, sal_uInt32 n)
} // namespace vcl
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/fontsubset/xlat.hxx b/vcl/source/fontsubset/xlat.hxx
index 5960336e13e3..3d8622bf9ae7 100644
--- a/vcl/source/fontsubset/xlat.hxx
+++ b/vcl/source/fontsubset/xlat.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -52,3 +53,4 @@ namespace vcl
#endif /* __XLAT_H */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/alpha.cxx b/vcl/source/gdi/alpha.cxx
index 21c3f15f51c0..6107affaf4e9 100644
--- a/vcl/source/gdi/alpha.cxx
+++ b/vcl/source/gdi/alpha.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -432,3 +433,5 @@ void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess )
Bitmap::Convert( BMP_CONVERSION_8BIT_GREYS );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 9fc45f2f61d6..63d0010bd5d2 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -937,3 +938,5 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation )
return rIStm;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx
index 83820bc654bf..9912b3e91509 100644
--- a/vcl/source/gdi/base14.cxx
+++ b/vcl/source/gdi/base14.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,7 +33,9 @@
#include <rtl/strbuf.hxx>
using namespace vcl;
-using namespace rtl;
+
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
OString PDFWriterImpl::BuiltinFont::getNameObject() const
{
@@ -685,3 +688,4 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = {
};
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index bcf141a8e005..e2ab338e66b0 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,7 +33,6 @@
#include <tools/stream.hxx>
#include <tools/poly.hxx>
#include <tools/rc.h>
-
#include <vcl/salbtype.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
@@ -223,7 +223,7 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
}
else
{
- DBG_ERROR( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" );
+ OSL_FAIL( "Bitmap::GetGreyPalette: invalid entry count (2/4/16/256 allowed)" );
return aGreyPalette2;
}
}
@@ -1745,38 +1745,6 @@ Bitmap Bitmap::CreateDisplayBitmap( OutputDevice* pDisplay )
// ------------------------------------------------------------------
-Bitmap Bitmap::GetColorTransformedBitmap( BmpColorMode eColorMode ) const
-{
- Bitmap aRet;
-
- if( BMP_COLOR_HIGHCONTRAST == eColorMode )
- {
- Color* pSrcColors = NULL;
- Color* pDstColors = NULL;
- sal_uLong nColorCount = 0;
-
- aRet = *this;
-
- Image::GetColorTransformArrays( (ImageColorTransform) eColorMode, pSrcColors, pDstColors, nColorCount );
-
- if( nColorCount && pSrcColors && pDstColors )
- aRet.Replace( pSrcColors, pDstColors, nColorCount );
-
- delete[] pSrcColors;
- delete[] pDstColors;
- }
- else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode ||
- BMP_COLOR_MONOCHROME_WHITE == eColorMode )
- {
- aRet = *this;
- aRet.MakeMono( BMP_COLOR_MONOCHROME_THRESHOLD );
- }
-
- return aRet;
-}
-
-// ------------------------------------------------------------------
-
sal_Bool Bitmap::CombineSimple( const Bitmap& rMask, BmpCombine eCombine )
{
BitmapReadAccess* pMaskAcc = ( (Bitmap&) rMask ).AcquireReadAccess();
@@ -1971,3 +1939,5 @@ bool Bitmap::GetSystemData( BitmapSystemData& rData ) const
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
index 8dffa7d59a2c..9db334395e23 100644
--- a/vcl/source/gdi/bitmap2.cxx
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#include "precompiled_vcl.hxx"
#include <tools/zcodec.hxx>
-#ifndef _TOOLS_STREAM_HXX
#include <tools/stream.hxx>
-#endif
#include <vcl/salbtype.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/outdev.hxx>
@@ -46,6 +45,8 @@
#define DIBCOREHEADERSIZE ( 12UL )
#define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
+#define BITMAPINFOHEADER 0x28
+
#define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
// ----------------------
@@ -129,7 +130,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap )
// ------------------------------------------------------------------
-sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader )
+sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader, sal_Bool bIsMSOFormat )
{
const sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt();
const sal_uLong nOldPos = rIStm.Tell();
@@ -144,7 +145,7 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader )
bRet = ImplReadDIB( rIStm, *this, nOffset );
}
else
- bRet = ImplReadDIB( rIStm, *this, nOffset );
+ bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat );
if( !bRet )
{
@@ -161,18 +162,18 @@ sal_Bool Bitmap::Read( SvStream& rIStm, sal_Bool bFileHeader )
// ------------------------------------------------------------------
-sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset )
+sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset, sal_Bool bIsMSOFormat )
{
DIBInfoHeader aHeader;
const sal_uLong nStmPos = rIStm.Tell();
sal_Bool bRet = sal_False;
sal_Bool bTopDown = sal_False;
- if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
+ if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
{
const sal_uInt16 nBitCount( discretizeBitcount(aHeader.nBitCount) );
- const Size aSizePixel( aHeader.nWidth, aHeader.nHeight );
+ const Size aSizePixel( aHeader.nWidth, abs(aHeader.nHeight) );
BitmapPalette aDummyPal;
Bitmap aNewBmp( aSizePixel, nBitCount, &aDummyPal );
BitmapWriteAccess* pAcc = aNewBmp.AcquireWriteAccess();
@@ -215,7 +216,8 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset )
// set decoded bytes to memory stream,
// from which we will read the bitmap data
- pIStm = pMemStm = new SvMemoryStream;
+ pMemStm = new SvMemoryStream;
+ pIStm = pMemStm;
pMemStm->SetBuffer( (char*) pData, nUncodedSize, sal_False, nUncodedSize );
nOffset = 0;
}
@@ -244,7 +246,7 @@ sal_Bool Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, sal_uLong nOffset )
Fraction( 1000, aHeader.nYPelsPerMeter ) );
aNewBmp.SetPrefMapMode( aMapMode );
- aNewBmp.SetPrefSize( Size( aHeader.nWidth, aHeader.nHeight ) );
+ aNewBmp.SetPrefSize( Size( aHeader.nWidth, abs(aHeader.nHeight) ) );
}
}
@@ -299,21 +301,37 @@ sal_Bool Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
// ------------------------------------------------------------------
-sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown )
+sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat )
{
// BITMAPINFOHEADER or BITMAPCOREHEADER
rIStm >> rHeader.nSize;
// BITMAPCOREHEADER
+ sal_Int16 nTmp16 = 0;
if ( rHeader.nSize == DIBCOREHEADERSIZE )
{
- sal_Int16 nTmp16;
rIStm >> nTmp16; rHeader.nWidth = nTmp16;
rIStm >> nTmp16; rHeader.nHeight = nTmp16;
rIStm >> rHeader.nPlanes;
rIStm >> rHeader.nBitCount;
}
+ else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
+ {
+ sal_uInt8 nTmp8 = 0;
+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
+ rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
+ rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
+ rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
+ rIStm >> nTmp16; rHeader.nCompression = nTmp16;
+ if ( !rHeader.nSizeImage ) // uncompressed?
+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
+ rIStm >> rHeader.nXPelsPerMeter;
+ rIStm >> rHeader.nYPelsPerMeter;
+ rIStm >> rHeader.nColsUsed;
+ rIStm >> rHeader.nColsImportant;
+ }
else
{
// unknown Header
@@ -365,7 +383,7 @@ sal_Bool Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader,
else
{
rIStm >> rHeader.nWidth;
- rIStm >> rHeader.nHeight;
+ rIStm >> rHeader.nHeight; //rHeader.nHeight=abs(rHeader.nHeight);
rIStm >> rHeader.nPlanes;
rIStm >> rHeader.nBitCount;
rIStm >> rHeader.nCompression;
@@ -461,7 +479,13 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma
if( rHeader.nColsUsed && rHeader.nBitCount > 8 )
rIStm.SeekRel( rHeader.nColsUsed * ( ( rHeader.nSize != DIBCOREHEADERSIZE ) ? 4 : 3 ) );
- rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
+ if ( rHeader.nHeight > 0 )
+ rIStm.Read( rAcc.GetBuffer(), rHeader.nHeight * nAlignedWidth );
+ else
+ {
+ for( int i = abs(rHeader.nHeight)-1; i >= 0; i-- )
+ rIStm.Read( ((char*)rAcc.GetBuffer()) + (nAlignedWidth*i), nAlignedWidth );
+ }
}
else
{
@@ -504,7 +528,7 @@ sal_Bool Bitmap::ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, Bitma
else
{
const long nWidth = rHeader.nWidth;
- const long nHeight = rHeader.nHeight;
+ const long nHeight = abs(rHeader.nHeight);
sal_uInt8* pBuf = new sal_uInt8[ nAlignedWidth ];
// true color DIB's can have a (optimization) palette
@@ -1061,7 +1085,7 @@ void Bitmap::ImplDecodeRLE( sal_uInt8* pBuffer, DIBInfoHeader& rHeader,
BitmapWriteAccess& rAcc, sal_Bool bRLE4 )
{
Scanline pRLE = pBuffer;
- long nY = rHeader.nHeight - 1L;
+ long nY = abs(rHeader.nHeight) - 1L;
const sal_uLong nWidth = rAcc.Width();
sal_uLong nCountByte;
sal_uLong nRunByte;
@@ -1275,3 +1299,5 @@ sal_Bool Bitmap::ImplWriteRLE( SvStream& rOStm, BitmapReadAccess& rAcc, sal_Bool
return( rOStm.GetError() == 0UL );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index d39b0f7169d0..0ae8e63d2519 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -355,7 +356,7 @@ sal_Bool Bitmap::Convert( BmpConversion eConversion )
break;
default:
- DBG_ERROR( "Bitmap::Convert(): Unsupported conversion" );
+ OSL_FAIL( "Bitmap::Convert(): Unsupported conversion" );
break;
}
@@ -967,10 +968,11 @@ sal_Bool Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
const long nHeight = pReadAcc->Height();
long* pLutX = new long[ nNewWidth ];
long* pLutY = new long[ nNewHeight ];
- long nX, nY, nMapY, nActY = 0L;
if( nNewWidth1 && nNewHeight1 )
{
+ long nX, nY, nMapY, nActY = 0L;
+
for( nX = 0L; nX < nNewWidth; nX++ )
pLutX[ nX ] = nX * nWidth / nNewWidth;
@@ -1841,7 +1843,7 @@ sal_Bool Bitmap::ImplReduceMedian( sal_uInt16 nColCount )
nBitCount = 8;
else
{
- DBG_ERROR( "Bitmap::ImplReduceMedian(): invalid color count!" );
+ OSL_FAIL( "Bitmap::ImplReduceMedian(): invalid color count!" );
nBitCount = 8;
nColCount = 256;
}
@@ -2203,3 +2205,5 @@ sal_Bool Bitmap::Adjust( short nLuminancePercent, short nContrastPercent,
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx
index 5fe9139ea35e..1166f6cc0931 100644
--- a/vcl/source/gdi/bitmap4.cxx
+++ b/vcl/source/gdi/bitmap4.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +30,6 @@
#include "precompiled_vcl.hxx"
#include <stdlib.h>
-#include <vos/macros.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/bitmap.hxx>
@@ -98,7 +98,7 @@ sal_Bool Bitmap::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam,
break;
default:
- DBG_ERROR( "Bitmap::Convert(): Unsupported filter" );
+ OSL_FAIL( "Bitmap::Convert(): Unsupported filter" );
break;
}
@@ -474,7 +474,7 @@ sal_Bool Bitmap::ImplSobelGrey( const BmpFilterParam* /*pFilterParam*/, const Li
nSum2 += nMask332 * nGrey33;
nSum1 = (long) sqrt( (double)( nSum1 * nSum1 + nSum2 * nSum2 ) );
- aGrey.SetIndex( ~(sal_uInt8) VOS_BOUND( nSum1, 0, 255 ) );
+ aGrey.SetIndex( ~(sal_uInt8) SAL_BOUND( nSum1, 0, 255 ) );
pWriteAcc->SetPixel( nY, nX, aGrey );
if( nX < ( nWidth - 1 ) )
@@ -549,7 +549,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link*
const long nLz = FRound( sin( fElev ) * 255.0 );
const long nZ2 = ( ( 6 * 255 ) / 4 ) * ( ( 6 * 255 ) / 4 );
const long nNzLz = ( ( 6 * 255 ) / 4 ) * nLz;
- const sal_uInt8 cLz = (sal_uInt8) VOS_BOUND( nLz, 0, 255 );
+ const sal_uInt8 cLz = (sal_uInt8) SAL_BOUND( nLz, 0, 255 );
// fill mapping tables
pHMap[ 0 ] = 0;
@@ -586,7 +586,7 @@ sal_Bool Bitmap::ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link*
else
{
const double fGrey = nDotL / sqrt( (double)(nNx * nNx + nNy * nNy + nZ2) );
- aGrey.SetIndex( (sal_uInt8) VOS_BOUND( fGrey, 0, 255 ) );
+ aGrey.SetIndex( (sal_uInt8) SAL_BOUND( fGrey, 0, 255 ) );
}
pWriteAcc->SetPixel( nY, nX, aGrey );
@@ -687,7 +687,7 @@ sal_Bool Bitmap::ImplSepia( const BmpFilterParam* pFilterParam, const Link* /*pP
{
long nSepiaPercent = ( pFilterParam && pFilterParam->meFilter == BMP_FILTER_SEPIA ) ?
pFilterParam->mcSolarGreyThreshold : 10;
- const long nSepia = 10000 - 100 * VOS_BOUND( nSepiaPercent, 0, 100 );
+ const long nSepia = 10000 - 100 * SAL_BOUND( nSepiaPercent, 0, 100 );
BitmapPalette aSepiaPal( 256 );
DBG_ASSERT( nSepiaPercent <= 100, "Bitmap::ImplSepia(): sepia value out of range; defaulting to 100%" );
@@ -1007,3 +1007,5 @@ sal_Bool Bitmap::ImplPopArt( const BmpFilterParam* /*pFilterParam*/, const Link*
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 743326df04d5..2e77b666f8c8 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,6 +44,7 @@
#include <vcl/pngread.hxx>
#include <vcl/svapp.hxx>
#include <vcl/bmpacc.hxx>
+#include <vcl/virdev.hxx>
#include <image.h>
#include <impimagetree.hxx>
@@ -107,11 +109,11 @@ BitmapEx::BitmapEx( const ResId& rResId ) :
const String aFileName( pResMgr->ReadString() );
::rtl::OUString aCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
- if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this ) )
+ if( !aImageTree->loadImage( aFileName, aCurrentSymbolsStyle, *this, true ) )
{
#ifdef DBG_UTIL
ByteString aErrorStr( "BitmapEx::BitmapEx( const ResId& rResId ): could not load image <" );
- DBG_ERROR( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() );
+ OSL_FAIL( ( ( aErrorStr += ByteString( aFileName, RTL_TEXTENCODING_ASCII_US ) ) += '>' ).GetBuffer() );
#endif
}
}
@@ -301,36 +303,6 @@ Bitmap BitmapEx::GetBitmap( const Color* pTransReplaceColor ) const
// ------------------------------------------------------------------
-BitmapEx BitmapEx::GetColorTransformedBitmapEx( BmpColorMode eColorMode ) const
-{
- BitmapEx aRet;
-
- if( BMP_COLOR_HIGHCONTRAST == eColorMode )
- {
- aRet = *this;
- aRet.aBitmap = aBitmap.GetColorTransformedBitmap( eColorMode );
- }
- else if( BMP_COLOR_MONOCHROME_BLACK == eColorMode ||
- BMP_COLOR_MONOCHROME_WHITE == eColorMode )
- {
- aRet = *this;
- aRet.aBitmap = aRet.aBitmap.GetColorTransformedBitmap( eColorMode );
-
- if( !aRet.aMask.IsEmpty() )
- {
- aRet.aMask.CombineSimple( aRet.aBitmap, BMP_COMBINE_OR );
- aRet.aBitmap.Erase( ( BMP_COLOR_MONOCHROME_BLACK == eColorMode ) ? COL_BLACK : COL_WHITE );
-
- DBG_ASSERT( aRet.aBitmap.GetSizePixel() == aRet.aMask.GetSizePixel(),
- "BitmapEx::GetColorTransformedBitmapEx(): size mismatch for bitmap and alpha mask." );
- }
- }
-
- return aRet;
-}
-
-// ------------------------------------------------------------------
-
Bitmap BitmapEx::GetMask() const
{
Bitmap aRet( aMask );
@@ -758,6 +730,60 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
}
+BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
+{
+ Point aEmptyPoint(0,0);
+ sal_Int32 imgNewWidth = 0;
+ sal_Int32 imgNewHeight = 0;
+ double imgposX = 0;
+ double imgposY = 0;
+ BitmapEx aRet = aBitmap;
+ double imgOldWidth = aRet.GetSizePixel().Width();
+ double imgOldHeight =aRet.GetSizePixel().Height();
+
+ Size aScaledSize;
+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
+ {
+ if (imgOldWidth >= imgOldHeight)
+ {
+ imgNewWidth = aStandardSize;
+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
+ imgposX = 0;
+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+ else
+ {
+ imgNewHeight = aStandardSize;
+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
+ imgposY = 0;
+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+
+ aScaledSize = Size( imgNewWidth, imgNewHeight );
+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
+ }
+ else
+ {
+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
+ }
+
+ Size aStdSize( aStandardSize, aStandardSize );
+ Rectangle aRect(aEmptyPoint, aStdSize );
+
+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
+ aVirDevice.SetOutputSizePixel( aStdSize );
+ aVirDevice.SetFillColor( COL_TRANSPARENT );
+ aVirDevice.SetLineColor( COL_TRANSPARENT );
+
+ //draw a rect into virDevice
+ aVirDevice.DrawRect( aRect );
+ Point aPointPixel( (long)imgposX, (long)imgposY );
+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
+
+ return aRet;
+}
// ------------------------------------------------------------------
sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
@@ -913,3 +939,5 @@ SvStream& operator>>( SvStream& rIStm, BitmapEx& rBitmapEx )
return rIStm;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index ed0dc6225a0f..03b29fcbc965 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -252,7 +253,7 @@ void BitmapReadAccess::ImplZeroInitUnusedBits()
default:
{
- DBG_ERROR( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format");
+ OSL_FAIL( "BitmapWriteAccess::ZeroInitUnusedBits: Unsupported pixel format");
nBits = 0;
bMsb = true;
}
@@ -448,3 +449,5 @@ void BitmapWriteAccess::CopyBuffer( const BitmapReadAccess& rReadAcc )
for( long nY = 0L, nHeight = Min( mpBuffer->mnHeight, rReadAcc.Height() ); nY < nHeight; nY++ )
CopyScanline( nY, rReadAcc );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index ae0eade2381b..718bd56cdb0c 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -329,3 +330,5 @@ IMPL_FORMAT_SETPIXEL( _32BIT_TC_MASK )
{
rMask.SetColorFor32Bit( rBitmapColor, pScanline + ( nX << 2UL ) );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx
index fc3e031f260e..39d57a05cb84 100644
--- a/vcl/source/gdi/bmpacc3.cxx
+++ b/vcl/source/gdi/bmpacc3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -411,3 +412,5 @@ void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
}
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx
index 789c8377318d..886055817312 100644
--- a/vcl/source/gdi/bmpconv.cxx
+++ b/vcl/source/gdi/bmpconv.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,7 @@
#include "vcl/bitmap.hxx"
#include "vcl/svapp.hxx"
#include "vcl/salctype.hxx"
-#include "vos/mutex.hxx"
+#include <osl/mutex.hxx>
#include "tools/stream.hxx"
#include "com/sun/star/script/XInvocation.hpp"
#include "com/sun/star/awt/XBitmap.hpp"
@@ -43,7 +44,8 @@ using namespace com::sun::star::script;
using namespace com::sun::star::beans;
using namespace com::sun::star::reflection;
using namespace com::sun::star::awt;
-using namespace rtl;
+
+using ::rtl::OUString;
namespace vcl {
@@ -118,7 +120,7 @@ Any SAL_CALL BmpConverter::getValue( const OUString& ) throw( UnknownPropertyExc
sal_Bool SAL_CALL BmpConverter::hasMethod( const OUString& rName ) throw()
{
- return rName.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) );
+ return rName.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) );
}
sal_Bool SAL_CALL BmpConverter::hasProperty( const OUString& ) throw()
@@ -135,7 +137,7 @@ Any SAL_CALL BmpConverter::invoke(
{
Any aRet;
- if( rFunction.equalsIgnoreAsciiCase( OUString::createFromAscii( "convert-bitmap-depth" ) ) )
+ if( rFunction.equalsIgnoreAsciiCase( OUString(RTL_CONSTASCII_USTRINGPARAM("convert-bitmap-depth")) ) )
{
Reference< XBitmap > xBM;
sal_uInt16 nTargetDepth = 0;
@@ -149,7 +151,7 @@ Any SAL_CALL BmpConverter::invoke(
Sequence< sal_Int8 > aDIB = xBM->getDIB();
// call into vcl not thread safe
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
SvMemoryStream aStream( aDIB.getArray(), aDIB.getLength(), STREAM_READ | STREAM_WRITE );
Bitmap aBM;
@@ -211,3 +213,5 @@ Sequence< sal_Int8 > SAL_CALL BmpTransporter::getMaskDIB() throw()
{
return Sequence< sal_Int8 >();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx
index a3b729e69244..e410e0ee25e8 100644
--- a/vcl/source/gdi/bmpfast.cxx
+++ b/vcl/source/gdi/bmpfast.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -251,63 +252,6 @@ class TrueColorPixelPtr<BMP_FORMAT_8BIT_PAL>
: public TrueColorPixelPtr<BMP_FORMAT_8BIT_TC_MASK>
{};
-#if 0
-template <>
-class TrueColorPixelPtr<BMP_FORMAT_24BIT_TC_MASK> : public BasePixelPtr
-{
-public:
- void operator++() { mpPixel += 3; }
-
- unsigned GetAlpha() const
- {
- unsigned nAlpha = mpPixel[0];
- nAlpha |= mpPixel[1] << 8U;
- nAlpha |= mpPixel[2] << 16U;
- return nAlpha;
- }
-
- void SetAlpha( unsigned nAlpha ) const
- {
- mpPixel[0] = nAlpha;
- mpPixel[1] = nAlpha >> 8U;
- mpPixel[2] = nAlpha >> 16U;
- }
-};
-
-template <>
-class TrueColorPixelPtr<BMP_FORMAT_32BIT_TC_MASK> : public BasePixelPtr
-{
-public:
- void operator++() { mpPixel += 4; }
-
- unsigned GetAlpha() const
- {
-#ifdef OSL_BIGENDIAN
- unsigned nAlpha = *reinterpret_cast<unsigned*>( mpPixel );
-#else
- unsigned nAlpha = mpPixel[0];
- nAlpha |= mpPixel[1] << 8U;
- nAlpha |= mpPixel[2] << 16U;
- nAlpha |= mpPixel[3] << 24U;
-#endif
- return nAlpha;
- }
-
- void SetAlpha( unsigned nAlpha ) const
- {
-#ifdef OSL_BIGENDIAN
- *reinterpret_cast<unsigned*>( mpPixel ) = nAlpha;
-#else
- mpPixel[0] = nAlpha;
- mpPixel[1] = nAlpha >> 8U;
- mpPixel[2] = nAlpha >> 16U;
- mpPixel[3] = nAlpha >> 24U;
-#endif
- }
-};
-
-#endif
-
// =======================================================================
// converting truecolor formats
@@ -1038,3 +982,5 @@ bool ImplFastEraseBitmap( BitmapBuffer&, const BitmapColor& )
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx
index ce39c70e243f..1ddc801c8329 100644
--- a/vcl/source/gdi/configsettings.cxx
+++ b/vcl/source/gdi/configsettings.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,7 +37,6 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
-using namespace rtl;
using namespace utl;
using namespace vcl;
using namespace com::sun::star::uno;
@@ -44,6 +44,8 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
+using ::rtl::OUString;
+
#define SETTINGS_CONFIGNODE "VCL/Settings"
/*
@@ -90,7 +92,7 @@ void SettingsConfigItem::Commit()
if( ! IsValidConfigMgr() )
return;
- std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group;
+ boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group;
for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group )
{
@@ -135,12 +137,11 @@ void SettingsConfigItem::getValues()
m_aSettings.clear();
Sequence< OUString > aNames( GetNodeNames( OUString() ) );
- m_aSettings.resize( aNames.getLength() );
for( int j = 0; j < aNames.getLength(); j++ )
{
#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, "found settings data for \"%s\"\n",
+ OSL_TRACE( "found settings data for \"%s\"\n",
OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr()
);
#endif
@@ -166,7 +167,7 @@ void SettingsConfigItem::getValues()
if( pLine->getLength() )
m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine;
#if OSL_DEBUG_LEVEL > 2
- fprintf( stderr, " \"%s\"=\"%.30s\"\n",
+ OSL_TRACE( " \"%s\"=\"%.30s\"\n",
OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(),
OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr()
);
@@ -182,7 +183,7 @@ void SettingsConfigItem::getValues()
const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const
{
- ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup );
+ ::boost::unordered_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup );
if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() )
{
static OUString aEmpty;
@@ -205,3 +206,4 @@ void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey,
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/cvtgrf.cxx b/vcl/source/gdi/cvtgrf.cxx
index 61a08df4ddc0..6d3b60777120 100644
--- a/vcl/source/gdi/cvtgrf.cxx
+++ b/vcl/source/gdi/cvtgrf.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -171,3 +172,5 @@ sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sa
return nRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 7a6dd74db2c5..2d9fbef36e44 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -942,7 +943,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
}
#ifdef DBG_UTIL
else
- DBG_ERROR("More than one DX array element missing on SVM import");
+ OSL_FAIL("More than one DX array element missing on SVM import");
#endif
}
}
@@ -1379,7 +1380,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
{
- sal_uLong nPos;
sal_uLong nCountPos;
Font aSaveFont;
const sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt();
@@ -1394,7 +1394,6 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf )
//MagicCode schreiben
rOStm << "SVGDI"; // Kennung
- nPos = rOStm.Tell();
rOStm << (sal_Int16) 42; // HeaderSize
rOStm << (sal_Int16) 200; // VERSION
rOStm << (sal_Int32) aPrefSize.Width();
@@ -2363,11 +2362,6 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
}
break;
-#if 0
- case( META_OVERLINECOLOR_ACTION ):
- break;
-#endif
-
case( META_TEXTLINE_ACTION ):
{
const MetaTextLineAction* pA = (MetaTextLineAction*) pAction;
@@ -2440,7 +2434,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
ByteString aStr( "Missing implementation for Action#: " );
aStr += ByteString::CreateFromInt32( pAction->GetType() );
aStr += '!';
- DBG_ERROR( aStr.GetBuffer() );
+ OSL_FAIL( aStr.GetBuffer() );
}
break;
#endif
@@ -2514,3 +2508,5 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
return nCount;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/extoutdevdata.cxx b/vcl/source/gdi/extoutdevdata.cxx
index eebd6b35765b..2b8ad0fb9ae6 100644
--- a/vcl/source/gdi/extoutdevdata.cxx
+++ b/vcl/source/gdi/extoutdevdata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,3 +40,5 @@ ExtOutDevData::~ExtOutDevData()
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 4f1aad4d36cb..9102f693c025 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,6 +41,7 @@
#include "outfont.hxx"
#include "sft.hxx"
+#include <sal/macros.h>
#include <algorithm>
@@ -1032,7 +1034,7 @@ namespace
aEnt.string = pOpen+1;
aEnt.string_len = (pClose-pOpen)-1;
aEnt.weight = WEIGHT_NORMAL;
- const int nEnt = sizeof( weight_table ) / sizeof( weight_table[0] );
+ const int nEnt = SAL_N_ELEMENTS( weight_table );
WeightSearchEntry* pFound = std::lower_bound( weight_table, weight_table+nEnt, aEnt );
if( pFound != (weight_table+nEnt) )
o_rResult.SetWeight( pFound->weight );
@@ -1113,3 +1115,5 @@ FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; }
FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; }
sal_Bool Font::IsWordLineMode() const { return mpImplFont->mbWordLine; }
sal_Bool Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 1e99c5c3c04f..ed15dfae81a2 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <vos/macros.hxx>
#include <rtl/crc.h>
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
@@ -35,12 +35,28 @@
#include <vcl/salbtype.hxx>
#include <vcl/outdev.hxx>
#include <vcl/window.hxx>
-#ifndef _SV_CVTSVM_HXX
#include <vcl/cvtsvm.hxx>
-#endif
#include <vcl/virdev.hxx>
+#include <vcl/salbmp.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/svdata.hxx>
+#include <vcl/salinst.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/graphictools.hxx>
+#include <vcl/canvastools.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/MtfRenderer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/XGraphicRenderer.hpp>
+
+using namespace com::sun::star;
// -----------
// - Defines -
@@ -200,7 +216,8 @@ GDIMetaFile::GDIMetaFile() :
pOutDev ( NULL ),
pLabelList ( NULL ),
bPause ( sal_False ),
- bRecord ( sal_False )
+ bRecord ( sal_False ),
+ bUseCanvas ( sal_False )
{
}
@@ -215,7 +232,8 @@ GDIMetaFile::GDIMetaFile( const GDIMetaFile& rMtf ) :
pNext ( rMtf.pNext ),
pOutDev ( NULL ),
bPause ( sal_False ),
- bRecord ( sal_False )
+ bRecord ( sal_False ),
+ bUseCanvas ( rMtf.bUseCanvas )
{
// RefCount der MetaActions erhoehen
for( void* pAct = First(); pAct; pAct = Next() )
@@ -269,6 +287,7 @@ GDIMetaFile& GDIMetaFile::operator=( const GDIMetaFile& rMtf )
pOutDev = NULL;
bPause = sal_False;
bRecord = sal_False;
+ bUseCanvas = rMtf.bUseCanvas;
if( rMtf.bRecord )
{
@@ -418,6 +437,8 @@ void GDIMetaFile::Play( GDIMetaFile& rMtf, sal_uLong nPos )
MetaAction* pAction = GetCurAction();
const sal_uLong nObjCount = Count();
+ rMtf.UseCanvas( rMtf.GetUseCanvas() || bUseCanvas );
+
if( nPos > nObjCount )
nPos = nObjCount;
@@ -459,7 +480,16 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos )
{
if( !Hook() )
{
- pAction->Execute( pOut );
+ MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction);
+ if( pAction->GetType() == META_COMMENT_ACTION &&
+ pCommentAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") )
+ {
+ ImplDelegate2PluggableRenderer(pCommentAct, pOut);
+ }
+ else
+ {
+ pAction->Execute( pOut );
+ }
// flush output from time to time
if( i++ > nSyncCount )
@@ -475,6 +505,154 @@ void GDIMetaFile::Play( OutputDevice* pOut, sal_uLong nPos )
// ------------------------------------------------------------------------
+bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize )
+{
+ const Window* win = dynamic_cast <Window*> ( pOut );
+
+ if (!win)
+ win = Application::GetActiveTopWindow();
+ if (!win)
+ win = Application::GetFirstTopLevelWindow();
+
+ if (!win)
+ return false;
+
+ try {
+ const uno::Reference<rendering::XCanvas>& xCanvas = win->GetCanvas ();
+ Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1);
+ const uno::Reference<rendering::XBitmap>& xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize));
+ uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
+ if( xFactory.is() && xBitmap.is () ) {
+ uno::Reference< rendering::XMtfRenderer > xMtfRenderer;
+ uno::Sequence< uno::Any > args (1);
+ uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap, uno::UNO_QUERY );
+ if( xBitmapCanvas.is() ) {
+ args[0] = uno::Any( xBitmapCanvas );
+ xMtfRenderer.set( xFactory->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.rendering.MtfRenderer")),
+ args ), uno::UNO_QUERY );
+
+ if( xMtfRenderer.is() ) {
+ xBitmapCanvas->clear();
+ uno::Reference< beans::XFastPropertySet > xMtfFastPropertySet( xMtfRenderer, uno::UNO_QUERY );
+ if( xMtfFastPropertySet.is() )
+ // set this metafile to the renderer to
+ // speedup things (instead of copying data to
+ // sequence of bytes passed to renderer)
+ xMtfFastPropertySet->setFastPropertyValue( 0, uno::Any( reinterpret_cast<sal_Int64>( this ) ) );
+
+ xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() );
+
+ uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY );
+ if( xFastPropertySet.get() ) {
+ // 0 means get BitmapEx
+ uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
+ BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
+ if( pBitmapEx ) {
+ pOut->DrawBitmapEx( rPos, *pBitmapEx );
+ delete pBitmapEx;
+ return true;
+ }
+ }
+
+ SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+ SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+
+ if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) ) {
+ Bitmap aBitmap( pSalBmp );
+ Bitmap aMask( pSalMask );
+ AlphaMask aAlphaMask( aMask );
+ BitmapEx aBitmapEx( aBitmap, aAlphaMask );
+ pOut->DrawBitmapEx( rPos, aBitmapEx );
+ return true;
+ }
+
+ delete pSalBmp;
+ delete pSalMask;
+ }
+ }
+ }
+ } catch( uno::RuntimeException& ) {
+ throw; // runtime errors are fatal
+ } catch( uno::Exception& ) {
+ // ignore errors, no way of reporting them here
+ }
+
+ return false;
+}
+
+// ------------------------------------------------------------------------
+
+void GDIMetaFile::ImplDelegate2PluggableRenderer( const MetaCommentAction* pAct, OutputDevice* pOut )
+{
+ OSL_ASSERT( pAct->GetComment().Equals("DELEGATE_PLUGGABLE_RENDERER") );
+
+ // read payload - string of service name, followed by raw render input
+ const sal_uInt8* pData = pAct->GetData();
+ const sal_uInt8* const pEndData = pData + pAct->GetDataSize();
+ if( !pData )
+ return;
+
+ ::rtl::OUStringBuffer aBuffer;
+ while( pData<pEndData && *pData )
+ aBuffer.append(static_cast<sal_Unicode>(*pData++));
+ const ::rtl::OUString aRendererServiceName=aBuffer.makeStringAndClear();
+ ++pData;
+
+ while( pData<pEndData && *pData )
+ aBuffer.append(static_cast<sal_Unicode>(*pData++));
+ const ::rtl::OUString aGraphicServiceName=aBuffer.makeStringAndClear();
+ ++pData;
+
+ uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
+ if( pData<pEndData && xFactory.is() )
+ {
+ try
+ {
+ // instantiate render service
+ uno::Sequence<uno::Any> aRendererArgs(1);
+ aRendererArgs[0] = makeAny(uno::Reference<awt::XGraphics>(pOut->CreateUnoGraphics()));
+ uno::Reference<graphic::XGraphicRenderer> xRenderer(
+ xFactory->createInstanceWithArguments(
+ aRendererServiceName,
+ aRendererArgs),
+ uno::UNO_QUERY );
+
+ // instantiate graphic service
+ uno::Reference<graphic::XGraphic> xGraphic(
+ xFactory->createInstance(
+ aGraphicServiceName),
+ uno::UNO_QUERY );
+
+ uno::Reference<lang::XInitialization> xInit(
+ xGraphic, uno::UNO_QUERY);
+
+ if(xGraphic.is() && xRenderer.is() && xInit.is())
+ {
+ // delay intialization of XGraphic, to only expose
+ // XGraphic-generating services to arbitrary binary data
+ uno::Sequence< sal_Int8 > aSeq(
+ (sal_Int8*)&pData, pEndData-pData );
+ uno::Sequence<uno::Any> aGraphicsArgs(1);
+ aGraphicsArgs[0] = makeAny(aSeq);
+ xInit->initialize(aGraphicsArgs);
+
+ xRenderer->render(xGraphic);
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ // runtime errors are fatal
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ // ignore errors, no way of reporting them here
+ }
+ }
+}
+
+// ------------------------------------------------------------------------
+
void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
const Size& rSize, sal_uLong nPos )
{
@@ -484,9 +662,13 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
if( aDestSize.Width() && aDestSize.Height() )
{
- Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
GDIMetaFile* pMtf = pOut->GetConnectMetaFile();
+ if( bUseCanvas && !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+ return;
+
+ Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
+
if( !aTmpPrefSize.Width() )
aTmpPrefSize.Width() = aDestSize.Width();
@@ -783,12 +965,12 @@ sal_Bool GDIMetaFile::Mirror( sal_uLong nMirrorFlags )
sal_Bool bRet;
if( nMirrorFlags & MTF_MIRROR_HORZ )
- nMoveX = VOS_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0;
+ nMoveX = SAL_ABS( aOldPrefSize.Width() ) - 1, fScaleX = -1.0;
else
nMoveX = 0, fScaleX = 1.0;
if( nMirrorFlags & MTF_MIRROR_VERT )
- nMoveY = VOS_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0;
+ nMoveY = SAL_ABS( aOldPrefSize.Height() ) - 1, fScaleY = -1.0;
else
nMoveY = 0, fScaleY = 1.0;
@@ -1445,7 +1627,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
case( META_TEXTRECT_ACTION ):
case( META_MOVECLIPREGION_ACTION ):
{
- DBG_ERROR( "GDIMetaFile::Rotate(): unsupported action" );
+ OSL_FAIL( "GDIMetaFile::Rotate(): unsupported action" );
}
break;
@@ -2166,7 +2348,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol
case( META_BMPEX_ACTION ):
case( META_MASK_ACTION ):
{
- DBG_ERROR( "Don't use bitmap actions of this type in metafiles!" );
+ OSL_FAIL( "Don't use bitmap actions of this type in metafiles!" );
}
break;
@@ -3193,3 +3375,53 @@ sal_Bool GDIMetaFile::CreateThumbnail( sal_uInt32 nMaximumExtent,
return !rBmpEx.IsEmpty();
}
+
+void GDIMetaFile::UseCanvas( sal_Bool _bUseCanvas )
+{
+ bUseCanvas = _bUseCanvas;
+}
+
+// ------------------------------------------------------------------------
+
+MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererServiceName,
+ const rtl::OUString& rGraphicServiceName,
+ const void* _pData,
+ sal_uInt32 nDataSize )
+{
+ const sal_uInt8* pData=(sal_uInt8*)_pData;
+
+ // data gets copied twice, unfortunately
+ rtl::OString aRendererServiceName(
+ rRendererServiceName.getStr(),
+ rRendererServiceName.getLength(),
+ RTL_TEXTENCODING_ASCII_US);
+ rtl::OString aGraphicServiceName(
+ rGraphicServiceName.getStr(),
+ rGraphicServiceName.getLength(),
+ RTL_TEXTENCODING_ASCII_US);
+
+ std::vector<sal_uInt8> aMem(
+ aRendererServiceName.getLength()+
+ aGraphicServiceName.getLength()+2+nDataSize);
+ sal_uInt8* pMem=&aMem[0];
+
+ std::copy(aRendererServiceName.getStr(),
+ aRendererServiceName.getStr()+aRendererServiceName.getLength()+1,
+ pMem);
+ pMem+=aRendererServiceName.getLength()+1;
+ std::copy(aGraphicServiceName.getStr(),
+ aGraphicServiceName.getStr()+aGraphicServiceName.getLength()+1,
+ pMem);
+ pMem+=aGraphicServiceName.getLength()+1;
+
+ std::copy(pData,pData+nDataSize,
+ pMem);
+
+ return new MetaCommentAction(
+ "DELEGATE_PLUGGABLE_RENDERER",
+ 0,
+ &aMem[0],
+ aMem.size());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index c9c997b568e2..745c4f765398 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -468,3 +469,5 @@ void ImpSwap::WriteTo( SvStream& rOStm ) const
delete[] pData;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index 9f4f91c38e60..38d8ba4567a2 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -244,6 +245,99 @@ void Gradient::SetSteps( sal_uInt16 nSteps )
// -----------------------------------------------------------------------
+void Gradient::GetBoundRect( const Rectangle& rRect, Rectangle& rBoundRect, Point& rCenter ) const
+{
+ Rectangle aRect( rRect );
+ sal_uInt16 nAngle = GetAngle() % 3600;
+
+ if( GetStyle() == GRADIENT_LINEAR || GetStyle() == GRADIENT_AXIAL )
+ {
+ aRect.Left()--;
+ aRect.Top()--;
+ aRect.Right()++;
+ aRect.Bottom()++;
+
+ const double fAngle = nAngle * F_PI1800;
+ const double fWidth = aRect.GetWidth();
+ const double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) );
+
+ fDX = ( fDX - fWidth ) * 0.5 + 0.5;
+ fDY = ( fDY - fHeight ) * 0.5 + 0.5;
+
+ aRect.Left() -= (long) fDX;
+ aRect.Right() += (long) fDX;
+ aRect.Top() -= (long) fDY;
+ aRect.Bottom() += (long) fDY;
+
+ rBoundRect = aRect;
+ rCenter = rRect.Center();
+ }
+ else
+ {
+
+ if( GetStyle() == GRADIENT_SQUARE || GetStyle() == GRADIENT_RECT )
+ {
+ const double fAngle = nAngle * F_PI1800;
+ const double fWidth = aRect.GetWidth();
+ const double fHeight = aRect.GetHeight();
+ double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) );
+ double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) );
+
+ fDX = ( fDX - fWidth ) * 0.5 + 0.5;
+ fDY = ( fDY - fHeight ) * 0.5 + 0.5;
+
+ aRect.Left() -= (long) fDX;
+ aRect.Right() += (long) fDX;
+ aRect.Top() -= (long) fDY;
+ aRect.Bottom() += (long) fDY;
+ }
+
+ Size aSize( aRect.GetSize() );
+
+ if( GetStyle() == GRADIENT_RADIAL )
+ {
+ // Radien-Berechnung fuer Kreis
+ aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height()));
+ aSize.Height() = aSize.Width();
+ }
+ else if( GetStyle() == GRADIENT_ELLIPTICAL )
+ {
+ // Radien-Berechnung fuer Ellipse
+ aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 );
+ aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 );
+ }
+ else if( GetStyle() == GRADIENT_SQUARE )
+ {
+ if ( aSize.Width() > aSize.Height() )
+ aSize.Height() = aSize.Width();
+ else
+ aSize.Width() = aSize.Height();
+ }
+
+ // neue Mittelpunkte berechnen
+ long nZWidth = aRect.GetWidth() * (long) GetOfsX() / 100;
+ long nZHeight = aRect.GetHeight() * (long) GetOfsY() / 100;
+ long nBorderX = (long) GetBorder() * aSize.Width() / 100;
+ long nBorderY = (long) GetBorder() * aSize.Height() / 100;
+ rCenter = Point( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
+
+ // Rand beruecksichtigen
+ aSize.Width() -= nBorderX;
+ aSize.Height() -= nBorderY;
+
+ // Ausgaberechteck neu setzen
+ aRect.Left() = rCenter.X() - ( aSize.Width() >> 1 );
+ aRect.Top() = rCenter.Y() - ( aSize.Height() >> 1 );
+
+ aRect.SetSize( aSize );
+ rBoundRect = rRect;
+ }
+}
+
+// -----------------------------------------------------------------------
+
Gradient& Gradient::operator=( const Gradient& rGradient )
{
DBG_CHKTHIS( Gradient, NULL );
@@ -342,3 +436,5 @@ SvStream& operator<<( SvStream& rOStm, const Gradient& rGradient )
{
return( rOStm << *rGradient.mpImplGradient );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 65555a441a1a..eb22d31937df 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -844,3 +845,5 @@ SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic )
{
return rOStream << *rGraphic.mpImpGraphic;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx
index 5ef9ed038163..2e20a3639790 100644
--- a/vcl/source/gdi/graphictools.cxx
+++ b/vcl/source/gdi/graphictools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,7 +52,7 @@ static ::rtl::OString polyToString( const Polygon& rPoly )
break;
default:
- DBG_ERROR( "SvtGraphicStroke::polyToString invalid flag");
+ OSL_FAIL( "SvtGraphicStroke::polyToString invalid flag");
break;
}
aStr += ::rtl::OString::valueOf( static_cast< double >( rPoly[nVertex].getX() ) );
@@ -226,7 +227,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing cap type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing cap type");
break;
}
aStr += " join: ";
@@ -249,7 +250,7 @@ void SvtGraphicStroke::getDashArray( DashArray& rDashArray ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing join type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing join type");
break;
}
aStr += " ";
@@ -514,7 +515,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const
break;
default:
- DBG_ERROR( "SvtGraphicFill::toString missing fill rule");
+ OSL_FAIL( "SvtGraphicFill::toString missing fill rule");
break;
}
aStr += " type: ";
@@ -537,7 +538,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing fill type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing fill type");
break;
}
@@ -563,7 +564,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing hatch type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing hatch type");
break;
}
@@ -586,7 +587,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing gradient type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing gradient type");
break;
}
@@ -617,7 +618,7 @@ void SvtGraphicFill::getGraphic( Graphic& rGraphic ) const
break;
default:
- DBG_ERROR( "SvtGraphicStroke::toString missing graphic type");
+ OSL_FAIL( "SvtGraphicStroke::toString missing graphic type");
break;
}
@@ -757,3 +758,5 @@ SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass )
return rIStm;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/hatch.cxx b/vcl/source/gdi/hatch.cxx
index b226c0f06936..9836b2e6e4b4 100644
--- a/vcl/source/gdi/hatch.cxx
+++ b/vcl/source/gdi/hatch.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
#include <tools/debug.hxx>
-#ifndef _SV_HATCX_HXX
#include <vcl/hatch.hxx>
-#endif
DBG_NAME( Hatch )
@@ -220,3 +219,5 @@ SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch )
{
return( rOStm << *rHatch.mpImplHatch );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx
index d33709787d2d..18f927e5b0ff 100644
--- a/vcl/source/gdi/image.cxx
+++ b/vcl/source/gdi/image.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,13 +38,12 @@
#include <tools/rc.h>
#include <tools/rc.hxx>
#include <tools/resmgr.hxx>
-
#include <vcl/settings.hxx>
#include <vcl/outdev.hxx>
#include <vcl/graph.hxx>
#include <vcl/svapp.hxx>
#include <vcl/image.hxx>
-
+#include <vcl/imagerepository.hxx>
#include <impimagetree.hxx>
#include <image.h>
@@ -276,51 +276,6 @@ uno::Reference< graphic::XGraphic > Image::GetXGraphic() const
// -----------------------------------------------------------------------
-Image Image::GetColorTransformedImage( ImageColorTransform eColorTransform ) const
-{
- DBG_CHKTHIS( Image, NULL );
-
- Image aRet;
-
- if( IMAGECOLORTRANSFORM_HIGHCONTRAST == eColorTransform )
- {
- BitmapEx aBmpEx( GetBitmapEx() );
-
- if( !aBmpEx.IsEmpty() )
- {
- Color* pSrcColors = NULL;
- Color* pDstColors = NULL;
- sal_uLong nColorCount = 0;
-
- Image::GetColorTransformArrays( eColorTransform, pSrcColors, pDstColors, nColorCount );
-
- if( nColorCount && pSrcColors && pDstColors )
- {
- aBmpEx.Replace( pSrcColors, pDstColors, nColorCount );
- aRet = Image( aBmpEx );
- }
-
- delete[] pSrcColors;
- delete[] pDstColors;
- }
- }
- else if( IMAGECOLORTRANSFORM_MONOCHROME_BLACK == eColorTransform ||
- IMAGECOLORTRANSFORM_MONOCHROME_WHITE == eColorTransform )
- {
- BitmapEx aBmpEx( GetBitmapEx() );
-
- if( !aBmpEx.IsEmpty() )
- aRet = Image( aBmpEx.GetColorTransformedBitmapEx( ( BmpColorMode )( eColorTransform ) ) );
- }
-
- if( !aRet )
- aRet = *this;
-
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
void Image::Invert()
{
BitmapEx aInvertedBmp( GetBitmapEx() );
@@ -492,8 +447,6 @@ ImageList::ImageList( const ::std::vector< ::rtl::OUString >& rNameVector,
mpImplData->maPrefix = rPrefix;
for( sal_uInt32 i = 0; i < rNameVector.size(); ++i )
{
-// fprintf (stderr, "List %p [%d]: '%s'\n",
-// this, i, rtl::OUStringToOString( rNameVector[i], RTL_TEXTENCODING_UTF8 ).getStr() );
mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() );
}
}
@@ -539,9 +492,6 @@ void ImageAryData::Load(const rtl::OUString &rPrefix)
BitmapEx aBmpEx;
-// fprintf (stderr, "Attempt load of '%s'\n",
-// rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
rtl::OUString aFileName = rPrefix;
aFileName += maName;
#if OSL_DEBUG_LEVEL > 0
@@ -555,7 +505,7 @@ void ImageAryData::Load(const rtl::OUString &rPrefix)
aMessage.append( "ImageAryData::Load: failed to load image '" );
aMessage.append( ::rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ).getStr() );
aMessage.append( "'" );
- OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() );
+ OSL_FAIL( aMessage.makeStringAndClear().getStr() );
}
#endif
}
@@ -618,8 +568,6 @@ void ImageList::InsertFromHorizontalStrip( const BitmapEx &rBitmapEx,
{
sal_uInt16 nItems = sal::static_int_cast< sal_uInt16 >( rNameVector.size() );
-// fprintf (stderr, "InsertFromHorizontalStrip (1) [%d items]\n", nItems);
-
if (!nItems)
return;
@@ -791,15 +739,13 @@ Image ImageList::GetImage( sal_uInt16 nId ) const
{
DBG_CHKTHIS( ImageList, NULL );
-// fprintf (stderr, "GetImage %d\n", nId);
-
Image aRet;
if( mpImplData )
{
std::vector<ImageAryData *>::iterator aIter;
for( aIter = mpImplData->maImages.begin();
- aIter != mpImplData->maImages.end(); aIter++)
+ aIter != mpImplData->maImages.end(); ++aIter)
{
if ((*aIter)->mnId == nId)
{
@@ -811,6 +757,14 @@ Image ImageList::GetImage( sal_uInt16 nId ) const
}
}
+ if (!aRet)
+ {
+ BitmapEx rBitmap;
+ bool res = ::vcl::ImageRepository::loadDefaultImage(rBitmap);
+ if (res)
+ aRet = Image(rBitmap);
+ }
+
return aRet;
}
@@ -818,9 +772,6 @@ Image ImageList::GetImage( sal_uInt16 nId ) const
Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const
{
-// fprintf (stderr, "GetImage '%s'\n",
-// rtl::OUStringToOString( rImageName, RTL_TEXTENCODING_UTF8 ).getStr() );
-
if( mpImplData )
{
ImageAryData *pImg = mpImplData->maNameHash[ rImageName ];
@@ -832,7 +783,6 @@ Image ImageList::GetImage( const ::rtl::OUString& rImageName ) const
return Image( pImg->maBitmapEx );
}
}
-// fprintf (stderr, "no such image\n");
return Image();
}
@@ -981,9 +931,6 @@ Size ImageList::GetImageSize() const
aRet = mpImplData->maImageSize = aTmp.GetSizePixel();
}
}
-// fprintf (stderr, "GetImageSize returns %d, %d\n",
-// aRet.Width(), aRet.Height());
-
return aRet;
}
@@ -1024,3 +971,5 @@ sal_Bool ImageList::operator==( const ImageList& rImageList ) const
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/imagerepository.cxx b/vcl/source/gdi/imagerepository.cxx
index 0118acc13146..6fda85735b01 100644
--- a/vcl/source/gdi/imagerepository.cxx
+++ b/vcl/source/gdi/imagerepository.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,7 +32,6 @@
#include <vcl/bitmapex.hxx>
#include <vcl/imagerepository.hxx>
#include <vcl/svapp.hxx>
-
#include "impimagetree.hxx"
//........................................................................
@@ -43,15 +43,23 @@ namespace vcl
//= ImageRepository
//====================================================================
//--------------------------------------------------------------------
- bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent )
+ bool ImageRepository::loadImage( const ::rtl::OUString& _rName, BitmapEx& _out_rImage, bool _bSearchLanguageDependent, bool loadMissing )
{
::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
ImplImageTreeSingletonRef aImplImageTree;
- return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent );
+ return aImplImageTree->loadImage( _rName, sCurrentSymbolsStyle, _out_rImage, _bSearchLanguageDependent, loadMissing );
+ }
+
+ bool ImageRepository::loadDefaultImage( BitmapEx& _out_rImage)
+ {
+ ::rtl::OUString sCurrentSymbolsStyle = Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName();
+ ImplImageTreeSingletonRef aImplImageTree;
+ return aImplImageTree->loadDefaultImage( sCurrentSymbolsStyle,_out_rImage);
}
//........................................................................
} // namespace vcl
//........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
index aaaca451ebe3..59ee15fa558a 100644
--- a/vcl/source/gdi/impanmvw.cxx
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -353,3 +354,5 @@ AInfo* ImplAnimView::ImplCreateAInfo() const
return pAInfo;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx
index 69ae35fe1c6e..4e96ecbd9b64 100644
--- a/vcl/source/gdi/impanmvw.hxx
+++ b/vcl/source/gdi/impanmvw.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -94,3 +95,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index f8d71112d3a1..579515f67e9c 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -131,3 +132,5 @@ void ImpBitmap::ImplReleaseBuffer( BitmapBuffer* pBuffer, sal_Bool bReadOnly )
if( !bReadOnly )
mnChecksum = 0;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 62b1976015ce..84e962bd2f6e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,7 +38,6 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/tempfile.hxx>
-
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/gfxlink.hxx>
@@ -392,7 +392,7 @@ void ImpGraphic::ImplClear()
::ucbhelper::Content aCnt( mpSwapFile->aSwapURL.GetMainURL( INetURLObject::NO_DECODE ),
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
- aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
}
catch( const ::com::sun::star::ucb::ContentCreationException& )
@@ -1127,7 +1127,7 @@ sal_Bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm, sal_Bool bSwap )
::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
- aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
}
catch( const ::com::sun::star::ucb::ContentCreationException& )
@@ -1311,7 +1311,7 @@ sal_Bool ImpGraphic::ImplSwapOut()
::ucbhelper::Content aCnt( aTmpURL.GetMainURL( INetURLObject::NO_DECODE ),
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
- aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
}
catch( const ::com::sun::star::ucb::ContentCreationException& )
@@ -1413,7 +1413,7 @@ sal_Bool ImpGraphic::ImplSwapIn()
::ucbhelper::Content aCnt( aSwapURL,
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
- aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ),
+ aCnt.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),
::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) );
}
catch( const ::com::sun::star::ucb::ContentCreationException& )
@@ -1732,3 +1732,5 @@ SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic )
return rOStm;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
index 735f912f0782..2246058fb10f 100644
--- a/vcl/source/gdi/impimage.cxx
+++ b/vcl/source/gdi/impimage.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -348,15 +349,6 @@ void ImplImageBmp::ReplaceColors( const Color* pSrcColors, const Color* pDstColo
// -----------------------------------------------------------------------
-void ImplImageBmp::ColorTransform( BmpColorMode eColorMode )
-{
- maBmpEx = maBmpEx.GetColorTransformedBitmapEx( eColorMode );
- delete mpDisplayBmp;
- mpDisplayBmp = NULL;
-}
-
-// -----------------------------------------------------------------------
-
BitmapEx ImplImageBmp::GetBitmapEx( sal_uInt16 nPosCount, sal_uInt16* pPosAry ) const
{
const Bitmap aNewBmp( Size( nPosCount * maSize.Width(), maSize.Height() ), maBmpEx.GetBitmap().GetBitCount() );
@@ -406,7 +398,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
else
{
if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM |
- IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE |
IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE | IMAGE_DRAW_SEMITRANSPARENT ) )
{
BitmapEx aTmpBmpEx;
@@ -419,14 +410,6 @@ void ImplImageBmp::Draw( sal_uInt16 nPos, OutputDevice* pOutDev,
aTmpBmpEx.Crop( aCropRect );
- if( nStyle & ( IMAGE_DRAW_COLORTRANSFORM | IMAGE_DRAW_MONOCHROME_BLACK | IMAGE_DRAW_MONOCHROME_WHITE ) )
- {
- const BmpColorMode eMode = ( nStyle & IMAGE_DRAW_COLORTRANSFORM ) ? BMP_COLOR_HIGHCONTRAST :
- ( ( nStyle & IMAGE_DRAW_MONOCHROME_BLACK ) ? BMP_COLOR_MONOCHROME_BLACK : BMP_COLOR_MONOCHROME_WHITE );
-
- aTmpBmpEx = aTmpBmpEx.GetColorTransformedBitmapEx( eMode );
- }
-
Bitmap aTmpBmp( aTmpBmpEx.GetBitmap() );
if( nStyle & ( IMAGE_DRAW_HIGHLIGHT | IMAGE_DRAW_DEACTIVE ) )
@@ -634,3 +617,5 @@ void ImplImageBmp::ImplUpdateDisabledBmpEx( int nPos )
maDisabledBmpEx = BitmapEx( aGrey, aGreyAlphaMask );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 19947679567c..b43611e34b04 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,7 +34,7 @@
#include <memory>
#include <utility>
#include <vector>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/io/XInputStream.hpp"
@@ -91,8 +92,8 @@ std::auto_ptr< SvStream > wrapStream(
OSL_ASSERT(stream.is());
std::auto_ptr< SvStream > s(new SvMemoryStream);
for (;;) {
- css::uno::Sequence< sal_Int8 > data;
- sal_Int32 const size = 30000;
+ sal_Int32 const size = 2048;
+ css::uno::Sequence< sal_Int8 > data(size);
sal_Int32 n = stream->readBytes(data, size);
s->Write(data.getConstArray(), n);
if (n < size) {
@@ -144,7 +145,7 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style)
// skip brand-specific icon themes; they are incomplete and thus not useful for this check
if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) {
osl::File aZip(aZipURL);
- if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) {
+ if (aZip.open(osl_File_OpenFlag_Read) == ::osl::FileBase::E_None) {
aZip.close();
exists = true;
}
@@ -157,6 +158,41 @@ bool ImplImageTree::checkStyle(rtl::OUString const & style)
bool ImplImageTree::loadImage(
rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
+ bool localized, bool loadMissing )
+{
+ bool found = false;
+ try {
+ found = doLoadImage(name, style, bitmap, localized);
+ } catch (css::uno::RuntimeException &) {
+ if (!loadMissing)
+ throw;
+ }
+ if (found || !loadMissing)
+ return found;
+
+ try {
+ OSL_TRACE(
+ "ImplImageTree::loadImage exception couldn't load \"%s\", fetching missing_icon.png",
+ rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr());
+ found = loadDefaultImage(style, bitmap);
+ } catch (css::uno::RuntimeException &) {
+ throw;
+ }
+ return found;
+}
+
+bool ImplImageTree::loadDefaultImage(
+ rtl::OUString const & style,
+ BitmapEx& bitmap)
+{
+ return doLoadImage(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("res/grafikde.png")),
+ style, bitmap, false);
+}
+
+
+bool ImplImageTree::doLoadImage(
+ rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap,
bool localized)
{
setStyle(style);
@@ -279,7 +315,7 @@ void ImplImageTree::resetZips() {
u.GetMainURL(INetURLObject::NO_DECODE),
css::uno::Reference< css::container::XNameAccess >()));
}
- if ( m_style.equals(::rtl::OUString::createFromAscii("default")) )
+ if ( m_style.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"))) )
{
rtl::OUString url(
RTL_CONSTASCII_USTRINGPARAM(
@@ -357,3 +393,5 @@ bool ImplImageTree::find(
}
return false;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index f405c3e4b602..21c0cbb0abd4 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,9 +37,7 @@
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/virdev.hxx>
-#ifndef _SV_VECTORIZ_HXX
#include <impvect.hxx>
-#endif
// -----------
// - Defines -
@@ -364,7 +363,7 @@ public:
inline void ImplAdd( sal_uInt8 nCode );
void ImplEndAdd( sal_uLong nTypeFlag );
- const Polygon& ImplGetPoly() { return maPoly; }
+ const Polygon& ImplGetPoly() const { return maPoly; }
};
// -----------------------------------------------------------------------------
@@ -1202,3 +1201,5 @@ sal_Bool ImplVectorizer::ImplIsUp( ImplVectMap* pMap, long nY, long nX ) const
else
return sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/impvect.hxx b/vcl/source/gdi/impvect.hxx
index 86fef6a04083..56591e969b8b 100644
--- a/vcl/source/gdi/impvect.hxx
+++ b/vcl/source/gdi/impvect.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ public:
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index b44a99b2789d..d06e16dcf0cb 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <tools/debug.hxx>
#include <tools/stream.hxx>
-
#include <rtl/alloc.h>
-
#include <vcl/jobset.hxx>
#include <jobset.h>
@@ -215,7 +214,7 @@ String JobSetup::GetValue( const String& rKey ) const
{
if( mpData )
{
- ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
+ ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
it = mpData->maValueMap.find( rKey );
return it != mpData->maValueMap.end() ? String( it->second ) : String();
}
@@ -298,8 +297,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
{
DBG_ASSERTWARNING( rIStream.GetVersion(), "JobSetup::>> - Solar-Version not set on rOStream" );
- // Zur Zeit haben wir noch kein neues FileFormat
-// if ( rIStream.GetVersion() < JOBSET_FILEFORMAT2 )
{
sal_Size nFirstPos = rIStream.Tell();
@@ -383,11 +380,6 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup )
}
delete[] pTempBuf;
}
-/*
- else
- {
- }
-*/
return rIStream;
}
@@ -433,7 +425,7 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
rOStream.Write( (char*)&aOldData, sizeof( aOldData ) );
rOStream.Write( (char*)&aOldJobData, nOldJobDataSize );
rOStream.Write( (char*)pJobData->mpDriverData, pJobData->mnDriverDataLen );
- ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
+ ::boost::unordered_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash >::const_iterator it;
for( it = pJobData->maValueMap.begin(); it != pJobData->maValueMap.end(); ++it )
{
rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 );
@@ -461,3 +453,5 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
return rOStream;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index ebd55a48f593..542c3103eb27 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -367,3 +368,5 @@ void LineInfo::applyToB2DPolyPolygon(
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index ec664cf648a6..e124dc343eba 100755
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -43,81 +43,84 @@ CDEFS+=-D_STD_NO_NAMESPACE -D_VOS_NO_NAMESPACE -D_UNO_NO_NAMESPACE
.ENDIF
.IF "$(ENABLE_GRAPHITE)" == "TRUE"
CDEFS+=-DENABLE_GRAPHITE
+.IF "$(SYSTEM_GRAPHITE)" != "YES"
+CDEFS+=-DGR2_STATIC
+.ENDIF
.ENDIF
# --- Files --------------------------------------------------------
EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
- $(SLO)$/outdev.obj \
- $(SLO)$/outdev3.obj \
- $(SLO)$/outdevnative.obj \
- $(SLO)$/gfxlink.obj \
- $(SLO)$/print.obj \
- $(SLO)$/print2.obj \
- $(SLO)$/print3.obj \
- $(SLO)$/oldprintadaptor.obj \
- $(SLO)$/configsettings.obj \
- $(SLO)$/sallayout.obj \
- $(SLO)$/image.obj \
- $(SLO)$/impimage.obj \
- $(SLO)$/impgraph.obj \
- $(SLO)$/metric.obj \
- $(SLO)$/pdfwriter_impl.obj \
- $(SLO)$/pdfwriter_impl2.obj \
- $(SLO)$/pdffontcache.obj \
- $(SLO)$/bmpconv.obj \
- $(SLO)$/pdfextoutdevdata.obj \
- $(SLO)$/jobset.obj \
- $(SLO)$/impimagetree.obj \
- $(SLO)$/pngread.obj \
- $(SLO)$/pngwrite.obj \
- $(SLO)$/virdev.obj \
- $(SLO)$/gdimtf.obj \
- $(SLO)$/graphictools.obj \
- $(SLO)$/textlayout.obj \
- $(SLO)$/lineinfo.obj \
- $(SLO)$/svgread.obj \
- $(SLO)$/rendergraphic.obj \
- $(SLO)$/rendergraphicrasterizer.obj
+ $(SLO)$/animate.obj \
+ $(SLO)$/base14.obj \
+ $(SLO)$/bitmap.obj \
+ $(SLO)$/bitmap2.obj \
+ $(SLO)$/bitmapex.obj \
+ $(SLO)$/bmpconv.obj \
+ $(SLO)$/configsettings.obj \
+ $(SLO)$/cvtgrf.obj \
+ $(SLO)$/cvtsvm.obj \
+ $(SLO)$/gdimtf.obj \
+ $(SLO)$/gfxlink.obj \
+ $(SLO)$/graph.obj \
+ $(SLO)$/graphictools.obj \
+ $(SLO)$/image.obj \
+ $(SLO)$/imagerepository.obj \
+ $(SLO)$/impanmvw.obj \
+ $(SLO)$/impgraph.obj \
+ $(SLO)$/impimage.obj \
+ $(SLO)$/impimagetree.obj \
+ $(SLO)$/impvect.obj \
+ $(SLO)$/jobset.obj \
+ $(SLO)$/lineinfo.obj \
+ $(SLO)$/metaact.obj \
+ $(SLO)$/metric.obj \
+ $(SLO)$/oldprintadaptor.obj \
+ $(SLO)$/outdev.obj \
+ $(SLO)$/outdev2.obj \
+ $(SLO)$/outdev3.obj \
+ $(SLO)$/outdev4.obj \
+ $(SLO)$/outdev5.obj \
+ $(SLO)$/outdev6.obj \
+ $(SLO)$/outdevnative.obj \
+ $(SLO)$/outmap.obj \
+ $(SLO)$/pdfextoutdevdata.obj \
+ $(SLO)$/pdffontcache.obj\
+ $(SLO)$/pdfwriter.obj \
+ $(SLO)$/pdfwriter_impl.obj \
+ $(SLO)$/pdfwriter_impl2.obj \
+ $(SLO)$/pngread.obj \
+ $(SLO)$/pngwrite.obj \
+ $(SLO)$/print.obj \
+ $(SLO)$/print2.obj \
+ $(SLO)$/print3.obj \
+ $(SLO)$/rendergraphic.obj \
+ $(SLO)$/rendergraphicrasterizer.obj \
+ $(SLO)$/salgdilayout.obj \
+ $(SLO)$/sallayout.obj \
+ $(SLO)$/salnativewidgets-none.obj \
+ $(SLO)$/svgread.obj \
+ $(SLO)$/textlayout.obj \
+ $(SLO)$/virdev.obj \
+ $(SLO)$/wall.obj
SLOFILES= $(EXCEPTIONSFILES) \
- $(SLO)$/animate.obj \
- $(SLO)$/impanmvw.obj \
- $(SLO)$/bitmap.obj \
- $(SLO)$/bitmap2.obj \
$(SLO)$/bitmap3.obj \
$(SLO)$/bitmap4.obj \
$(SLO)$/alpha.obj \
- $(SLO)$/bitmapex.obj \
$(SLO)$/bmpacc.obj \
$(SLO)$/bmpacc2.obj \
$(SLO)$/bmpacc3.obj \
$(SLO)$/bmpfast.obj \
- $(SLO)$/cvtsvm.obj \
- $(SLO)$/cvtgrf.obj \
$(SLO)$/font.obj \
$(SLO)$/gradient.obj \
$(SLO)$/hatch.obj \
- $(SLO)$/graph.obj \
$(SLO)$/impbmp.obj \
- $(SLO)$/imagerepository.obj \
- $(SLO)$/impvect.obj \
$(SLO)$/mapmod.obj \
- $(SLO)$/metaact.obj \
$(SLO)$/octree.obj \
- $(SLO)$/outmap.obj \
- $(SLO)$/outdev2.obj \
- $(SLO)$/outdev4.obj \
- $(SLO)$/outdev5.obj \
- $(SLO)$/outdev6.obj \
$(SLO)$/regband.obj \
$(SLO)$/region.obj \
- $(SLO)$/wall.obj \
- $(SLO)$/base14.obj \
- $(SLO)$/pdfwriter.obj \
- $(SLO)$/salgdilayout.obj \
- $(SLO)$/extoutdevdata.obj \
- $(SLO)$/salnativewidgets-none.obj
+ $(SLO)$/extoutdevdata.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx
index 5eff28d559a7..ae7b13ca25b7 100644
--- a/vcl/source/gdi/mapmod.cxx
+++ b/vcl/source/gdi/mapmod.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -309,3 +310,5 @@ SvStream& operator<<( SvStream& rOStm, const MapMode& rMapMode )
{
return (rOStm << *rMapMode.mpImplMapMode);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index ad0c9c9d5f95..2ffa3c68e4f7 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4121,6 +4122,7 @@ void MetaCommentAction::Move( long nXMove, long nYMove )
// SJ: 25.07.06 #i56656# we are not able to mirrorcertain kind of
// comments properly, especially the XPATHSTROKE and XPATHFILL lead to
// problems, so it is better to remove these comments when mirroring
+// FIXME: fake comment to apply the next hunk in the right location
void MetaCommentAction::Scale( double fXScale, double fYScale )
{
if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
@@ -4154,6 +4156,32 @@ void MetaCommentAction::Scale( double fXScale, double fYScale )
}
delete[] mpData;
ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
+ } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) {
+ SvMemoryStream aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
+ SvMemoryStream aDest;
+
+ sal_Int32 nLeft, nRight, nTop, nBottom;
+ sal_Int32 nPixX, nPixY, nMillX, nMillY;
+ float m11, m12, m21, m22, mdx, mdy;
+
+ // read data
+ aMemStm >> nLeft >> nTop >> nRight >> nBottom;
+ aMemStm >> nPixX >> nPixY >> nMillX >> nMillY;
+ aMemStm >> m11 >> m12 >> m21 >> m22 >> mdx >> mdy;
+
+ // add scale to the transformation
+ m11 *= fXScale;
+ m12 *= fXScale;
+ m22 *= fYScale;
+ m21 *= fYScale;
+
+ // prepare new data
+ aDest << nLeft << nTop << nRight << nBottom;
+ aDest << nPixX << nPixY << nMillX << nMillY;
+ aDest << m11 << m12 << m21 << m22 << mdx << mdy;
+
+ // save them
+ ImplInitDynamicData( static_cast<const sal_uInt8*>( aDest.GetData() ), aDest.Tell() );
}
}
}
@@ -4380,3 +4408,5 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* )
COMPAT( rIStm );
rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index b05ae27a8f5f..e8a8a2cb3a63 100644
--- a/vcl/source/gdi/metric.cxx
+++ b/vcl/source/gdi/metric.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -685,15 +686,8 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
sal_uInt32 cMaxChar = GetUInt( pGroup + 4 );
int nGlyphId = GetUInt( pGroup + 8 );
pGroup += 12;
-#if 0 // TODO: remove unicode baseplane clipping for UCS-4 support
- if( cMinChar > 0xFFFF )
- continue;
- if( cMaxChar > 0xFFFF )
- cMaxChar = 0xFFFF;
-#else
if( cMinChar > cMaxChar ) // no sane font should trigger this
break;
-#endif
*(pCP++) = cMinChar;
*(pCP++) = cMaxChar + 1;
pStartGlyphs[i] = nGlyphId;
@@ -932,3 +926,4 @@ sal_uInt32 FontCharMap::GetCharFromIndex( int nIndex ) const
// =======================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index be69d34bff7e..56c46f421695 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -370,3 +371,5 @@ void InverseColorMap::ImplCreateBuffers( const sal_uLong nMax )
pBuffer = (sal_uInt8*) rtl_allocateMemory( nSize );
memset( pBuffer, 0xff, nSize );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx
index ce3ece7e1e5b..4d87c06471ee 100644
--- a/vcl/source/gdi/oldprintadaptor.cxx
+++ b/vcl/source/gdi/oldprintadaptor.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -115,3 +116,4 @@ void OldStylePrintAdaptor::printPage( int i_nPage ) const
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index dcad34c363ad..6bbaec8e43f5 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1049,7 +1050,7 @@ void OutputDevice::ImplSetClipRegion( const Region* pRegion )
void OutputDevice::SetClipRegion()
{
- DBG_TRACE( "OutputDevice::SetClipRegion()" );
+ OSL_TRACE( "OutputDevice::SetClipRegion()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1065,7 +1066,7 @@ void OutputDevice::SetClipRegion()
void OutputDevice::SetClipRegion( const Region& rRegion )
{
- DBG_TRACE( "OutputDevice::SetClipRegion( rRegion )" );
+ OSL_TRACE( "OutputDevice::SetClipRegion( rRegion )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
@@ -1120,7 +1121,7 @@ Region OutputDevice::GetActiveClipRegion() const
void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove )
{
- DBG_TRACE( "OutputDevice::MoveClipRegion()" );
+ OSL_TRACE( "OutputDevice::MoveClipRegion()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mbClipRegion )
@@ -1141,7 +1142,7 @@ void OutputDevice::MoveClipRegion( long nHorzMove, long nVertMove )
void OutputDevice::IntersectClipRegion( const Rectangle& rRect )
{
- DBG_TRACE( "OutputDevice::IntersectClipRegion( rRect )" );
+ OSL_TRACE( "OutputDevice::IntersectClipRegion( rRect )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1160,7 +1161,7 @@ void OutputDevice::IntersectClipRegion( const Rectangle& rRect )
void OutputDevice::IntersectClipRegion( const Region& rRegion )
{
- DBG_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" );
+ OSL_TRACE( "OutputDevice::IntersectClipRegion( rRegion )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rRegion, Region, ImplDbgTestRegion );
@@ -1185,7 +1186,7 @@ void OutputDevice::IntersectClipRegion( const Region& rRegion )
void OutputDevice::SetDrawMode( sal_uLong nDrawMode )
{
- DBG_TRACE1( "OutputDevice::SetDrawMode( %lx )", nDrawMode );
+ OSL_TRACE( "OutputDevice::SetDrawMode( %lx )", nDrawMode );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
mnDrawMode = nDrawMode;
@@ -1198,7 +1199,7 @@ void OutputDevice::SetDrawMode( sal_uLong nDrawMode )
void OutputDevice::SetRasterOp( RasterOp eRasterOp )
{
- DBG_TRACE1( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp );
+ OSL_TRACE( "OutputDevice::SetRasterOp( %d )", (int)eRasterOp );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1221,7 +1222,7 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp )
void OutputDevice::SetLineColor()
{
- DBG_TRACE( "OutputDevice::SetLineColor()" );
+ OSL_TRACE( "OutputDevice::SetLineColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1242,7 +1243,7 @@ void OutputDevice::SetLineColor()
void OutputDevice::SetLineColor( const Color& rColor )
{
- DBG_TRACE1( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() );
+ OSL_TRACE( "OutputDevice::SetLineColor( %lx )", rColor.GetColor() );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -1310,7 +1311,7 @@ void OutputDevice::SetLineColor( const Color& rColor )
void OutputDevice::SetFillColor()
{
- DBG_TRACE( "OutputDevice::SetFillColor()" );
+ OSL_TRACE( "OutputDevice::SetFillColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1331,7 +1332,7 @@ void OutputDevice::SetFillColor()
void OutputDevice::SetFillColor( const Color& rColor )
{
- DBG_TRACE1( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() );
+ OSL_TRACE( "OutputDevice::SetFillColor( %lx )", rColor.GetColor() );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -1403,7 +1404,7 @@ void OutputDevice::SetFillColor( const Color& rColor )
void OutputDevice::SetBackground()
{
- DBG_TRACE( "OutputDevice::SetBackground()" );
+ OSL_TRACE( "OutputDevice::SetBackground()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
maBackground = Wallpaper();
@@ -1417,7 +1418,7 @@ void OutputDevice::SetBackground()
void OutputDevice::SetBackground( const Wallpaper& rBackground )
{
- DBG_TRACE( "OutputDevice::SetBackground( rBackground )" );
+ OSL_TRACE( "OutputDevice::SetBackground( rBackground )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
maBackground = rBackground;
@@ -1435,7 +1436,7 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground )
void OutputDevice::SetRefPoint()
{
- DBG_TRACE( "OutputDevice::SetRefPoint()" );
+ OSL_TRACE( "OutputDevice::SetRefPoint()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1452,7 +1453,7 @@ void OutputDevice::SetRefPoint()
void OutputDevice::SetRefPoint( const Point& rRefPoint )
{
- DBG_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" );
+ OSL_TRACE( "OutputDevice::SetRefPoint( rRefPoint )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1469,7 +1470,7 @@ void OutputDevice::SetRefPoint( const Point& rRefPoint )
void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt )
{
- DBG_TRACE( "OutputDevice::DrawLine()" );
+ OSL_TRACE( "OutputDevice::DrawLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1667,7 +1668,7 @@ void OutputDevice::impPaintLineGeometryWithEvtlExpand(
void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
const LineInfo& rLineInfo )
{
- DBG_TRACE( "OutputDevice::DrawLine()" );
+ OSL_TRACE( "OutputDevice::DrawLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( rLineInfo.IsDefault() )
@@ -1721,7 +1722,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt,
void OutputDevice::DrawRect( const Rectangle& rRect )
{
- DBG_TRACE( "OutputDevice::DrawRect()" );
+ OSL_TRACE( "OutputDevice::DrawRect()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1762,7 +1763,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect )
void OutputDevice::DrawPolyLine( const Polygon& rPoly )
{
- DBG_TRACE( "OutputDevice::DrawPolyLine()" );
+ OSL_TRACE( "OutputDevice::DrawPolyLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rPoly, Polygon, NULL );
@@ -1840,7 +1841,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly )
void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo )
{
- DBG_TRACE( "OutputDevice::DrawPolyLine()" );
+ OSL_TRACE( "OutputDevice::DrawPolyLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rPoly, Polygon, NULL );
@@ -1932,7 +1933,7 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI
void OutputDevice::DrawPolygon( const Polygon& rPoly )
{
- DBG_TRACE( "OutputDevice::DrawPolygon()" );
+ OSL_TRACE( "OutputDevice::DrawPolygon()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rPoly, Polygon, NULL );
@@ -2022,7 +2023,7 @@ void OutputDevice::DrawPolygon( const Polygon& rPoly )
void OutputDevice::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
{
- DBG_TRACE( "OutputDevice::DrawPolyPolygon()" );
+ OSL_TRACE( "OutputDevice::DrawPolyPolygon()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rPolyPoly, PolyPolygon, NULL );
@@ -2133,20 +2134,12 @@ void OutputDevice::DrawPolygon( const ::basegfx::B2DPolygon& rB2DPolygon)
void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly )
{
- DBG_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" );
+ OSL_TRACE( "OutputDevice::DrawPolyPolygon(B2D&)" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
-#if 0
- // MetaB2DPolyPolygonAction is not implemented yet:
- // according to AW adding it is very dangerous since there is a lot
- // of code that uses the metafile actions directly and unless every
- // place that does this knows about the new action we need to fallback
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) );
-#else
+
if( mpMetaFile )
mpMetaFile->AddAction( new MetaPolyPolygonAction( PolyPolygon( rB2DPolyPoly ) ) );
-#endif
// call helper
ImpDrawPolyPolygonWithB2DPolyPolygon(rB2DPolyPoly);
@@ -2257,17 +2250,10 @@ void OutputDevice::DrawPolyLine(
double fLineWidth,
basegfx::B2DLineJoin eLineJoin)
{
- DBG_TRACE( "OutputDevice::DrawPolyLine(B2D&)" );
+ OSL_TRACE( "OutputDevice::DrawPolyLine(B2D&)" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
(void)eLineJoin; // ATM used in UNX, but not in WNT, access it for warning-free
-#if 0 // MetaB2DPolyLineAction is not implemented yet:
- // according to AW adding it is very dangerous since there is a lot
- // of code that uses the metafile actions directly and unless every
- // place that does this knows about the new action we need to fallback
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaB2DPolyLineAction( rB2DPolygon ) );
-#else
if( mpMetaFile )
{
LineInfo aLineInfo;
@@ -2276,7 +2262,7 @@ void OutputDevice::DrawPolyLine(
const Polygon aToolsPolygon( rB2DPolygon );
mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
}
-#endif
+
// AW: Do NOT paint empty PolyPolygons
if(!rB2DPolygon.count())
@@ -2377,7 +2363,7 @@ sal_uInt32 OutputDevice::GetGCStackDepth() const
void OutputDevice::Push( sal_uInt16 nFlags )
{
- DBG_TRACE( "OutputDevice::Push()" );
+ OSL_TRACE( "OutputDevice::Push()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -2466,7 +2452,7 @@ void OutputDevice::Push( sal_uInt16 nFlags )
void OutputDevice::Pop()
{
- DBG_TRACE( "OutputDevice::Pop()" );
+ OSL_TRACE( "OutputDevice::Pop()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( mpMetaFile )
@@ -2707,3 +2693,5 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 46b0d81c348d..d1a76a9f085b 100755..100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -243,7 +244,7 @@ void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* pVoi
void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPt, const Size& rSrcSize )
{
- DBG_TRACE( "OutputDevice::DrawOutDev()" );
+ OSL_TRACE( "OutputDevice::DrawOutDev()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
@@ -317,7 +318,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPt, const Size& rSrcSize,
const OutputDevice& rOutDev )
{
- DBG_TRACE( "OutputDevice::DrawOutDev()" );
+ OSL_TRACE( "OutputDevice::DrawOutDev()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rOutDev, OutputDevice, ImplDbgCheckOutputDevice );
DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
@@ -390,7 +391,7 @@ void OutputDevice::CopyArea( const Point& rDestPt,
const Point& rSrcPt, const Size& rSrcSize,
sal_uInt16 nFlags )
{
- DBG_TRACE( "OutputDevice::CopyArea()" );
+ OSL_TRACE( "OutputDevice::CopyArea()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::CopyArea(...) with printer devices!" );
@@ -520,7 +521,7 @@ void OutputDevice::ImplGetFrameDev( const Point& rPt, const Point& rDevPt, const
void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
{
- DBG_TRACE( "OutputDevice::DrawBitmap()" );
+ OSL_TRACE( "OutputDevice::DrawBitmap()" );
if( ImplIsRecordLayout() )
return;
@@ -539,7 +540,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Bitmap& rBitmap )
void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap )
{
- DBG_TRACE( "OutputDevice::DrawBitmap( Size )" );
+ OSL_TRACE( "OutputDevice::DrawBitmap( Size )" );
if( ImplIsRecordLayout() )
return;
@@ -559,7 +560,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const Bitmap& rBitmap )
{
- DBG_TRACE( "OutputDevice::DrawBitmap( Point, Size )" );
+ OSL_TRACE( "OutputDevice::DrawBitmap( Point, Size )" );
if( ImplIsRecordLayout() )
return;
@@ -737,7 +738,7 @@ void OutputDevice::ImplDrawBitmap( const Point& rDestPt, const Size& rDestSize,
void OutputDevice::DrawBitmapEx( const Point& rDestPt,
const BitmapEx& rBitmapEx )
{
- DBG_TRACE( "OutputDevice::DrawBitmapEx()" );
+ OSL_TRACE( "OutputDevice::DrawBitmapEx()" );
if( ImplIsRecordLayout() )
return;
@@ -756,7 +757,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt,
void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
const BitmapEx& rBitmapEx )
{
- DBG_TRACE( "OutputDevice::DrawBitmapEx( Size )" );
+ OSL_TRACE( "OutputDevice::DrawBitmapEx( Size )" );
if( ImplIsRecordLayout() )
return;
@@ -773,7 +774,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const BitmapEx& rBitmapEx )
{
- DBG_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" );
+ OSL_TRACE( "OutputDevice::DrawBitmapEx( Point, Size )" );
if( ImplIsRecordLayout() )
return;
@@ -1008,7 +1009,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point& rDestPt, const Size& rDestSize
void OutputDevice::DrawMask( const Point& rDestPt,
const Bitmap& rBitmap, const Color& rMaskColor )
{
- DBG_TRACE( "OutputDevice::DrawMask()" );
+ OSL_TRACE( "OutputDevice::DrawMask()" );
if( ImplIsRecordLayout() )
return;
@@ -1036,7 +1037,7 @@ void OutputDevice::DrawMask( const Point& rDestPt,
void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Bitmap& rBitmap, const Color& rMaskColor )
{
- DBG_TRACE( "OutputDevice::DrawMask( Size )" );
+ OSL_TRACE( "OutputDevice::DrawMask( Size )" );
if( ImplIsRecordLayout() )
return;
@@ -1065,7 +1066,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const Bitmap& rBitmap, const Color& rMaskColor )
{
- DBG_TRACE( "OutputDevice::DrawMask( Point, Size )" );
+ OSL_TRACE( "OutputDevice::DrawMask( Point, Size )" );
if( ImplIsRecordLayout() )
return;
@@ -1446,7 +1447,7 @@ Color* OutputDevice::GetPixel( const Polygon& rPts ) const
void OutputDevice::DrawPixel( const Point& rPt )
{
- DBG_TRACE( "OutputDevice::DrawPixel()" );
+ OSL_TRACE( "OutputDevice::DrawPixel()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -1482,7 +1483,7 @@ void OutputDevice::DrawPixel( const Point& rPt )
void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
{
- DBG_TRACE( "OutputDevice::DrawPixel()" );
+ OSL_TRACE( "OutputDevice::DrawPixel()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -1554,7 +1555,7 @@ void OutputDevice::DrawPixel( const Polygon& rPts, const Color* pColors )
DrawPixel( rPts, GetLineColor() );
else
{
- DBG_TRACE( "OutputDevice::DrawPixel()" );
+ OSL_TRACE( "OutputDevice::DrawPixel()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_ASSERT( pColors, "OutputDevice::DrawPixel: No color array specified" );
@@ -2267,3 +2268,5 @@ void OutputDevice::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor,
mpMetaFile = pOldMetaFile;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 1681e1eeec7c..f5b493b7db4f 100755
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -507,7 +508,7 @@ static void ImplFontSubstitute( String& rFontName,
Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang,
sal_uLong nFlags, const OutputDevice* pOutDev )
{
- DBG_TRACE( "OutputDevice::GetDefaultFont()" );
+ OSL_TRACE( "OutputDevice::GetDefaultFont()" );
com::sun::star::lang::Locale aLocale;
if( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW )
@@ -615,10 +616,10 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang,
// No Name, than set all names
if ( !aFont.GetName().Len() )
{
- xub_StrLen nIndex = 0;
if ( nFlags & DEFAULTFONT_FLAGS_ONLYONE )
{
- //aFont.SetName( aSearch.GetToken( 0, ';', nIndex ) );
+ xub_StrLen nIndex = 0;
+
if( !pOutDev )
pOutDev = (const OutputDevice *)ImplGetSVData()->mpDefaultWin;
if( !pOutDev )
@@ -1004,8 +1005,8 @@ ImplFontEntry::~ImplFontEntry()
size_t ImplFontEntry::GFBCacheKey_Hash::operator()( const GFBCacheKey& rData ) const
{
- std::hash<sal_UCS4> a;
- std::hash<int > b;
+ boost::hash<sal_UCS4> a;
+ boost::hash<int > b;
return a(rData.first) ^ b(rData.second);
}
@@ -1402,16 +1403,6 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const
}
#endif
-#if defined(HDU_DEBUG)
- for( int i = 0; i < nMaxLevel; ++i )
- {
- ImplDevFontListData* pFont = pFallbackList[ i ];
- ByteString aFontName( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 );
- fprintf( stderr, "GlyphFallbackFont[%d] (quality=%05d): \"%s\"\n",
- i, pFont->GetMinQuality(), aFontName.GetBuffer() );
- }
-#endif
-
mnFallbackCount = nMaxLevel;
mpFallbackList = pFallbackList;
}
@@ -1514,7 +1505,8 @@ void ImplDevFontList::Add( ImplFontData* pNewData )
pNewData->maMapNames = String();
bool bKeepNewData = false;
- for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; )
+ xub_StrLen nMapNameIndex = 0;
+ while( true )
{
String aSearchName = pNewData->maName;
GetEnglishSearchFontName( aSearchName );
@@ -1532,7 +1524,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData )
bKeepNewData = pFoundData->AddFontFace( pNewData );
- // add font alias if available
+ // add (another) font alias if available
// a font alias should never win against an original font with similar quality
if( aMapNames.Len() <= nMapNameIndex )
break;
@@ -2757,8 +2749,20 @@ ImplFontEntry* ImplFontCache::GetGlyphFallbackFont( ImplDevFontList* pFontList,
// e.g. PsPrint Arial->Helvetica for udiaeresis when Helvetica doesn't support it
if( nFallbackLevel >= 1)
{
- ImplDevFontListData* pFallbackData = pFontList->GetGlyphFallbackFont(
- rFontSelData, rMissingCodes, nFallbackLevel-1 );
+ ImplDevFontListData* pFallbackData = NULL;
+
+ //fdo#33898 If someone has EUDC installed then they really want that to
+ //be used as the first-choice glyph fallback seeing as it's filled with
+ //private area codes with don't make any sense in any other font so
+ //prioritise it here if it's available. Ideally we would remove from
+ //rMissingCodes all the glyphs which it is able to resolve as an
+ //optimization, but that's tricky to achieve cross-platform without
+ //sufficient heavy-weight code that's likely to undo the value of the
+ //optimization
+ if (nFallbackLevel == 1)
+ pFallbackData = pFontList->FindFontFamily(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUDC")));
+ if (!pFallbackData)
+ pFallbackData = pFontList->GetGlyphFallbackFont(rFontSelData, rMissingCodes, nFallbackLevel-1);
// escape when there are no font candidates
if( !pFallbackData )
return NULL;
@@ -3552,12 +3556,8 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
{
long nCurX = nStartX;
long nCurY = nStartY;
- long nDiffX = 2;
long nDiffY = nHeight-1;
long nCount = nWidth;
- long nOffY = -1;
- long nFreq;
- long i;
long nPixWidth;
long nPixHeight;
sal_Bool bDrawPixAsRect;
@@ -3597,8 +3597,11 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
}
else
{
+ long nDiffX = 2;
+ long nOffY = -1;
+ long i;
nCurY += nDiffY;
- nFreq = nCount / (nDiffX+nDiffY);
+ long nFreq = nCount / (nDiffX+nDiffY);
while ( nFreq-- )
{
for( i = nDiffY; i; --i )
@@ -4010,6 +4013,11 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
FontStrikeout eStrikeout,
Color aColor )
{
+ //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need
+ //to tweak this
+ if (!nWidth)
+ return;
+
// PDF-export does its own strikeout drawing... why again?
if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) )
return;
@@ -4022,35 +4030,23 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
cStrikeoutChar = 'X';
static const int nTestStrLen = 4;
static const int nMaxStrikeStrLen = 2048;
- xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind...
+ xub_Unicode aChars[nMaxStrikeStrLen+1]; // +1 for valgrind...
for( int i = 0; i < nTestStrLen; ++i)
aChars[i] = cStrikeoutChar;
const String aStrikeoutTest( aChars, nTestStrLen );
// calculate approximation of strikeout atom size
- long nStrikeoutWidth = nWidth;
+ long nStrikeoutWidth = 0;
SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen );
if( pLayout )
{
- nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel());
+ nStrikeoutWidth = pLayout->GetTextWidth() / (nTestStrLen * pLayout->GetUnitsPerPixel());
pLayout->Release();
}
if( nStrikeoutWidth <= 0 ) // sanity check
return;
- // calculate acceptable strikeout length
- // allow the strikeout to be one pixel larger than the text it strikes out
- long nMaxWidth = nStrikeoutWidth * 3 / 4;
- if ( nMaxWidth < 2 )
- nMaxWidth = 2;
- nMaxWidth += nWidth + 1;
-
- int nStrikeStrLen = (nMaxWidth - 1) / nStrikeoutWidth;
- // if the text width is smaller than the strikeout text, then do not
- // strike out at all. This case requires user interaction, e.g. adding
- // a space to the text
- if( nStrikeStrLen <= 0 )
- return;
+ int nStrikeStrLen = (nWidth+(nStrikeoutWidth-1)) / nStrikeoutWidth;
if( nStrikeStrLen > nMaxStrikeStrLen )
nStrikeStrLen = nMaxStrikeStrLen;
@@ -4079,8 +4075,29 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
ImplInitTextColor();
pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY );
+
+ Rectangle aPixelRect;
+ aPixelRect.nLeft = nBaseX+mnTextOffX;
+ aPixelRect.nRight = aPixelRect.nLeft+nWidth;
+ aPixelRect.nBottom = nBaseY+mpFontEntry->maMetric.mnDescent;
+ aPixelRect.nTop = nBaseY-mpFontEntry->maMetric.mnAscent;
+
+ if (mpFontEntry->mnOrientation)
+ {
+ Polygon aPoly( aPixelRect );
+ aPoly.Rotate( Point(nBaseX+mnTextOffX, nBaseY+mnTextOffY), mpFontEntry->mnOrientation);
+ aPixelRect = aPoly.GetBoundRect();
+ }
+
+ Push( PUSH_CLIPREGION );
+ IntersectClipRegion( PixelToLogic(aPixelRect) );
+ if( mbInitClipRegion )
+ ImplInitClipRegion();
+
pLayout->DrawText( *mpGraphics );
+
pLayout->Release();
+ Pop();
SetTextColor( aOldColor );
ImplInitTextColor();
@@ -4440,7 +4457,6 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY,
void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout )
{
- Color aOldColor = GetTextColor();
Color aOldLineColor = GetLineColor();
Color aOldFillColor = GetFillColor();
sal_Bool bOldMap = mbMap;
@@ -4856,8 +4872,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
// auf mehr als Zwei Zeilen gebrochen wird...
if ( xHyph.is() )
{
- sal_Unicode cAlternateReplChar = 0;
- sal_Unicode cAlternateExtraChar = 0;
i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True );
// sal_uInt16 nWordStart = nBreakPos;
// sal_uInt16 nBreakPos_OLD = nBreakPos;
@@ -4929,10 +4943,10 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Falsche Annahme!" );
+ sal_Unicode cAlternateReplChar = 0;
+
if ( nTxtEnd > nTxtStart )
cAlternateReplChar = aAlt.GetChar( nAltStart );
- else
- cAlternateExtraChar = aAlt.GetChar( nAltStart );
nBreakPos = nWordStart + nTxtStart;
if ( cAlternateReplChar )
@@ -5025,7 +5039,7 @@ void OutputDevice::SetAntialiasing( sal_uInt16 nMode )
void OutputDevice::SetFont( const Font& rNewFont )
{
- DBG_TRACE( "OutputDevice::SetFont()" );
+ OSL_TRACE( "OutputDevice::SetFont()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rNewFont, Font, NULL );
@@ -5100,12 +5114,6 @@ void OutputDevice::SetFont( const Font& rNewFont )
mpMetaFile->AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) );
}
-#if (OSL_DEBUG_LEVEL > 2) || defined (HDU_DEBUG)
- fprintf( stderr, " OutputDevice::SetFont( name=\"%s\", h=%ld)\n",
- OUStringToOString( aFont.GetName(), RTL_TEXTENCODING_UTF8 ).getStr(),
- aFont.GetSize().Height() );
-#endif
-
if ( !maFont.IsSameInstance( aFont ) )
{
// Optimization MT/HDU: COL_TRANSPARENT means SetFont should ignore the font color,
@@ -5143,7 +5151,7 @@ void OutputDevice::SetFont( const Font& rNewFont )
void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode )
{
- DBG_TRACE( "OutputDevice::SetTextLayoutMode()" );
+ OSL_TRACE( "OutputDevice::SetTextLayoutMode()" );
if( mpMetaFile )
mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) );
@@ -5158,7 +5166,7 @@ void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode )
void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
{
- DBG_TRACE( "OutputDevice::SetTextLanguage()" );
+ OSL_TRACE( "OutputDevice::SetTextLanguage()" );
if( mpMetaFile )
mpMetaFile->AddAction( new MetaTextLanguageAction( eTextLanguage ) );
@@ -5173,7 +5181,7 @@ void OutputDevice::SetDigitLanguage( LanguageType eTextLanguage )
void OutputDevice::SetTextColor( const Color& rColor )
{
- DBG_TRACE( "OutputDevice::SetTextColor()" );
+ OSL_TRACE( "OutputDevice::SetTextColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -5219,7 +5227,7 @@ void OutputDevice::SetTextColor( const Color& rColor )
void OutputDevice::SetTextFillColor()
{
- DBG_TRACE( "OutputDevice::SetTextFillColor()" );
+ OSL_TRACE( "OutputDevice::SetTextFillColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5238,7 +5246,7 @@ void OutputDevice::SetTextFillColor()
void OutputDevice::SetTextFillColor( const Color& rColor )
{
- DBG_TRACE( "OutputDevice::SetTextFillColor()" );
+ OSL_TRACE( "OutputDevice::SetTextFillColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -5302,7 +5310,7 @@ Color OutputDevice::GetTextFillColor() const
void OutputDevice::SetTextLineColor()
{
- DBG_TRACE( "OutputDevice::SetTextLineColor()" );
+ OSL_TRACE( "OutputDevice::SetTextLineColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5318,7 +5326,7 @@ void OutputDevice::SetTextLineColor()
void OutputDevice::SetTextLineColor( const Color& rColor )
{
- DBG_TRACE( "OutputDevice::SetTextLineColor()" );
+ OSL_TRACE( "OutputDevice::SetTextLineColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -5361,7 +5369,7 @@ void OutputDevice::SetTextLineColor( const Color& rColor )
void OutputDevice::SetOverlineColor()
{
- DBG_TRACE( "OutputDevice::SetOverlineColor()" );
+ OSL_TRACE( "OutputDevice::SetOverlineColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5377,7 +5385,7 @@ void OutputDevice::SetOverlineColor()
void OutputDevice::SetOverlineColor( const Color& rColor )
{
- DBG_TRACE( "OutputDevice::SetOverlineColor()" );
+ OSL_TRACE( "OutputDevice::SetOverlineColor()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Color aColor( rColor );
@@ -5421,7 +5429,7 @@ void OutputDevice::SetOverlineColor( const Color& rColor )
void OutputDevice::SetTextAlign( TextAlign eAlign )
{
- DBG_TRACE( "OutputDevice::SetTextAlign()" );
+ OSL_TRACE( "OutputDevice::SetTextAlign()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5445,7 +5453,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
FontUnderline eOverline,
sal_Bool bUnderlineAbove )
{
- DBG_TRACE( "OutputDevice::DrawTextLine()" );
+ OSL_TRACE( "OutputDevice::DrawTextLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5496,7 +5504,7 @@ sal_Bool OutputDevice::IsTextUnderlineAbove( const Font& rFont )
void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
sal_uInt16 nStyle )
{
- DBG_TRACE( "OutputDevice::DrawWaveLine()" );
+ OSL_TRACE( "OutputDevice::DrawWaveLine()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
@@ -5575,7 +5583,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr,
pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText;
}
- DBG_TRACE( "OutputDevice::DrawText()" );
+ OSL_TRACE( "OutputDevice::DrawText()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
#if OSL_DEBUG_LEVEL > 2
@@ -5651,7 +5659,7 @@ void OutputDevice::DrawText( const Point& rStartPt, const String& rStr,
long OutputDevice::GetTextWidth( const String& rStr,
xub_StrLen nIndex, xub_StrLen nLen ) const
{
- DBG_TRACE( "OutputDevice::GetTextWidth()" );
+ OSL_TRACE( "OutputDevice::GetTextWidth()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
long nWidth = GetTextArray( rStr, NULL, nIndex, nLen );
@@ -5662,7 +5670,7 @@ long OutputDevice::GetTextWidth( const String& rStr,
long OutputDevice::GetTextHeight() const
{
- DBG_TRACE( "OutputDevice::GetTextHeight()" );
+ OSL_TRACE( "OutputDevice::GetTextHeight()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( mbNewFont )
@@ -5686,7 +5694,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr,
const sal_Int32* pDXAry,
xub_StrLen nIndex, xub_StrLen nLen )
{
- DBG_TRACE( "OutputDevice::DrawTextArray()" );
+ OSL_TRACE( "OutputDevice::DrawTextArray()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -5717,7 +5725,7 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr,
long OutputDevice::GetTextArray( const String& rStr, sal_Int32* pDXAry,
xub_StrLen nIndex, xub_StrLen nLen ) const
{
- DBG_TRACE( "OutputDevice::GetTextArray()" );
+ OSL_TRACE( "OutputDevice::GetTextArray()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( nIndex >= rStr.Len() )
@@ -5766,7 +5774,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA
sal_Int32* pDXAry, long nLayoutWidth,
sal_Bool bCellBreaking ) const
{
- DBG_TRACE( "OutputDevice::GetCaretPositions()" );
+ OSL_TRACE( "OutputDevice::GetCaretPositions()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( nIndex >= rStr.Len() )
@@ -5834,7 +5842,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth,
const String& rStr,
xub_StrLen nIndex, xub_StrLen nLen )
{
- DBG_TRACE( "OutputDevice::DrawStretchText()" );
+ OSL_TRACE( "OutputDevice::DrawStretchText()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -6087,6 +6095,58 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr,
return pSalLayout;
}
+void OutputDevice::forceFallbackFontToFit(SalLayout &rFallback, ImplFontEntry &rFallbackFont,
+ ImplFontSelectData &rFontSelData, int nFallbackLevel,
+ ImplLayoutArgs& rLayoutArgs, const ImplFontMetricData& rOrigMetric) const
+{
+ Rectangle aBoundRect;
+ bool bHaveBounding = false;
+ Rectangle aRectangle;
+
+ rFallback.AdjustLayout( rLayoutArgs );
+
+ //All we care about here is getting the vertical bounds of this text and
+ //make sure it will fit inside the available space
+ Point aPos;
+ for( int nStart = 0;;)
+ {
+ sal_GlyphId nLGlyph;
+ if( !rFallback.GetNextGlyphs( 1, &nLGlyph, aPos, nStart ) )
+ break;
+
+ int nFontTag = nFallbackLevel << GF_FONTSHIFT;
+ nLGlyph |= nFontTag;
+
+ // get bounding rectangle of individual glyph
+ if( mpGraphics->GetGlyphBoundRect( nLGlyph, aRectangle ) )
+ {
+ // merge rectangle
+ aRectangle += aPos;
+ aBoundRect.Union( aRectangle );
+ bHaveBounding = true;
+ }
+ }
+
+ //Shrink it down if it won't fit
+ if (bHaveBounding)
+ {
+ long nGlyphsAscent = -aBoundRect.Top();
+ float fScaleTop = nGlyphsAscent > rOrigMetric.mnAscent ?
+ rOrigMetric.mnAscent/(float)nGlyphsAscent : 1;
+ long nGlyphsDescent = aBoundRect.Bottom();
+ float fScaleBottom = nGlyphsDescent > rOrigMetric.mnDescent ?
+ rOrigMetric.mnDescent/(float)nGlyphsDescent : 1;
+ float fScale = fScaleBottom < fScaleTop ? fScaleBottom : fScaleTop;
+ if (fScale < 1)
+ {
+ long nOrigHeight = rFontSelData.mnHeight;
+ rFontSelData.mnHeight *= fScale;
+ rFallbackFont.mnSetFontFlags = mpGraphics->SetFont( &rFontSelData, nFallbackLevel );
+ rFontSelData.mnHeight = nOrigHeight;
+ }
+ }
+}
+
// -----------------------------------------------------------------------
SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLayoutArgs& rLayoutArgs ) const
@@ -6097,17 +6157,6 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
rLayoutArgs.PrepareFallback();
rLayoutArgs.mnFlags |= SAL_LAYOUT_FOR_FALLBACK;
-#if defined(HDU_DEBUG)
- {
- int nCharPos = -1;
- bool bRTL = false;
- fprintf(stderr,"OD:ImplLayout Glyph Fallback for");
- for( int i=0; i<8 && rLayoutArgs.GetNextPos( &nCharPos, &bRTL); ++i )
- fprintf(stderr," U+%04X", rLayoutArgs.mpStr[ nCharPos ] );
- fprintf(stderr,"\n");
- rLayoutArgs.ResetPos();
- }
-#endif
// get list of unicodes that need glyph fallback
int nCharPos = -1;
bool bRTL = false;
@@ -6156,38 +6205,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
}
}
-#if defined(HDU_DEBUG)
- {
- ByteString aOrigFontName( maFont.GetName(), RTL_TEXTENCODING_UTF8);
- ByteString aFallbackName( aFontSelData.mpFontData->GetFamilyName(),
- RTL_TEXTENCODING_UTF8);
- fprintf(stderr,"\tGlyphFallback[lvl=%d] \"%s\" -> \"%s\" (q=%d)\n",
- nFallbackLevel, aOrigFontName.GetBuffer(), aFallbackName.GetBuffer(),
- aFontSelData.mpFontData->GetQuality());
- }
-#endif
-
- // TODO: try to get the metric data from the GFB's mpFontEntry
- ImplFontMetricData aSubstituteMetric( aFontSelData );
pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel );
- mpGraphics->GetFontMetric( &aSubstituteMetric, nFallbackLevel );
-
- const long nOriginalHeight = aOrigMetric.mnAscent + aOrigMetric.mnDescent;
- const long nSubstituteHeight = aSubstituteMetric.mnAscent + aSubstituteMetric.mnDescent;
- // Too tall, shrink it a bit. Need a better calculation to include extra
- // factors and any extra wriggle room we might have available?
- // TODO: should we scale by max-ascent/max-descent instead of design height?
- if( nSubstituteHeight > nOriginalHeight )
- {
- const float fScale = nOriginalHeight / (float)nSubstituteHeight;
- const float fOrigHeight = aFontSelData.mfExactHeight;
- const int nOrigHeight = aFontSelData.mnHeight;
- aFontSelData.mfExactHeight *= fScale;
- aFontSelData.mnHeight = static_cast<int>(aFontSelData.mfExactHeight);
- pFallbackFont->mnSetFontFlags = mpGraphics->SetFont( &aFontSelData, nFallbackLevel );
- aFontSelData.mnHeight = nOrigHeight;
- aFontSelData.mfExactHeight = fOrigHeight;
- }
// create and add glyph fallback layout to multilayout
rLayoutArgs.ResetPos();
@@ -6196,6 +6214,9 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
{
if( pFallback->LayoutText( rLayoutArgs ) )
{
+ forceFallbackFontToFit(*pFallback, *pFallbackFont, aFontSelData,
+ nFallbackLevel, rLayoutArgs, aOrigMetric);
+
if( !pMultiSalLayout )
pMultiSalLayout = new MultiSalLayout( *pSalLayout );
pMultiSalLayout->AddFallback( *pFallback,
@@ -6247,7 +6268,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth,
xub_StrLen nIndex, xub_StrLen nLen,
long nCharExtra, sal_Bool /*TODO: bCellBreaking*/ ) const
{
- DBG_TRACE( "OutputDevice::GetTextBreak()" );
+ OSL_TRACE( "OutputDevice::GetTextBreak()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen );
@@ -6283,7 +6304,7 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth,
xub_StrLen nIndex, xub_StrLen nLen,
long nCharExtra ) const
{
- DBG_TRACE( "OutputDevice::GetTextBreak()" );
+ OSL_TRACE( "OutputDevice::GetTextBreak()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
rHyphenatorPos = STRING_LEN;
@@ -6617,7 +6638,7 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect,
sal_uInt16 nStyle,
GDIMetaFile& rMtf )
{
- DBG_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" );
+ OSL_TRACE( "OutputDevice::AddTextRectActions( const Rectangle& )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( !rOrigStr.Len() || rRect.IsEmpty() )
@@ -6659,7 +6680,7 @@ void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, sal
pDisplayText = &mpOutDevData->mpRecordLayout->m_aDisplayText;
}
- DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" );
+ OSL_TRACE( "OutputDevice::DrawText( const Rectangle& )" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction();
@@ -6702,7 +6723,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect,
TextRectInfo* pInfo,
const ::vcl::ITextLayout* _pTextLayout ) const
{
- DBG_TRACE( "OutputDevice::GetTextRect()" );
+ OSL_TRACE( "OutputDevice::GetTextRect()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Rectangle aRect = rRect;
@@ -6841,7 +6862,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth,
String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth,
sal_uInt16 nStyle, const ::vcl::ITextLayout& _rLayout )
{
- DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" );
+ OSL_TRACE( "OutputDevice::ImplGetEllipsisString()" );
String aStr = rOrigStr;
xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() );
@@ -6974,7 +6995,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr,
xub_StrLen nIndex, xub_StrLen nLen,
sal_uInt16 nStyle, MetricVector* pVector, String* pDisplayText )
{
- DBG_TRACE( "OutputDevice::DrawCtrlText()" );
+ OSL_TRACE( "OutputDevice::DrawCtrlText()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( !IsDeviceOutputNecessary() || (nIndex >= rStr.Len()) )
@@ -7107,7 +7128,7 @@ long OutputDevice::GetCtrlTextWidth( const String& rStr,
xub_StrLen nIndex, xub_StrLen nLen,
sal_uInt16 nStyle ) const
{
- DBG_TRACE( "OutputDevice::GetCtrlTextSize()" );
+ OSL_TRACE( "OutputDevice::GetCtrlTextSize()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( nStyle & TEXT_DRAW_MNEMONIC )
@@ -7166,7 +7187,7 @@ String OutputDevice::GetNonMnemonicString( const String& rStr, xub_StrLen& rMnem
int OutputDevice::GetDevFontCount() const
{
- DBG_TRACE( "OutputDevice::GetDevFontCount()" );
+ OSL_TRACE( "OutputDevice::GetDevFontCount()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( !mpGetDevFontList )
@@ -7178,7 +7199,7 @@ int OutputDevice::GetDevFontCount() const
FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const
{
- DBG_TRACE( "OutputDevice::GetDevFont()" );
+ OSL_TRACE( "OutputDevice::GetDevFont()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
FontInfo aFontInfo;
@@ -7210,7 +7231,7 @@ FontInfo OutputDevice::GetDevFont( int nDevFontIndex ) const
sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFontName )
{
- DBG_TRACE( "OutputDevice::AddTempDevFont()" );
+ OSL_TRACE( "OutputDevice::AddTempDevFont()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
ImplInitFontList();
@@ -7233,7 +7254,7 @@ sal_Bool OutputDevice::AddTempDevFont( const String& rFileURL, const String& rFo
int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const
{
- DBG_TRACE( "OutputDevice::GetDevFontSizeCount()" );
+ OSL_TRACE( "OutputDevice::GetDevFontSizeCount()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
delete mpGetDevSizeList;
@@ -7247,7 +7268,7 @@ int OutputDevice::GetDevFontSizeCount( const Font& rFont ) const
Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const
{
- DBG_TRACE( "OutputDevice::GetDevFontSize()" );
+ OSL_TRACE( "OutputDevice::GetDevFontSize()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
// check range
@@ -7282,7 +7303,7 @@ Size OutputDevice::GetDevFontSize( const Font& rFont, int nSizeIndex ) const
sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const
{
- DBG_TRACE( "OutputDevice::IsFontAvailable()" );
+ OSL_TRACE( "OutputDevice::IsFontAvailable()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
ImplDevFontListData* pFound = mpFontList->FindFontFamily( rFontName );
@@ -7293,7 +7314,7 @@ sal_Bool OutputDevice::IsFontAvailable( const String& rFontName ) const
FontMetric OutputDevice::GetFontMetric() const
{
- DBG_TRACE( "OutputDevice::GetFontMetric()" );
+ OSL_TRACE( "OutputDevice::GetFontMetric()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
FontMetric aMetric;
@@ -7401,7 +7422,7 @@ SystemFontData OutputDevice::GetSysFontData(int nFallbacklevel) const
SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen,
const sal_Int32* pDXAry) const
{
- DBG_TRACE( "OutputDevice::GetSysTextLayoutData()" );
+ OSL_TRACE( "OutputDevice::GetSysTextLayoutData()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
SystemTextLayoutData aSysLayoutData;
@@ -7449,7 +7470,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
long OutputDevice::GetMinKashida() const
{
- DBG_TRACE( "OutputDevice::GetMinKashida()" );
+ OSL_TRACE( "OutputDevice::GetMinKashida()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( mbNewFont && !ImplNewFont() )
return 0;
@@ -7502,7 +7523,7 @@ xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt,
// TODO: best is to get rid of this method completely
sal_uLong OutputDevice::GetKerningPairCount() const
{
- DBG_TRACE( "OutputDevice::GetKerningPairCount()" );
+ OSL_TRACE( "OutputDevice::GetKerningPairCount()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( mbNewFont && !ImplNewFont() )
@@ -7528,7 +7549,7 @@ inline bool CmpKernData( const KerningPair& a, const KerningPair& b )
// TODO: best is to get rid of this method completely
void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKernPairs ) const
{
- DBG_TRACE( "OutputDevice::GetKerningPairs()" );
+ OSL_TRACE( "OutputDevice::GetKerningPairs()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if( mbNewFont && !ImplNewFont() )
@@ -7551,7 +7572,7 @@ void OutputDevice::GetKerningPairs( sal_uLong nRequestedPairs, KerningPair* pKer
sal_Bool OutputDevice::GetGlyphBoundRects( const Point& rOrigin, const String& rStr,
int nIndex, int nLen, int nBase, MetricVector& rVector )
{
- DBG_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" );
+ OSL_TRACE( "OutputDevice::GetGlyphBoundRect_CTL()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
rVector.clear();
@@ -7577,7 +7598,7 @@ sal_Bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
const String& rStr, xub_StrLen nBase, xub_StrLen nIndex, xub_StrLen nLen,
sal_uLong nLayoutWidth, const sal_Int32* pDXAry ) const
{
- DBG_TRACE( "OutputDevice::GetTextBoundRect()" );
+ OSL_TRACE( "OutputDevice::GetTextBoundRect()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
sal_Bool bRet = sal_False;
@@ -8024,6 +8045,22 @@ sal_Bool OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly,
return sal_True;
}
+bool OutputDevice::GetFontCapabilities( FontCapabilities& rFontCapabilities ) const
+{
+ // we need a graphics
+ if( !mpGraphics && !ImplGetGraphics() )
+ return false;
+
+ if( mbNewFont )
+ ImplNewFont();
+ if( mbInitFont )
+ ImplInitFont();
+ if( !mpFontEntry )
+ return false;
+
+ return mpGraphics->GetImplFontCapabilities(rFontCapabilities);
+}
+
// -----------------------------------------------------------------------
sal_Bool OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const
@@ -8117,3 +8154,5 @@ xub_StrLen OutputDevice::HasGlyphs( const Font& rTempFont, const String& rStr,
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
index 84fc4fd7c524..f3828761bd6f 100644
--- a/vcl/source/gdi/outdev4.cxx
+++ b/vcl/source/gdi/outdev4.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -175,42 +176,25 @@ void OutputDevice::ImplDrawLinearGradient( const Rectangle& rRect,
sal_Bool bMtf, const PolyPolygon* pClipPolyPoly )
{
// rotiertes BoundRect ausrechnen
- Rectangle aRect = rRect;
- aRect.Left()--;
- aRect.Top()--;
- aRect.Right()++;
- aRect.Bottom()++;
- sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
- double fAngle = nAngle * F_PI1800;
- double fWidth = aRect.GetWidth();
- double fHeight = aRect.GetHeight();
- double fDX = fWidth * fabs( cos( fAngle ) ) +
- fHeight * fabs( sin( fAngle ) );
- double fDY = fHeight * fabs( cos( fAngle ) ) +
- fWidth * fabs( sin( fAngle ) );
- fDX = (fDX - fWidth) * 0.5 + 0.5;
- fDY = (fDY - fHeight) * 0.5 + 0.5;
- aRect.Left() -= (long)fDX;
- aRect.Right() += (long)fDX;
- aRect.Top() -= (long)fDY;
- aRect.Bottom() += (long)fDY;
+ Rectangle aRect;
+ Point aCenter;
+ sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+
+ rGradient.GetBoundRect( rRect, aRect, aCenter );
// Rand berechnen und Rechteck neu setzen
- Point aCenter = rRect.Center();
Rectangle aFullRect = aRect;
long nBorder = (long)rGradient.GetBorder() * aRect.GetHeight() / 100;
- sal_Bool bLinear;
// Rand berechnen und Rechteck neu setzen fuer linearen Farbverlauf
- if ( rGradient.GetStyle() == GRADIENT_LINEAR )
+ bool bLinear = (rGradient.GetStyle() == GRADIENT_LINEAR);
+ if ( bLinear )
{
- bLinear = sal_True;
aRect.Top() += nBorder;
}
// Rand berechnen und Rechteck neu setzen fuer axiale Farbverlauf
else
{
- bLinear = sal_False;
nBorder >>= 1;
aRect.Top() += nBorder;
@@ -430,7 +414,8 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect,
// Virtuelle Device werden auch ausgeklammert, da einige Treiber
// ansonsten zu langsam sind
PolyPolygon* pPolyPoly;
- Rectangle aRect( rRect );
+ Rectangle aRect;
+ Point aCenter;
Color aStartCol( rGradient.GetStartColor() );
Color aEndCol( rGradient.GetEndColor() );
long nStartRed = ( (long) aStartCol.GetRed() * rGradient.GetStartIntensity() ) / 100;
@@ -445,66 +430,13 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect,
long nStepCount = rGradient.GetSteps();
sal_uInt16 nAngle = rGradient.GetAngle() % 3600;
+ rGradient.GetBoundRect( rRect, aRect, aCenter );
+
if( (meRasterOp != ROP_OVERPAINT) || (meOutDevType != OUTDEV_WINDOW) || bMtf )
pPolyPoly = new PolyPolygon( 2 );
else
pPolyPoly = NULL;
- if( rGradient.GetStyle() == GRADIENT_SQUARE || rGradient.GetStyle() == GRADIENT_RECT )
- {
- const double fAngle = nAngle * F_PI1800;
- const double fWidth = aRect.GetWidth();
- const double fHeight = aRect.GetHeight();
- double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) );
- double fDY = fHeight * fabs( cos( fAngle ) ) + fWidth * fabs( sin( fAngle ) );
-
- fDX = ( fDX - fWidth ) * 0.5 + 0.5;
- fDY = ( fDY - fHeight ) * 0.5 + 0.5;
-
- aRect.Left() -= (long) fDX;
- aRect.Right() += (long) fDX;
- aRect.Top() -= (long) fDY;
- aRect.Bottom() += (long) fDY;
- }
-
- Size aSize( aRect.GetSize() );
-
- if( rGradient.GetStyle() == GRADIENT_RADIAL )
- {
- // Radien-Berechnung fuer Kreis
- aSize.Width() = (long)(0.5 + sqrt((double)aSize.Width()*(double)aSize.Width() + (double)aSize.Height()*(double)aSize.Height()));
- aSize.Height() = aSize.Width();
- }
- else if( rGradient.GetStyle() == GRADIENT_ELLIPTICAL )
- {
- // Radien-Berechnung fuer Ellipse
- aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 );
- aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 );
- }
- else if( rGradient.GetStyle() == GRADIENT_SQUARE )
- {
- if ( aSize.Width() > aSize.Height() )
- aSize.Height() = aSize.Width();
- else
- aSize.Width() = aSize.Height();
- }
-
- // neue Mittelpunkte berechnen
- long nZWidth = aRect.GetWidth() * (long) rGradient.GetOfsX() / 100;
- long nZHeight = aRect.GetHeight() * (long) rGradient.GetOfsY() / 100;
- long nBorderX = (long) rGradient.GetBorder() * aSize.Width() / 100;
- long nBorderY = (long) rGradient.GetBorder() * aSize.Height() / 100;
- Point aCenter( aRect.Left() + nZWidth, aRect.Top() + nZHeight );
-
- // Rand beruecksichtigen
- aSize.Width() -= nBorderX;
- aSize.Height() -= nBorderY;
-
- // Ausgaberechteck neu setzen
- aRect.Left() = aCenter.X() - ( aSize.Width() >> 1 );
- aRect.Top() = aCenter.Y() - ( aSize.Height() >> 1 );
-
- aRect.SetSize( aSize );
long nMinRect = Min( aRect.GetWidth(), aRect.GetHeight() );
// Anzahl der Schritte berechnen, falls nichts uebergeben wurde
@@ -675,7 +607,7 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect,
void OutputDevice::DrawGradient( const Rectangle& rRect,
const Gradient& rGradient )
{
- DBG_TRACE( "OutputDevice::DrawGradient()" );
+ OSL_TRACE( "OutputDevice::DrawGradient()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rGradient, Gradient, NULL );
@@ -806,7 +738,7 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
const Gradient& rGradient )
{
- DBG_TRACE( "OutputDevice::DrawGradient()" );
+ OSL_TRACE( "OutputDevice::DrawGradient()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
DBG_CHKOBJ( &rGradient, Gradient, NULL );
@@ -1073,7 +1005,7 @@ void OutputDevice::AddGradientActions( const Rectangle& rRect, const Gradient& r
void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch )
{
- DBG_TRACE( "OutputDevice::DrawHatch()" );
+ OSL_TRACE( "OutputDevice::DrawHatch()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Hatch aHatch( rHatch );
@@ -1420,3 +1352,5 @@ void OutputDevice::ImplDrawHatchLine( const Line& rLine, const PolyPolygon& rPol
}
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev5.cxx b/vcl/source/gdi/outdev5.cxx
index 0a28203dbdfd..fcf32aff87e6 100644
--- a/vcl/source/gdi/outdev5.cxx
+++ b/vcl/source/gdi/outdev5.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,7 +52,7 @@ DBG_NAMEEX( OutputDevice )
void OutputDevice::DrawRect( const Rectangle& rRect,
sal_uLong nHorzRound, sal_uLong nVertRound )
{
- DBG_TRACE( "OutputDevice::DrawRoundRect()" );
+ OSL_TRACE( "OutputDevice::DrawRoundRect()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -110,7 +111,7 @@ void OutputDevice::DrawRect( const Rectangle& rRect,
void OutputDevice::DrawEllipse( const Rectangle& rRect )
{
- DBG_TRACE( "OutputDevice::DrawEllipse()" );
+ OSL_TRACE( "OutputDevice::DrawEllipse()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -161,7 +162,7 @@ void OutputDevice::DrawEllipse( const Rectangle& rRect )
void OutputDevice::DrawArc( const Rectangle& rRect,
const Point& rStartPt, const Point& rEndPt )
{
- DBG_TRACE( "OutputDevice::DrawArc()" );
+ OSL_TRACE( "OutputDevice::DrawArc()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -208,7 +209,7 @@ void OutputDevice::DrawArc( const Rectangle& rRect,
void OutputDevice::DrawPie( const Rectangle& rRect,
const Point& rStartPt, const Point& rEndPt )
{
- DBG_TRACE( "OutputDevice::DrawPie()" );
+ OSL_TRACE( "OutputDevice::DrawPie()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -262,7 +263,7 @@ void OutputDevice::DrawPie( const Rectangle& rRect,
void OutputDevice::DrawChord( const Rectangle& rRect,
const Point& rStartPt, const Point& rEndPt )
{
- DBG_TRACE( "OutputDevice::DrawChord()" );
+ OSL_TRACE( "OutputDevice::DrawChord()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
if ( mpMetaFile )
@@ -310,3 +311,5 @@ void OutputDevice::DrawChord( const Rectangle& rRect,
if( mpAlphaVDev )
mpAlphaVDev->DrawChord( rRect, rStartPt, rEndPt );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 4e02681841d2..2c0861ac9494 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -62,7 +63,7 @@ DBG_NAMEEX( OutputDevice )
void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLong nFlags )
{
- DBG_TRACE( "OutputDevice::DrawGrid()" );
+ OSL_TRACE( "OutputDevice::DrawGrid()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
Rectangle aDstRect( PixelToLogic( Point() ), GetOutputSize() );
@@ -161,7 +162,7 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency)
{
- DBG_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" );
+ OSL_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
// AW: Do NOT paint empty PolyPolygons
@@ -211,17 +212,8 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
if( bDrawnOk )
{
-#if 0
- // MetaB2DPolyPolygonAction is not implemented yet:
- // according to AW adding it is very dangerous since there is a lot
- // of code that uses the metafile actions directly and unless every
- // place that does this knows about the new action we need to fallback
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaB2DPolyPolygonAction( rB2DPolyPoly ) );
-#else
if( mpMetaFile )
mpMetaFile->AddAction( new MetaTransparentAction( PolyPolygon( rB2DPolyPoly ), static_cast< sal_uInt16 >(fTransparency * 100.0)));
-#endif
return;
}
}
@@ -236,7 +228,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
sal_uInt16 nTransparencePercent )
{
- DBG_TRACE( "OutputDevice::DrawTransparent()" );
+ OSL_TRACE( "OutputDevice::DrawTransparent()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
// short circuit for drawing an opaque polygon
@@ -633,7 +625,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
const Size& rSize, const Gradient& rTransparenceGradient )
{
- DBG_TRACE( "OutputDevice::DrawTransparent()" );
+ OSL_TRACE( "OutputDevice::DrawTransparent()" );
DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice );
const Color aBlack( COL_BLACK );
@@ -722,6 +714,8 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
pVDev->EnableMapMode(false);
const AlphaMask aAlpha(pVDev->GetBitmap(aPoint, pVDev->GetOutputSizePixel()));
+ delete pVDev;
+
// draw masked content to target and restore MapMode
DrawBitmapEx(aDstRect.TopLeft(), BitmapEx(aPaint, aAlpha));
EnableMapMode(bOrigMapModeEnabled);
@@ -1251,8 +1245,6 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
}
// ------------------------------------------------------------------
-
-void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize,
const ::vcl::RenderGraphic& rRenderGraphic )
{
DBG_TRACE( "OutputDevice::DrawRenderGraphic()" );
@@ -1271,4 +1263,5 @@ void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize,
DrawBitmapEx( rPoint, rSize, aRasterizer.Rasterize( aSizePixel ) );
mpMetaFile = pOldMetaFile;
}
-}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/vcl/source/gdi/outdevnative.cxx b/vcl/source/gdi/outdevnative.cxx
index c31188fc357e..2bdc4f84fb7b 100755..100644
--- a/vcl/source/gdi/outdevnative.cxx
+++ b/vcl/source/gdi/outdevnative.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -214,12 +215,11 @@ static boost::shared_ptr< ImplControlValue > lcl_transformControlValue( const Im
}
break;
default:
- OSL_ENSURE( 0, "unknown ImplControlValue type !" );
+ OSL_FAIL( "unknown ImplControlValue type !" );
break;
}
return aResult;
}
-
sal_Bool OutputDevice::DrawNativeControl( ControlType nType,
ControlPart nPart,
const Rectangle& rControlRegion,
@@ -237,7 +237,7 @@ sal_Bool OutputDevice::DrawNativeControl( ControlType nType,
if ( mbInitClipRegion )
ImplInitClipRegion();
- if ( mbOutputClipped )
+ if ( mbOutputClipped || rControlRegion.IsEmpty() )
return sal_True;
if ( mbInitLineColor )
@@ -336,3 +336,4 @@ sal_Bool OutputDevice::GetNativeControlRegion( ControlType nType,
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx
index 72bcd2cc8a14..dd69e74d80fb 100644
--- a/vcl/source/gdi/outmap.cxx
+++ b/vcl/source/gdi/outmap.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -53,8 +54,6 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
-#define USE_64BIT_INTS
-
// =======================================================================
DBG_NAMEEX( OutputDevice )
@@ -175,12 +174,10 @@ static void ImplCalcBigIntThreshold( long nDPIX, long nDPIY,
rThresRes.mnThresPixToLogY = (long)(((sal_uLong)LONG_MAX + (sal_uLong)(-nProductY/2)) / nDenomY);
}
-#ifdef USE_64BIT_INTS
rThresRes.mnThresLogToPixX /= 2;
rThresRes.mnThresLogToPixY /= 2;
rThresRes.mnThresPixToLogX /= 2;
rThresRes.mnThresPixToLogY /= 2;
-#endif
}
// -----------------------------------------------------------------------
@@ -284,7 +281,7 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
}
break;
default:
- DBG_ERROR( "unhandled MapUnit" );
+ OSL_FAIL( "unhandled MapUnit" );
break;
}
@@ -384,7 +381,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
{
// To "use" it...
(void) nThres;
-#ifdef USE_64BIT_INTS
#if (SAL_TYPES_SIZEOFLONG < 8)
if( (+n < nThres) && (-n < nThres) )
{
@@ -412,34 +408,6 @@ static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
}
}
return n;
-#else // USE_64BIT_INTS
- if ( Abs( n ) < nThres )
- {
- n *= nDPI * nMapNum;
- n += n >= 0 ? nMapDenom/2 : -((nMapDenom-1)/2);
- return (n / nMapDenom);
- }
- else
- {
- BigInt aTemp( n );
- aTemp *= BigInt( nDPI );
- aTemp *= BigInt( nMapNum );
-
- if ( aTemp.IsNeg() )
- {
- BigInt aMapScDenom2( (nMapDenom-1)/2 );
- aTemp -= aMapScDenom2;
- }
- else
- {
- BigInt aMapScDenom2( nMapDenom/2 );
- aTemp += aMapScDenom2;
- }
-
- aTemp /= BigInt( nMapDenom );
- return (long)aTemp;
- }
-#endif
}
// -----------------------------------------------------------------------
@@ -449,7 +417,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
{
// To "use" it...
(void) nThres;
-#ifdef USE_64BIT_INTS
#if (SAL_TYPES_SIZEOFLONG < 8)
if( (+n < nThres) && (-n < nThres) )
n = (2 * n * nMapDenom) / (nDPI * nMapNum);
@@ -463,59 +430,6 @@ static long ImplPixelToLogic( long n, long nDPI, long nMapNum, long nMapDenom,
}
if( n < 0 ) --n; else ++n;
return (n / 2);
-#else // USE_64BIT_INTS
- if ( Abs( n ) < nThres )
- {
- long nDenom = nDPI * nMapNum;
- long nNum = n * nMapDenom;
- if( (nNum ^ nDenom) >= 0 )
- nNum += nDenom/2;
- else
- nNum -= nDenom/2;
- return (nNum / nDenom);
- }
- else
- {
- BigInt aDenom( nDPI );
- aDenom *= BigInt( nMapNum );
-
- BigInt aNum( n );
- aNum *= BigInt( nMapDenom );
-
- BigInt aDenom2( aDenom );
- if ( aNum.IsNeg() )
- {
- if ( aDenom.IsNeg() )
- {
- aDenom2 /= BigInt(2);
- aNum += aDenom2;
- }
- else
- {
- aDenom2 -= 1;
- aDenom2 /= BigInt(2);
- aNum -= aDenom2;
- }
- }
- else
- {
- if ( aDenom.IsNeg() )
- {
- aDenom2 += 1;
- aDenom2 /= BigInt(2);
- aNum -= aDenom2;
- }
- else
- {
- aDenom2 /= BigInt(2);
- aNum += aDenom2;
- }
- }
-
- aNum /= aDenom;
- return (long)aNum;
- }
-#endif
}
// -----------------------------------------------------------------------
@@ -2505,3 +2419,5 @@ long Window::ImplLogicUnitToPixelY( long nY, MapUnit eUnit )
return nY;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index c47b034e1011..2736e321ea80 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -426,7 +427,7 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM
}
break;
}
- aBeg++;
+ ++aBeg;
}
}
break;
@@ -437,13 +438,11 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM
break;
case PDFExtOutDevDataSync::EndGroupGfxLink :
{
- sal_Int32 nTransparency;
Rectangle aOutputRect, aVisibleOutputRect;
Graphic aGraphic( mGraphics.front() );
mGraphics.pop_front();
- nTransparency = mParaInts.front();
- mParaInts.pop_front();
+ mParaInts.pop_front(); //Transparency
aOutputRect = mParaRects.front();
mParaRects.pop_front();
aVisibleOutputRect = mParaRects.front();
@@ -843,3 +842,5 @@ void PDFExtOutDevData::EndGroup( const Graphic& rGraphic,
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx
index f0842c6bc1ba..61499fdc24d8 100644
--- a/vcl/source/gdi/pdffontcache.cxx
+++ b/vcl/source/gdi/pdffontcache.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -83,3 +84,4 @@ sal_Int32 PDFFontCache::getGlyphWidth( const ImplFontData* pFont, sal_GlyphId nG
return nWidth;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdffontcache.hxx b/vcl/source/gdi/pdffontcache.hxx
index b9997c1e6fc9..f607f100c52c 100644
--- a/vcl/source/gdi/pdffontcache.hxx
+++ b/vcl/source/gdi/pdffontcache.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -79,3 +80,5 @@ namespace vcl
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index d6c5aed6b52a..244620bdafd5 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -578,3 +579,4 @@ void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::P
((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL);
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 11e4367eae95..8bab1abf6d47 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -82,7 +83,14 @@
#include "cppuhelper/implbase1.hxx"
using namespace vcl;
-using namespace rtl;
+
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+using ::rtl::OString;
+using ::rtl::OStringHash;
+using ::rtl::OUStringHash;
+using ::rtl::OStringBuffer;
+using ::rtl::OUStringBuffer;
#if (OSL_DEBUG_LEVEL < 2)
#define COMPRESS_PAGES
@@ -712,7 +720,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr
// find or create a hierarchical field
// first find the fully qualified name up to this field
aDomain = aFullName.copy( 0, nTokenIndex-1 );
- std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain );
+ boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain );
if( it == m_aFieldNameMap.end() )
{
// create new hierarchy field
@@ -773,7 +781,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr
// insert widget into its hierarchy field
if( aDomain.getLength() )
{
- std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain );
+ boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash >::const_iterator it = m_aFieldNameMap.find( aDomain );
if( it != m_aFieldNameMap.end() )
{
OSL_ENSURE( it->second >= 0 && it->second < sal_Int32( m_aWidgets.size() ), "invalid field index" );
@@ -800,11 +808,11 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr
if( ! m_aContext.AllowDuplicateFieldNames )
{
- std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName );
+ boost::unordered_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aFullName );
if( it != m_aFieldNameMap.end() ) // not unique
{
- std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
+ boost::unordered_map< OString, sal_Int32, OStringHash >::const_iterator check_it;
OString aTry;
sal_Int32 nTry = 2;
do
@@ -1251,11 +1259,6 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject )
}
aLine.append( "]\n" );
}
- #if 0
- // FIXME: implement tab order as Structure Tree
- if( m_bHasWidgets && m_pWriter->getVersion() >= PDFWriter::PDF_1_5 )
- aLine.append( " /Tabs /S\n" );
- #endif
if( m_aMCIDParents.size() > 0 )
{
OStringBuffer aStructParents( 1024 );
@@ -2277,7 +2280,7 @@ ImplDevFontList* PDFWriterImpl::filterDevFontList( ImplDevFontList* pFontList )
// append the PDF builtin fonts
if( !m_bIsPDF_A1 && !m_bEmbedStandardFonts)
- for( unsigned int i = 0; i < sizeof(m_aBuiltinFonts)/sizeof(m_aBuiltinFonts[0]); i++ )
+ for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aBuiltinFonts); i++ )
{
ImplFontData* pNewData = new ImplPdfBuiltinFontData( m_aBuiltinFonts[i] );
pFiltered->Add( pNewData );
@@ -2473,7 +2476,7 @@ void PDFWriterImpl::endPage()
// sanity check
if( m_aOutputStreams.begin() != m_aOutputStreams.end() )
{
- DBG_ERROR( "redirection across pages !!!" );
+ OSL_FAIL( "redirection across pages !!!" );
m_aOutputStreams.clear(); // leak !
m_aMapMode.SetOrigin( Point() );
}
@@ -2724,7 +2727,7 @@ OString PDFWriterImpl::emitStructureAttributes( PDFStructureElement& i_rEle )
}
else
{
- DBG_ERROR( "unresolved link id for Link structure" );
+ OSL_FAIL( "unresolved link id for Link structure" );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "unresolved link id %" SAL_PRIdINT32 " for Link structure\n", nLink );
{
@@ -2825,7 +2828,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle )
emitStructure( rChild );
else
{
- DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure element" );
+ OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure element" );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it );
#endif
@@ -2834,7 +2837,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle )
}
else
{
- DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" );
+ OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PDFWriterImpl::emitStructure: invalid child structure id %" SAL_PRIdINT32 "\n", *it );
#endif
@@ -2857,7 +2860,7 @@ sal_Int32 PDFWriterImpl::emitStructure( PDFStructureElement& rEle )
if( ! m_aRoleMap.empty() )
{
aLine.append( "/RoleMap<<" );
- for( std::hash_map<OString,OString,OStringHash>::const_iterator
+ for( boost::unordered_map<OString,OString,OStringHash>::const_iterator
it = m_aRoleMap.begin(); it != m_aRoleMap.end(); ++it )
{
aLine.append( '/' );
@@ -3101,7 +3104,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa
return aRet;
}
- sal_Int32 nFontObject = 0;
sal_Int32 nFontDescriptor = 0;
rtl::OString aSubType( "/Type1" );
FontSubsetInfo aInfo;
@@ -3164,7 +3166,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa
}
else
{
- DBG_ERROR( "system font neither embeddable nor subsettable" );
+ OSL_FAIL( "system font neither embeddable nor subsettable" );
}
// write font descriptor
@@ -3199,7 +3201,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontDa
"endobj\n\n" );
writeBuffer( aLine.getStr(), aLine.getLength() );
- nFontObject = nObject;
aRet[ rEmbed.m_nNormalFontID ] = nObject;
}
}
@@ -3252,7 +3253,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
return aRet;
}
- sal_Int32 nFontObject = 0;
sal_Int32 nStreamObject = 0;
sal_Int32 nFontDescriptor = 0;
@@ -3668,7 +3668,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
if( nFontDescriptor )
{
if( pEncoding )
- nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, sizeof(nEncoding)/sizeof(nEncoding[0]) );
+ nToUnicodeStream = createToUnicodeCMap( nEncoding, &aUnicodes[0], pUnicodesPerGlyph, pEncToUnicodeIndex, SAL_N_ELEMENTS(nEncoding) );
// write font object
sal_Int32 nObject = createObject();
@@ -3704,8 +3704,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
if( ! writeBuffer( aLine.getStr(), aLine.getLength() ) )
throw FontException();
- nFontObject = nObject;
-
aRet[ rEmbed.m_nNormalFontID ] = nObject;
// write additional encodings
@@ -3998,7 +3996,7 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs
case FontSubsetInfo::ANY_TYPE1:
break;
default:
- DBG_ERROR( "unknown fonttype in PDF font descriptor" );
+ OSL_FAIL( "unknown fonttype in PDF font descriptor" );
return 0;
}
aLine.append( ' ' );
@@ -4073,7 +4071,7 @@ bool PDFWriterImpl::emitFonts()
nGlyphs++;
else
{
- DBG_ERROR( "too many glyphs for subset" );
+ OSL_FAIL( "too many glyphs for subset" );
}
}
FontSubsetInfo aSubsetInfo;
@@ -4131,7 +4129,7 @@ bool PDFWriterImpl::emitFonts()
else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::CFF_FONT) != 0 )
{
// TODO: implement
- DBG_ERROR( "PDFWriterImpl does not support CFF-font subsets yet!" );
+ OSL_FAIL( "PDFWriterImpl does not support CFF-font subsets yet!" );
}
else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA?
{
@@ -4594,7 +4592,6 @@ we check in the following sequence:
// extract target file type
INetURLObject aDocumentURL( m_aContext.BaseURL );
INetURLObject aTargetURL( rLink.m_aURL );
- sal_Int32 nChangeFileExtensionToPDF = 0;
sal_Int32 nSetGoToRMode = 0;
sal_Bool bTargetHasPDFExtension = sal_False;
INetProtocol eTargetProtocol = aTargetURL.GetProtocol();
@@ -4633,18 +4630,19 @@ we check in the following sequence:
{
if( m_aContext.ConvertOOoTargetToPDFTarget )
{
-//examine the file type (.odm .odt. .odp, odg, ods)
+ sal_Int32 bChangeFileExtensionToPDF = false;
+ //examine the file type (.odm .odt. .odp, odg, ods)
if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odm" ) ) ) )
- nChangeFileExtensionToPDF++;
+ bChangeFileExtensionToPDF = true;
if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odt" ) ) ) )
- nChangeFileExtensionToPDF++;
+ bChangeFileExtensionToPDF = true;
else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odp" ) ) ) )
- nChangeFileExtensionToPDF++;
+ bChangeFileExtensionToPDF = true;
else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "odg" ) ) ) )
- nChangeFileExtensionToPDF++;
+ bChangeFileExtensionToPDF = true;
else if( aFileExtension.equalsIgnoreAsciiCase(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ods" ) ) ) )
- nChangeFileExtensionToPDF++;
- if( nChangeFileExtensionToPDF )
+ bChangeFileExtensionToPDF = true;
+ if( bChangeFileExtensionToPDF )
aTargetURL.setExtension(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "pdf" ) ) );
}
//check if extension is pdf, see if GoToR should be forced
@@ -4691,7 +4689,9 @@ we check in the following sequence:
// and will force the use of URI when the protocol is not file://
if( (aFragment.getLength() > 0 && !bTargetHasPDFExtension) ||
eTargetProtocol != INET_PROT_FILE )
+ {
aLine.append( "/URI/URI" );
+ }
else
{
aLine.append( "/Launch/F" );
@@ -4702,7 +4702,8 @@ we check in the following sequence:
}
//fragment are encoded in the same way as in the named destination processing
if( nSetGoToRMode )
- {//add the fragment
+ {
+ //add the fragment
rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET );
aLine.append("/GoToR");
aLine.append("/F");
@@ -4730,15 +4731,11 @@ we check in the following sequence:
aTargetURL.SetMark( aLineLoc.getStr() );
}
rtl::OUString aURL = aTargetURL.GetMainURL( bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE );
-// check if we have a URL available, if the string is empty, set it as the original one
-// if( aURL.getLength() == 0 )
-// appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine );
-// else
- appendLiteralStringEncrypt( bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL,
- INetURLObject::WAS_ENCODED,
+ appendLiteralStringEncrypt(bSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL,
+ INetURLObject::WAS_ENCODED,
bFileSpec ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE
) :
- aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() );
+ aURL , rLink.m_nObject, aLine, osl_getThreadTextEncoding() );
}
//<--- i56629
}
@@ -5042,22 +5039,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr
beginRedirect( pListBoxStream, rBox.m_aRect );
OStringBuffer aAppearance( 64 );
-#if 0
- if( ! rWidget.DropDown )
- {
- // prepare linewidth for DA string hack, see below
- Size aFontSize = lcl_convert( m_aGraphicsStack.front().m_aMapMode,
- m_aMapMode,
- getReferenceDevice(),
- Size( 0, aFont.GetHeight() ) );
- sal_Int32 nLW = aFontSize.Height() / 40;
- appendFixedInt( nLW > 0 ? nLW : 1, aAppearance );
- aAppearance.append( " w\n" );
- writeBuffer( aAppearance.getStr(), aAppearance.getLength() );
- aAppearance.setLength( 0 );
- }
-#endif
-
setLineColor( Color( COL_TRANSPARENT ) );
setFillColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ) );
drawRectangle( rBox.m_aRect );
@@ -5073,18 +5054,6 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr
// prepare DA string
OStringBuffer aDA( 256 );
-#if 0
- if( !rWidget.DropDown )
- {
- /* another of AR5's peculiarities: the selected item of a choice
- field is highlighted using the non stroking color - same as the
- text color. so workaround that by using text rendering mode 2
- (fill, then stroke) and set the stroking color
- */
- appendStrokingColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ), aDA );
- aDA.append( " 2 Tr " );
- }
-#endif
// prepare DA string
appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA );
aDA.append( ' ' );
@@ -6660,7 +6629,7 @@ void PDFWriterImpl::sortWidgets()
{
// sort widget annotations on each page as per their
// TabOrder attribute
- std::hash_map< sal_Int32, AnnotSortContainer > sorted;
+ boost::unordered_map< sal_Int32, AnnotSortContainer > sorted;
int nWidgets = m_aWidgets.size();
for( int nW = 0; nW < nWidgets; nW++ )
{
@@ -6680,7 +6649,7 @@ void PDFWriterImpl::sortWidgets()
}
}
}
- for( std::hash_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it )
+ for( boost::unordered_map< sal_Int32, AnnotSortContainer >::iterator it = sorted.begin(); it != sorted.end(); ++it )
{
// append entries for non widget annotations
PDFPage& rPage = m_aPages[ it->first ];
@@ -7808,7 +7777,6 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa
XubString aLastLine;
ImplMultiTextLineInfo aMultiLineInfo;
ImplTextLineInfo* pLineInfo;
- long nMaxTextWidth;
xub_StrLen i;
xub_StrLen nLines;
xub_StrLen nFormatLines;
@@ -7816,7 +7784,7 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, sa
if ( nTextHeight )
{
::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice );
- nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout );
+ OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout );
nLines = (xub_StrLen)(nHeight/nTextHeight);
nFormatLines = aMultiLineInfo.Count();
if ( !nLines )
@@ -8307,6 +8275,9 @@ void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontSt
void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout )
{
+ //See qadevOOo/testdocs/StrikeThrough.odt for examples if you need
+ //to tweak this
+
String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" );
String aStrikeout = aStrikeoutChar;
while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth )
@@ -8328,7 +8299,27 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
// strikeout string is left aligned non-CTL text
sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode();
m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
+
+ push( PUSH_CLIPREGION );
+ FontMetric aRefDevFontMetric = m_pReferenceDevice->GetFontMetric();
+ Rectangle aRect;
+ aRect.nLeft = rPos.X();
+ aRect.nRight = aRect.nLeft+nWidth;
+ aRect.nBottom = rPos.Y()+aRefDevFontMetric.GetDescent();
+ aRect.nTop = rPos.Y()-aRefDevFontMetric.GetAscent();
+
+ ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry;
+ if (pFontEntry->mnOrientation)
+ {
+ Polygon aPoly( aRect );
+ aPoly.Rotate( rPos, pFontEntry->mnOrientation);
+ aRect = aPoly.GetBoundRect();
+ }
+
+ intersectClipRegion( aRect );
drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false );
+ pop();
+
m_pReferenceDevice->SetLayoutMode( nOrigTLM );
if ( bShadow )
@@ -9316,11 +9307,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
* resource dict anyway, let's use the one from the page by NOT
* emitting a Resources entry.
*/
- #if 0
- aLine.append( " /Resources " );
- aLine.append( getResourceDictObj() );
- aLine.append( " 0 R\n" );
- #endif
aLine.append( "/Length " );
aLine.append( (sal_Int32)(nSize) );
@@ -9395,12 +9381,6 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
aMask.append( "]\n" );
/* #i42884# see above */
-#if 0
- aLine.append( "/Resources " );
- aMask.append( getResourceDictObj() );
- aMask.append( " 0 R\n" );
-#endif
-
aMask.append( "/Group<</S/Transparency/CS/DeviceRGB>>\n" );
aMask.append( "/Length " );
aMask.append( nMaskSize );
@@ -11133,11 +11113,11 @@ sal_Int32 PDFWriterImpl::beginStructureElement( PDFWriter::StructElement eType,
DBG_ASSERT( 0, "Structure element inserted to StructTreeRoot that is not a document" );
}
else {
- DBG_ERROR( "document structure in disorder !" );
+ OSL_FAIL( "document structure in disorder !" );
}
}
else {
- DBG_ERROR( "PDF document structure MUST be contained in a Document element" );
+ OSL_FAIL( "PDF document structure MUST be contained in a Document element" );
}
}
@@ -11255,7 +11235,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle )
addInternalStructureContainer( rChild );//examine the child
else
{
- DBG_ERROR( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" );
+ OSL_FAIL( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it );
#endif
@@ -11264,7 +11244,7 @@ void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle )
}
else
{
- DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" );
+ OSL_FAIL( "PDFWriterImpl::emitStructure: invalid child structure id" );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure id %" SAL_PRIdINT32 "\n", *it );
#endif
@@ -11767,7 +11747,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues()
{
PDFWidget& rGroupWidget = m_aWidgets[ group->second ];
// check whether all kids have a unique OnValue
- std::hash_map< OUString, sal_Int32, OUStringHash > aOnValues;
+ boost::unordered_map< OUString, sal_Int32, OUStringHash > aOnValues;
int nChildren = rGroupWidget.m_aKidsIndex.size();
bool bIsUnique = true;
for( int nKid = 0; nKid < nChildren && bIsUnique; nKid++ )
@@ -11797,7 +11777,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues()
int nKidIndex = rGroupWidget.m_aKidsIndex[nKid];
PDFWidget& rKid = m_aWidgets[nKidIndex];
rKid.m_aOnValue = OUString::valueOf( sal_Int32(nKid+1) );
- if( ! rKid.m_aValue.equalsAscii( "Off" ) )
+ if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) )
rKid.m_aValue = rKid.m_aOnValue;
}
}
@@ -11824,7 +11804,7 @@ void PDFWriterImpl::ensureUniqueRadioOnValues()
#endif
}
// update selected radio button
- if( ! rKid.m_aValue.equalsAscii( "Off" ) )
+ if( ! rKid.m_aValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Off" ) ) )
{
rGroupWidget.m_aValue = rKid.m_aValue;
}
@@ -11958,7 +11938,7 @@ sal_Int32 PDFWriterImpl::createControl( const PDFWriter::AnyWidget& rControl, sa
rNewWidget.m_nTextStyle =
TEXT_DRAW_VCENTER | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK;
- rNewWidget.m_aValue = OUString::createFromAscii( rBox.Checked ? "Yes" : "Off" );
+ rNewWidget.m_aValue = rBox.Checked ? OUString(RTL_CONSTASCII_USTRINGPARAM("Yes")) : OUString(RTL_CONSTASCII_USTRINGPARAM("Off" ));
// create default appearance before m_aRect gets transformed
createDefaultCheckBoxAppearance( rNewWidget, rBox );
}
@@ -12157,3 +12137,4 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 845e95d29270..d6f87f83a006 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,13 +44,14 @@
#include "rtl/digest.h"
#include "com/sun/star/util/XURLTransformer.hpp"
#include "com/sun/star/lang/Locale.hpp"
+#include <sal/macros.h>
#include <sallayout.hxx>
#include "pdffontcache.hxx"
#include <vector>
#include <map>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <list>
#include <boost/shared_array.hpp>
@@ -201,7 +203,7 @@ public:
return *this;
}
- bool operator==( const BitmapID& rComp )
+ bool operator==( const BitmapID& rComp ) const
{
return (m_aPixelSize == rComp.m_aPixelSize &&
m_nSize == rComp.m_nSize &&
@@ -228,7 +230,7 @@ public:
sal_Int32 m_nObject;
bool m_bTrueColor;
- JPGEmit() : m_pStream( NULL ) {}
+ JPGEmit() : m_pStream( NULL ), m_bTrueColor( false ) {}
~JPGEmit() { delete m_pStream; }
};
@@ -293,7 +295,7 @@ public:
GlyphEmit() : m_nUnicodes(0), m_nSubsetGlyphID(0)
{
rtl_zeroMemory( m_aBufferedUnicodes, sizeof( m_aBufferedUnicodes ) );
- m_nMaxUnicodes = sizeof(m_aBufferedUnicodes)/sizeof(m_aBufferedUnicodes[0]);
+ m_nMaxUnicodes = SAL_N_ELEMENTS(m_aBufferedUnicodes);
}
~GlyphEmit()
{
@@ -439,8 +441,8 @@ public:
{}
};
- typedef std::hash_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams;
- typedef std::hash_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap;
+ typedef boost::unordered_map< rtl::OString, SvMemoryStream*, rtl::OStringHash > PDFAppearanceStreams;
+ typedef boost::unordered_map< rtl::OString, PDFAppearanceStreams, rtl::OStringHash > PDFAppearanceMap;
struct PDFWidget : public PDFAnnotation
{
@@ -647,7 +649,7 @@ private:
bool m_bEmitStructure;
bool m_bNewMCID;
/* role map of struct tree root */
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >
+ boost::unordered_map< rtl::OString, rtl::OString, rtl::OStringHash >
m_aRoleMap;
/* contains all widgets used in the PDF
@@ -657,8 +659,8 @@ private:
std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets;
/* used to store control id during beginControlAppearance/endControlAppearance */
sal_Int32 m_nCurrentControl;
- /* hash_map for field names, used to ensure unique field names */
- std::hash_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap;
+ /* boost::unordered_map for field names, used to ensure unique field names */
+ boost::unordered_map< rtl::OString, sal_Int32, rtl::OStringHash > m_aFieldNameMap;
/* contains Bitmaps for gradient functions until they are written
* to the file stream */
@@ -1338,3 +1340,4 @@ public:
#endif //_VCL_PDFEXPORT_HXX
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index b957c57205e8..eae543b1b65d 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -834,7 +834,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
case( META_MASKSCALE_ACTION ):
case( META_MASKSCALEPART_ACTION ):
{
- DBG_ERROR( "MetaMask...Action not supported yet" );
+ OSL_TRACE( "MetaMask...Action not supported yet" );
}
break;
@@ -1066,7 +1066,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
if( !bAssertionFired )
{
bAssertionFired = true;
- DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" );
+ OSL_TRACE( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" );
}
break;
}
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index ac6116e38234..66e3cd1bea1a 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -157,7 +158,6 @@ private:
bool ReadNextChunk();
void ReadRemainingChunks();
- void SkipRemainingChunks();
void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, const BitmapColor & );
void ImplSetPixel( sal_uInt32 y, sal_uInt32 x, sal_uInt8 nPalIndex );
@@ -200,7 +200,9 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mpInflateInBuf ( NULL ),
mpScanPrior ( NULL ),
mpTransTab ( NULL ),
+ mpScanCurrent ( NULL ),
mpColorTable ( (sal_uInt8*) mpDefaultColorTable ),
+ mnPass ( 0 ),
mbzCodecInUse ( sal_False ),
mbStatus( sal_True),
mbIDAT( sal_False ),
@@ -333,30 +335,6 @@ void PNGReaderImpl::ReadRemainingChunks()
// ------------------------------------------------------------------------
-// move position of mrPNGStream to the end of the file
-void PNGReaderImpl::SkipRemainingChunks()
-{
- // nothing to skip if the last chunk was read
- if( !maChunkSeq.empty() && (maChunkSeq.back().nType == PNGCHUNK_IEND) )
- return;
-
- // read from the stream until the IEND chunk is found
- const sal_Size nStreamPos = mrPNGStream.Tell();
- while( !mrPNGStream.IsEof() && (mrPNGStream.GetError() == ERRCODE_NONE) )
- {
- mrPNGStream >> mnChunkLen >> mnChunkType;
- if( mnChunkLen < 0 )
- break;
- if( nStreamPos + mnChunkLen >= mnStreamSize )
- break;
- mrPNGStream.SeekRel( mnChunkLen + 4 ); // skip data + CRC
- if( mnChunkType == PNGCHUNK_IEND )
- break;
- }
-}
-
-// ------------------------------------------------------------------------
-
const std::vector< vcl::PNGReader::ChunkData >& PNGReaderImpl::GetAllChunks()
{
ReadRemainingChunks();
@@ -478,11 +456,6 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
aRet.SetPrefSize( maPhysSize );
}
-#if 0
- // TODO: make sure nobody depends on the stream being after the IEND chunks
- // => let them do ReadChunks before
- ReadRemainingChunks();
-#endif
}
return aRet;
@@ -1587,3 +1560,5 @@ void PNGReader::SetIgnoreGammaChunk( sal_Bool b )
} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index 3d814bea000e..b87457c35054 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -119,7 +120,7 @@ private:
void ImplWriteChunk( sal_uInt8 nNumb );
void ImplWriteChunk( sal_uInt32 nNumb );
void ImplWriteChunk( unsigned char* pSource, sal_uInt32 nDatSize );
- void ImplCloseChunk( void );
+ void ImplCloseChunk( void ) const;
};
// ------------------------------------------------------------------------
@@ -148,11 +149,11 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
sal_Int32 i = 0;
for ( i = 0; i < pFilterData->getLength(); i++ )
{
- if ( (*pFilterData)[ i ].Name.equalsAscii( "Compression" ) )
+ if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Compression" ) ) )
(*pFilterData)[ i ].Value >>= mnCompLevel;
- else if ( (*pFilterData)[ i ].Name.equalsAscii( "Interlaced" ) )
+ else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Interlaced" ) ) )
(*pFilterData)[ i ].Value >>= mnInterlaced;
- else if ( (*pFilterData)[ i ].Name.equalsAscii( "MaxChunkSize" ) )
+ else if ( (*pFilterData)[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxChunkSize" ) ) )
{
sal_Int32 nVal = 0;
if ( (*pFilterData)[ i ].Value >>= nVal )
@@ -698,7 +699,7 @@ void PNGWriterImpl::ImplWriteChunk ( unsigned char* pSource, sal_uInt32 nDatSize
// ------------------------------------------------------------------------
// nothing to do
-void PNGWriterImpl::ImplCloseChunk ( void )
+void PNGWriterImpl::ImplCloseChunk ( void ) const
{
}
@@ -735,3 +736,4 @@ std::vector< vcl::PNGWriter::ChunkData >& PNGWriter::GetChunks()
} // namespace vcl
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 9d8bee00ef24..4c9461fbcb97 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -339,7 +340,7 @@ ImplPrnQueueList::~ImplPrnQueueList()
void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData )
{
- std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it =
+ boost::unordered_map< rtl::OUString, sal_Int32, rtl::OUStringHash >::iterator it =
m_aNameToIndex.find( pData->maPrinterName );
if( it == m_aNameToIndex.end() )
{
@@ -364,7 +365,7 @@ void ImplPrnQueueList::Add( SalPrinterQueueInfo* pData )
ImplPrnQueueData* ImplPrnQueueList::Get( const rtl::OUString& rPrinter )
{
ImplPrnQueueData* pData = NULL;
- std::hash_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it =
+ boost::unordered_map<rtl::OUString,sal_Int32,rtl::OUStringHash>::iterator it =
m_aNameToIndex.find( rPrinter );
if( it != m_aNameToIndex.end() )
pData = &m_aQueueInfos[it->second];
@@ -1285,7 +1286,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper )
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->mpPaperNames )
{
- pSVData->mpPaperNames = new std::hash_map< int, rtl::OUString >();
+ pSVData->mpPaperNames = new boost::unordered_map< int, rtl::OUString >();
if( ImplGetResMgr() )
{
ResStringArray aPaperStrings( VclResId( RID_STR_PAPERNAMES ) );
@@ -1305,7 +1306,7 @@ rtl::OUString Printer::GetPaperName( Paper ePaper )
}
}
- std::hash_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper );
+ boost::unordered_map<int,rtl::OUString>::const_iterator it = pSVData->mpPaperNames->find( (int)ePaper );
return (it != pSVData->mpPaperNames->end()) ? it->second : rtl::OUString();
}
@@ -1626,3 +1627,5 @@ void Printer::updatePrinters()
delete pNewList;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 59b79c64a13c..5a23eb406bc3 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -218,7 +219,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
case META_TRANSPARENT_ACTION:
default:
- DBG_ERROR("Printer::GetPreparedMetafile impossible state reached");
+ OSL_FAIL("Printer::GetPreparedMetafile impossible state reached");
break;
}
@@ -288,7 +289,7 @@ static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
static_cast<const MetaRenderGraphicAction&>(rAct).GetSize(),
aBmp ));
default:
- DBG_ERROR("Unexpected case");
+ OSL_FAIL("Unexpected case");
break;
}
}
@@ -651,7 +652,7 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
break;
case META_TEXTLINE_ACTION:
- DBG_ERROR("META_TEXTLINE_ACTION not supported");
+ OSL_FAIL("META_TEXTLINE_ACTION not supported");
break;
case( META_RENDERGRAPHIC_ACTION ):
@@ -1620,3 +1621,5 @@ void Printer::DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly,
else
pOut->DrawGradient( rPolyPoly, rGradient );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 3bc47e6cf8fb..0e99923ccc0f 100755..100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,8 +51,8 @@
#include "com/sun/star/awt/Size.hpp"
#include "comphelper/processfactory.hxx"
-#include <hash_map>
-#include <hash_set>
+#include <boost/unordered_map.hpp>
+#include <boost/unordered_set.hpp>
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -76,13 +77,8 @@ class ImplPageCache
{
if( maCacheRanking[0] != nLastHit )
{
- bool bMove = false;
for( sal_Int32 i = nCacheSize-1; i > 0; i-- )
- {
- if( maCacheRanking[i] == nLastHit )
- bMove = true;
maCacheRanking[i] = maCacheRanking[i-1];
- }
maCacheRanking[0] = nLastHit;
}
}
@@ -149,9 +145,9 @@ public:
ControlDependency() : mnDependsOnEntry( -1 ) {}
};
- typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap;
- typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap;
- typedef std::hash_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap;
+ typedef boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap;
+ typedef boost::unordered_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap;
+ typedef boost::unordered_map< rtl::OUString, Sequence< sal_Bool >, rtl::OUStringHash > ChoiceDisableMap;
boost::shared_ptr<Printer> mpPrinter;
Sequence< PropertyValue > maUIOptions;
@@ -775,21 +771,21 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
sal_Int32 nPaperBin = mnDefaultPaperBin;
for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty )
{
- if( i_rProps[ nProperty ].Name.equalsAscii( "PreferredPageSize" ) )
+ if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredPageSize" ) ) )
{
i_rProps[ nProperty ].Value >>= aSetSize;
}
- else if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) )
+ else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageSize" ) ) )
{
i_rProps[ nProperty ].Value >>= aIsSize;
}
- else if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) )
+ else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PageIncludesNonprintableArea" ) ) )
{
sal_Bool bVal = sal_False;
i_rProps[ nProperty ].Value >>= bVal;
aPageSize.bFullPaper = static_cast<bool>(bVal);
}
- else if( i_rProps[ nProperty ].Name.equalsAscii( "PrinterPaperTray" ) )
+ else if( i_rProps[ nProperty ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrinterPaperTray" ) ) )
{
sal_Int32 nBin = -1;
i_rProps[ nProperty ].Value >>= nBin;
@@ -1235,7 +1231,7 @@ bool PrinterController::getReversePrint() const
Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const
{
- std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet;
+ boost::unordered_set< rtl::OUString, rtl::OUStringHash > aMergeSet;
size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3;
for( int i = 0; i < i_rMergeList.getLength(); i++ )
aMergeSet.insert( i_rMergeList[i].Name );
@@ -1284,14 +1280,14 @@ const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const
beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty )
{
- std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
mpImplData->maPropertyToIndex.find( i_rProperty );
return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL;
}
const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const
{
- std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
mpImplData->maPropertyToIndex.find( i_rProperty );
return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL;
}
@@ -1321,7 +1317,7 @@ void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rVa
void PrinterController::setValue( const beans::PropertyValue& i_rValue )
{
- std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
mpImplData->maPropertyToIndex.find( i_rValue.Name );
if( it != mpImplData->maPropertyToIndex.end() )
mpImplData->maUIProperties[ it->second ] = i_rValue;
@@ -1352,7 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
for( int n = 0; n < aOptProp.getLength(); n++ )
{
const beans::PropertyValue& rEntry( aOptProp[ n ] );
- if( rEntry.Name.equalsAscii( "Property" ) )
+ if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) )
{
PropertyValue aVal;
rEntry.Value >>= aVal;
@@ -1362,17 +1358,17 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
aPropName = aVal.Name;
bHaveProperty = true;
}
- else if( rEntry.Name.equalsAscii( "Enabled" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) )
{
sal_Bool bValue = sal_True;
rEntry.Value >>= bValue;
bIsEnabled = bValue;
}
- else if( rEntry.Name.equalsAscii( "DependsOnName" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) )
{
rEntry.Value >>= aDep.maDependsOnName;
}
- else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) )
{
rEntry.Value >>= aDep.mnDependsOnEntry;
}
@@ -1400,7 +1396,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable )
{
- std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it =
mpImplData->maPropertyToIndex.find( i_rProperty );
if( it != mpImplData->maPropertyToIndex.end() )
{
@@ -1418,7 +1414,7 @@ void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i
bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const
{
bool bEnabled = false;
- std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it =
+ boost::unordered_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it =
mpImplData->maPropertyToIndex.find( i_rProperty );
if( prop_it != mpImplData->maPropertyToIndex.end() )
{
@@ -1458,7 +1454,7 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co
else
{
// if the type does not match something is awry
- OSL_ENSURE( 0, "strange type in control dependency" );
+ OSL_FAIL( "strange type in control dependency" );
bEnabled = false;
}
}
@@ -1526,7 +1522,7 @@ rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty )
else
{
// if the type does not match something is awry
- OSL_ENSURE( 0, "strange type in control dependency" );
+ OSL_FAIL( "strange type in control dependency" );
}
}
}
@@ -1639,7 +1635,7 @@ sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, s
Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const
{
Any aRet;
- std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
m_aPropertyMap.find( i_rPropertyName );
if( it != m_aPropertyMap.end() )
aRet = it->second;
@@ -1654,7 +1650,7 @@ void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const
bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const
{
Any aRet;
- std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
+ boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it =
m_aPropertyMap.find( i_rPropertyName );
return it != m_aPropertyMap.end();
}
@@ -1694,7 +1690,7 @@ bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i
for( sal_Int32 i = 0; i < nElements; i++ )
{
bool bElementChanged = false;
- std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it =
+ boost::unordered_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it =
m_aPropertyMap.find( pVals[ i ].Name );
if( it != m_aPropertyMap.end() )
{
@@ -1945,3 +1941,5 @@ Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle,
i_rControlOptions
);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx
index 08c94bc2ebc6..21c82cd51f3a 100644
--- a/vcl/source/gdi/regband.cxx
+++ b/vcl/source/gdi/regband.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -967,3 +968,5 @@ ImplRegionBand* ImplRegionBand::SplitBand (const sal_Int32 nY)
return pLowerBand;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index fe2e0f763e08..3992b774630d 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,10 +34,8 @@
#include <tools/vcompat.hxx>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
-
#include <vcl/region.hxx>
#include <vcl/regband.hxx>
-#include <vcl/salbtype.hxx>
#include <region.h>
@@ -660,7 +659,7 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID,
mpLastCheckedBand = mpLastCheckedBand->mpNextBand;
}
- DBG_ERROR( "ImplRegion::InsertPoint reached the end of the list!" );
+ OSL_FAIL( "ImplRegion::InsertPoint reached the end of the list!" );
}
else
{
@@ -677,10 +676,10 @@ sal_Bool ImplRegion::InsertPoint( const Point &rPoint, long nLineID,
mpLastCheckedBand = mpLastCheckedBand->mpPrevBand;
}
- DBG_ERROR( "ImplRegion::InsertPoint reached the beginning of the list!" );
+ OSL_FAIL( "ImplRegion::InsertPoint reached the beginning of the list!" );
}
- DBG_ERROR( "ImplRegion::InsertPoint point not inserted!" );
+ OSL_FAIL( "ImplRegion::InsertPoint point not inserted!" );
// reinitialize pointer (should never be reached!)
mpLastCheckedBand = mpFirstBand;
@@ -893,7 +892,7 @@ void ImplRegion::Union( long nLeft, long nTop, long nRight, long nBottom )
{
if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
{
- DBG_ERROR( "ImplRegion::Union() - Bands not sorted!" );
+ OSL_FAIL( "ImplRegion::Union() - Bands not sorted!" );
}
pBand = pBand->mpNextBand;
}
@@ -930,7 +929,7 @@ void ImplRegion::Exclude( long nLeft, long nTop, long nRight, long nBottom )
{
if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
{
- DBG_ERROR( "ImplRegion::Exclude() - Bands not sorted!" );
+ OSL_FAIL( "ImplRegion::Exclude() - Bands not sorted!" );
}
pBand = pBand->mpNextBand;
}
@@ -967,7 +966,7 @@ void ImplRegion::XOr( long nLeft, long nTop, long nRight, long nBottom )
{
if ( (pBand->mnYTop < nCurY) || (pBand->mnYBottom < nCurY) )
{
- DBG_ERROR( "ImplRegion::XOr() - Bands not sorted!" );
+ OSL_FAIL( "ImplRegion::XOr() - Bands not sorted!" );
}
pBand = pBand->mpNextBand;
}
@@ -1058,12 +1057,12 @@ sal_Bool ImplRegion::OptimizeBandList()
"Exiting ImplRegion::OptimizeBandList(): empty band in region!" );
if ( pBand->mnYBottom < pBand->mnYTop )
- DBG_ERROR( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" );
+ OSL_FAIL( "ImplRegion::OptimizeBandList(): YBottomBoundary < YTopBoundary" );
if ( pBand->mpNextBand )
{
if ( pBand->mnYBottom >= pBand->mpNextBand->mnYTop )
- DBG_ERROR( "ImplRegion::OptimizeBandList(): overlapping bands in region!" );
+ OSL_FAIL( "ImplRegion::OptimizeBandList(): overlapping bands in region!" );
}
pBand = pBand->mpNextBand;
@@ -2654,7 +2653,7 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion )
if( rIStrm.IsEof() )
{
- DBG_ERROR( "premature end of region stream" );
+ OSL_FAIL( "premature end of region stream" );
delete rRegion.mpImplRegion;
rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion;
return rIStrm;
@@ -3102,3 +3101,5 @@ Region Region::GetRegionFromPolyPolygon( const PolyPolygon& rPolyPoly )
}
return aResult;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 0b6677b2426f..bf0f7523a453 100755..100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -827,3 +828,4 @@ void SalGraphics::AddDevFontSubstitute( OutputDevice* pOutDev,
pOutDev->ImplAddDevFontSubstitute( rFontName, rReplaceFontName, nFlags );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 3a2251da5d84..9679170df9b9 100755..100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,7 +37,6 @@
#include <salgdi.hxx>
#include <sallayout.hxx>
-
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -97,11 +97,6 @@ bool IsDiacritic( sal_UCS4 nChar )
{0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8},
{0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF},
{0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4},
-#if 0 // all known fonts have zero-width diacritics already, so no need to query it
- {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958},
- {0x0980, 0x0985}, {0x09BC, 0x09BD}, {0x09C1, 0x09C7}, {0x09CD, 0x09CE}, {0x09E2, 0x09E6},
- {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //...
-#endif
{0x1DC0, 0x1E00},
{0x205F, 0x2070}, {0x20D0, 0x2100},
{0xFB1E, 0xFB1F}
@@ -152,48 +147,6 @@ int GetVerticalFlags( sal_UCS4 nChar )
sal_UCS4 GetVerticalChar( sal_UCS4 )
{
return 0; // #i14788# input method is responsible vertical char changes
-
-#if 0
- int nVert = 0;
- switch( nChar )
- {
- // #104627# special treatment for some unicodes
- case 0x002C: nVert = 0x3001; break;
- case 0x002E: nVert = 0x3002; break;
- /*
- // to few fonts have the compatibility forms, using
- // them will then cause more trouble than good
- // TODO: decide on a font specific basis
- case 0x2018: nVert = 0xFE41; break;
- case 0x2019: nVert = 0xFE42; break;
- case 0x201C: nVert = 0xFE43; break;
- case 0x201D: nVert = 0xFE44; break;
- // CJK compatibility forms
- case 0x2025: nVert = 0xFE30; break;
- case 0x2014: nVert = 0xFE31; break;
- case 0x2013: nVert = 0xFE32; break;
- case 0x005F: nVert = 0xFE33; break;
- case 0x0028: nVert = 0xFE35; break;
- case 0x0029: nVert = 0xFE36; break;
- case 0x007B: nVert = 0xFE37; break;
- case 0x007D: nVert = 0xFE38; break;
- case 0x3014: nVert = 0xFE39; break;
- case 0x3015: nVert = 0xFE3A; break;
- case 0x3010: nVert = 0xFE3B; break;
- case 0x3011: nVert = 0xFE3C; break;
- case 0x300A: nVert = 0xFE3D; break;
- case 0x300B: nVert = 0xFE3E; break;
- case 0x3008: nVert = 0xFE3F; break;
- case 0x3009: nVert = 0xFE40; break;
- case 0x300C: nVert = 0xFE41; break;
- case 0x300D: nVert = 0xFE42; break;
- case 0x300E: nVert = 0xFE43; break;
- case 0x300F: nVert = 0xFE44; break;
- */
- }
-
- return nVert;
-#endif
}
// -----------------------------------------------------------------------
@@ -370,17 +323,6 @@ sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang )
case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY:
nOffset = 0x0F20 - '0'; // tibetan
break;
-#if 0 // TODO: use language type for these digit substitutions?
- // TODO case:
- nOffset = 0x2776 - '0'; // dingbat circled
- break;
- // TODO case:
- nOffset = 0x2070 - '0'; // superscript
- break;
- // TODO case:
- nOffset = 0x2080 - '0'; // subscript
- break;
-#endif
}
nChar += nOffset;
@@ -839,12 +781,6 @@ int SalLayout::CalcAsianKerning( sal_UCS4 c, bool bLeft, bool /*TODO:? bVertical
nResult = nTable[ c - 0x3000 ];
else switch( c )
{
-#if 0 // TODO: enable it for real-fixed-width fonts?
- case ':': case ';': case '!':
- if( !bVertical )
- nResult = bLeft ? -1 : +1; // 25% left and right
- break;
-#endif
case 0x30FB:
nResult = bLeft ? -1 : +1; // 25% left/right/top/bottom
break;
@@ -950,10 +886,6 @@ bool SalLayout::IsSpacingGlyph( sal_GlyphId nGlyph ) const
const ImplFontData* SalLayout::GetFallbackFontData( sal_GlyphId /*nGlyphId*/ ) const
{
-#if 0
- int nFallbackLevel = (nGlyphId & GF_FONTMASK) >> GF_FONTSHIFT
- assert( nFallbackLevel == 0 );
-#endif
return NULL;
}
@@ -2321,3 +2253,5 @@ bool MultiSalLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rRect ) co
}
// =======================================================================
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx
index d1cf56f6a044..d2b794af02d6 100644
--- a/vcl/source/gdi/salmisc.cxx
+++ b/vcl/source/gdi/salmisc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -212,7 +213,7 @@ static void ImplTCToTC( const BitmapBuffer& rSrcBuffer, BitmapBuffer& rDstBuffer
if( BMP_SCANLINE_FORMAT( rSrcBuffer.mnFormat ) == BMP_FORMAT_24BIT_TC_BGR )
{
BitmapColor aCol;
- sal_uInt8* pPixel;
+ sal_uInt8* pPixel = NULL;
for( long nActY = 0, nMapY; nActY < nHeight; nActY++ )
{
@@ -325,7 +326,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec
// initialize pFncGetPixel to something valid that is
// least likely to crash
pFncGetPixel = BitmapReadAccess::GetPixelFor_1BIT_MSB_PAL;
- DBG_ERROR( "unknown read format" );
+ OSL_FAIL( "unknown read format" );
break;
}
@@ -356,7 +357,7 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec
// least likely to crash
pFncSetPixel = BitmapReadAccess::SetPixelFor_1BIT_MSB_PAL;
pDstBuffer->mnBitCount = 1;
- DBG_ERROR( "unknown write format" );
+ OSL_FAIL( "unknown write format" );
break;
}
@@ -514,3 +515,5 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec
return pDstBuffer;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/salnativewidgets-none.cxx b/vcl/source/gdi/salnativewidgets-none.cxx
index 50048831f3b3..8f50802c9431 100644
--- a/vcl/source/gdi/salnativewidgets-none.cxx
+++ b/vcl/source/gdi/salnativewidgets-none.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,7 @@
#include <salgdi.hxx>
-using namespace rtl;
+using ::rtl::OUString;
/****************************************************************
* Placeholder for no native widgets
@@ -132,3 +133,4 @@ sal_Bool SalGraphics::getNativeControlRegion( ControlType,
return( sal_False );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index fa674d1a712b..e1a2667a8f58 100755..100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -227,7 +228,7 @@ namespace vcl
aTrace.append( ", " );
}
aTrace.append( ")" );
- OSL_TRACE( aTrace.makeStringAndClear().getStr() );
+ OSL_TRACE( "%s", aTrace.makeStringAndClear().getStr() );
}
#endif
return nTextWidth;
@@ -385,3 +386,5 @@ namespace vcl
//........................................................................
} // namespace vcl
//........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index cfea7205ee34..5e693d23abf5 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -139,7 +140,7 @@ VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
{
- DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+ OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
}
@@ -150,7 +151,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
{
- DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+ OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
}
@@ -161,7 +162,7 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
{
- DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+ OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
@@ -175,7 +176,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
{
- DBG_TRACE1( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
+ OSL_TRACE( "VirtualDevice::VirtualDevice( %hu )", nBitCount );
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData );
}
@@ -184,7 +185,7 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo
VirtualDevice::~VirtualDevice()
{
- DBG_TRACE( "VirtualDevice::~VirtualDevice()" );
+ OSL_TRACE( "VirtualDevice::~VirtualDevice()" );
ImplSVData* pSVData = ImplGetSVData();
@@ -209,7 +210,7 @@ VirtualDevice::~VirtualDevice()
sal_Bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, sal_Bool bErase )
{
- DBG_TRACE3( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase );
+ OSL_TRACE( "VirtualDevice::ImplSetOutputSizePixel( %ld, %ld, %d )", rNewSize.Width(), rNewSize.Height(), (int)bErase );
if ( !mpVirDev )
return sal_False;
@@ -446,3 +447,4 @@ void VirtualDevice::Compat_ZeroExtleadBug()
// -----------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index aa7c421dbc65..a24d3b0cbd66 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -640,3 +641,5 @@ SvStream& operator<<( SvStream& rOStm, const Wallpaper& rWallpaper )
{
return( rOStm << *rWallpaper.mpImplWallpaper );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index fc23dba23bfb..c2b84a8e94a7 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,6 +41,11 @@
#include "outfont.hxx"
#include "impfont.hxx"
+#ifdef ENABLE_GRAPHITE
+#include <graphite2/Font.h>
+#include "vcl/graphite_layout.hxx"
+#endif
+
#include "tools/poly.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
#include "basegfx/matrix/b2dhommatrixtools.hxx"
@@ -48,6 +54,8 @@
#include "osl/file.hxx"
#include "osl/thread.hxx"
+#include "sft.hxx"
+
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
@@ -78,10 +86,8 @@ typedef FT_Vector* FT_Vector_CPtr;
// TODO: move file mapping stuff to OSL
#if defined(UNX)
- #if !defined(HPUX)
- // PORTERS: dlfcn is used for getting symbols from FT versions newer than baseline
- #include <dlfcn.h>
- #endif
+ // PORTERS: dlfcn is used for getting symbols from FT versions newer than baseline
+ #include <dlfcn.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -136,7 +142,8 @@ FT_Error (*pFTOblique)(FT_GlyphSlot);
static bool bEnableSizeFT = false;
struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } };
-typedef ::std::hash_map<const char*,FtFontFile*,::std::hash<const char*>, EqStr> FontFileList;
+struct HashStr { size_t operator()( const char* s ) const { return rtl_str_hashCode(s); } };
+typedef ::boost::unordered_map<const char*,boost::shared_ptr<FtFontFile>,HashStr, EqStr> FontFileList;
namespace { struct vclFontFileList : public rtl::Static< FontFileList, vclFontFileList > {}; }
// -----------------------------------------------------------------------
@@ -211,12 +218,12 @@ FtFontFile* FtFontFile::FindFontFile( const ::rtl::OString& rNativeFileName )
FontFileList &rFontFileList = vclFontFileList::get();
FontFileList::const_iterator it = rFontFileList.find( pFileName );
if( it != rFontFileList.end() )
- return (*it).second;
+ return it->second.get();
// no => create new one
FtFontFile* pFontFile = new FtFontFile( rNativeFileName );
pFileName = pFontFile->maNativeFileName.getStr();
- rFontFileList[ pFileName ] = pFontFile;
+ rFontFileList[pFileName].reset(pFontFile);
return pFontFile;
}
@@ -289,6 +296,33 @@ void FtFontFile::Unmap()
mpFileMap = NULL;
}
+#ifdef ENABLE_GRAPHITE
+// wrap FtFontInfo's table function
+const void * graphiteFontTable(const void* appFaceHandle, unsigned int name, size_t *len)
+{
+ const FtFontInfo * pFontInfo = reinterpret_cast<const FtFontInfo*>(appFaceHandle);
+ typedef union {
+ char m_c[5];
+ unsigned int m_id;
+ } TableId;
+ TableId tableId;
+ tableId.m_id = name;
+#ifndef WORDS_BIGENDIAN
+ TableId swapped;
+ swapped.m_c[3] = tableId.m_c[0];
+ swapped.m_c[2] = tableId.m_c[1];
+ swapped.m_c[1] = tableId.m_c[2];
+ swapped.m_c[0] = tableId.m_c[3];
+ tableId.m_id = swapped.m_id;
+#endif
+ tableId.m_c[4] = '\0';
+ sal_uLong nLength = 0;
+ const void * pTable = static_cast<const void*>(pFontInfo->GetTable(tableId.m_c, &nLength));
+ if (len) *len = static_cast<size_t>(nLength);
+ return pTable;
+}
+#endif
+
// =======================================================================
FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
@@ -300,6 +334,10 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
mnFaceNum( nFaceNum ),
mnRefCount( 0 ),
mnSynthetic( nSynthetic ),
+#ifdef ENABLE_GRAPHITE
+ mbCheckedGraphite(false),
+ mpGraphiteFace(NULL),
+#endif
mnFontId( nFontId ),
maDevFontAttributes( rDevFontAttributes ),
mpFontCharMap( NULL ),
@@ -325,6 +363,10 @@ FtFontInfo::~FtFontInfo()
delete mpExtraKernInfo;
delete mpChar2Glyph;
delete mpGlyph2Char;
+#ifdef ENABLE_GRAPHITE
+ if (mpGraphiteFace)
+ delete mpGraphiteFace;
+#endif
}
void FtFontInfo::InitHashes() const
@@ -353,6 +395,30 @@ FT_FaceRec_* FtFontInfo::GetFaceFT()
return maFaceFT;
}
+#ifdef ENABLE_GRAPHITE
+GraphiteFaceWrapper * FtFontInfo::GetGraphiteFace()
+{
+ if (mbCheckedGraphite)
+ return mpGraphiteFace;
+ // test for graphite here so that it is cached most efficiently
+ if (GetTable("Silf", 0))
+ {
+ int graphiteSegCacheSize = 10000;
+ static const char* pGraphiteCacheStr = getenv( "SAL_GRAPHITE_CACHE_SIZE" );
+ graphiteSegCacheSize = pGraphiteCacheStr ? (atoi(pGraphiteCacheStr)) : 0;
+ gr_face * pGraphiteFace;
+ if (graphiteSegCacheSize > 500)
+ pGraphiteFace = gr_make_face_with_seg_cache(this, graphiteFontTable, graphiteSegCacheSize, gr_face_cacheCmap);
+ else
+ pGraphiteFace = gr_make_face(this, graphiteFontTable, gr_face_cacheCmap);
+ if (pGraphiteFace)
+ mpGraphiteFace = new GraphiteFaceWrapper(pGraphiteFace);
+ }
+ mbCheckedGraphite = true;
+ return mpGraphiteFace;
+}
+#endif
+
// -----------------------------------------------------------------------
void FtFontInfo::ReleaseFaceFT( FT_FaceRec_* pFaceFT )
@@ -508,6 +574,7 @@ FreetypeManager::FreetypeManager()
nDefaultPrioAutoHint = pEnv[0] - '0';
InitGammaTable();
+ vclFontFileList::get();
}
// -----------------------------------------------------------------------
@@ -524,25 +591,11 @@ void* FreetypeServerFont::GetFtFace() const
FreetypeManager::~FreetypeManager()
{
- // an application about to exit can omit garbage collecting the heap
- // since it makes things slower and introduces risks if the heap was not perfect
- // for debugging, for memory grinding or leak checking the env allows to force GC
- const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" );
- if( pEnv && (*pEnv != '0') )
- {
- // cleanup container of fontinfos
- for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it )
- {
- FtFontInfo* pInfo = (*it).second;
- delete pInfo;
- }
- maFontList.clear();
-
-#if 0 // FT_Done_FreeType crashes on Solaris 10
- // TODO: check which versions have this problem
- FT_Error rcFT = FT_Done_FreeType( aLibFT );
-#endif
- }
+ ClearFontList();
+// This crashes on Solaris 10
+// TODO: check which versions have this problem
+//
+// FT_Error rcFT = FT_Done_FreeType( aLibFT );
}
// -----------------------------------------------------------------------
@@ -608,7 +661,7 @@ long FreetypeManager::AddFontDir( const String& rUrlName )
aDFA.maName = String::CreateFromAscii( aFaceFT->family_name );
if ( aFaceFT->style_name )
- aDFA.maStyleName = String::CreateFromAscii( aFaceFT->style_name );
+ aDFA.maStyleName = String::CreateFromAscii( aFaceFT->style_name );
aDFA.mbSymbolFlag = false;
for( int i = aFaceFT->num_charmaps; --i >= 0; )
@@ -725,11 +778,6 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
{
maFaceFT = pFI->GetFaceFT();
-#ifdef HDU_DEBUG
- fprintf( stderr, "FTSF::FTSF(\"%s\", h=%d, w=%d, sy=%d) => %d\n",
- pFI->GetFontFileName()->getStr(), rFSD.mnHeight, rFSD.mnWidth, pFI->IsSymbolFont(), maFaceFT!=0 );
-#endif
-
if( !maFaceFT )
return;
@@ -869,9 +917,14 @@ FreetypeServerFont::FreetypeServerFont( const ImplFontSelectData& rFSD, FtFontIn
mnLoadFlags |= FT_LOAD_NO_BITMAP;
}
-void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
+void FreetypeServerFont::SetFontOptions( boost::shared_ptr<ImplFontOptions> pFontOptions)
{
- FontAutoHint eHint = rFontOptions.GetUseAutoHint();
+ mpFontOptions = pFontOptions;
+
+ if (!mpFontOptions)
+ return;
+
+ FontAutoHint eHint = mpFontOptions->GetUseAutoHint();
if( eHint == AUTOHINT_DONTKNOW )
eHint = mbUseGamma ? AUTOHINT_TRUE : AUTOHINT_FALSE;
@@ -882,11 +935,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
mnLoadFlags |= FT_LOAD_NO_HINTING;
mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334#
- if( rFontOptions.DontUseAntiAlias() )
+ if( mpFontOptions->DontUseAntiAlias() )
mnPrioAntiAlias = 0;
- if( rFontOptions.DontUseEmbeddedBitmaps() )
+ if( mpFontOptions->DontUseEmbeddedBitmaps() )
mnPrioEmbedded = 0;
- if( rFontOptions.DontUseHinting() )
+ if( mpFontOptions->DontUseHinting() )
mnPrioAutoHint = 0;
#if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
@@ -898,7 +951,7 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103))
{
mnLoadFlags |= FT_LOAD_TARGET_NORMAL;
- switch( rFontOptions.GetHintStyle() )
+ switch( mpFontOptions->GetHintStyle() )
{
case HINT_NONE:
mnLoadFlags |= FT_LOAD_NO_HINTING;
@@ -919,6 +972,11 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
mnLoadFlags |= FT_LOAD_NO_BITMAP;
}
+boost::shared_ptr<ImplFontOptions> FreetypeServerFont::GetFontOptions() const
+{
+ return mpFontOptions;
+}
+
// -----------------------------------------------------------------------
bool FreetypeServerFont::TestFont() const
@@ -1228,11 +1286,6 @@ int FreetypeServerFont::GetRawGlyphIndex( sal_UCS4 aChar ) const
// check if symbol aliasing helps
if( (aChar <= 0x00FF) && mpFontInfo->IsSymbolFont() )
nGlyphIndex = FT_Get_Char_Index( maFaceFT, aChar | 0xF000 );
-#if 0 // disabled for now because it introduced ae bad side-effect (#i88376#)
- // Finally try the postscript name table
- if (!nGlyphIndex)
- nGlyphIndex = psp::PrintFontManager::get().FreeTypeCharIndex( maFaceFT, aChar );
-#endif
}
mpFontInfo->CacheGlyphIndex( aChar, nGlyphIndex );
}
@@ -1270,17 +1323,6 @@ int FreetypeServerFont::FixupGlyphIndex( int nGlyphIndex, sal_UCS4 aChar ) const
}
}
-#if 0
- // #95556# autohinting not yet optimized for non-western glyph styles
- if( !(mnLoadFlags & (FT_LOAD_NO_HINTING | FT_LOAD_FORCE_AUTOHINT) )
- && ( (aChar >= 0x0600 && aChar < 0x1E00) // south-east asian + arabic
- ||(aChar >= 0x2900 && aChar < 0xD800) // CJKV
- ||(aChar >= 0xF800) ) ) // presentation + symbols
- {
- nGlyphFlags |= GF_UNHINTED;
- }
-#endif
-
if( nGlyphIndex != 0 )
nGlyphIndex |= nGlyphFlags;
@@ -1825,6 +1867,29 @@ bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
return true;
}
+bool FreetypeServerFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
+{
+ bool bRet = false;
+
+ sal_uLong nLength = 0;
+ // load GSUB table
+ const FT_Byte* pGSUB = mpFontInfo->GetTable("GSUB", &nLength);
+ if (pGSUB)
+ vcl::getTTScripts(rFontCapabilities.maGSUBScriptTags, pGSUB, nLength);
+
+ // load OS/2 table
+ const FT_Byte* pOS2 = mpFontInfo->GetTable("OS/2", &nLength);
+ if (pOS2)
+ {
+ bRet = vcl::getTTCoverage(
+ rFontCapabilities.maUnicodeRange,
+ rFontCapabilities.maCodePageRange,
+ pOS2, nLength);
+ }
+
+ return bRet;
+}
+
// -----------------------------------------------------------------------
// kerning stuff
// -----------------------------------------------------------------------
@@ -2058,7 +2123,7 @@ sal_uLong FreetypeServerFont::GetKernPairs( ImplKernPairData** ppKernPairs ) con
// prepare glyphindex to character mapping
// TODO: this is needed to support VCL's existing kerning infrastructure,
// eliminate it up by redesigning kerning infrastructure to work with glyph indizes
- typedef std::hash_multimap<sal_uInt16,sal_Unicode> Cmap;
+ typedef boost::unordered_multimap<sal_uInt16,sal_Unicode> Cmap;
Cmap aCmap;
for( sal_Unicode aChar = 0x0020; aChar < 0xFFFE; ++aChar )
{
@@ -2147,6 +2212,7 @@ PolyArgs::PolyArgs( PolyPolygon& rPolyPoly, sal_uInt16 nMaxPoints )
mnMaxPoints(nMaxPoints),
mnPoints(0),
mnPoly(0),
+ mnHeight(0),
bHasOffline(false)
{
mpPointAry = new Point[ mnMaxPoints ];
@@ -2600,3 +2666,4 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD )
// =======================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx
index 747219451b64..9cbe49cd495e 100644
--- a/vcl/source/glyphs/gcach_ftyp.hxx
+++ b/vcl/source/glyphs/gcach_ftyp.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,6 +36,10 @@
#include FT_FREETYPE_H
class FreetypeServerFont;
+#ifdef ENABLE_GRAPHITE
+class GraphiteFaceWrapper;
+#endif
+
struct FT_GlyphRec_;
// -----------------------------------------------------------------------
@@ -80,6 +85,9 @@ public:
const unsigned char* GetTable( const char*, sal_uLong* pLength=0 ) const;
FT_FaceRec_* GetFaceFT();
+#ifdef ENABLE_GRAPHITE
+ GraphiteFaceWrapper* GetGraphiteFace();
+#endif
void ReleaseFaceFT( FT_FaceRec_* );
const ::rtl::OString* GetFontFileName() const { return mpFontFile->GetFileName(); }
@@ -107,15 +115,18 @@ private:
const int mnFaceNum;
int mnRefCount;
const int mnSynthetic;
-
+#ifdef ENABLE_GRAPHITE
+ bool mbCheckedGraphite;
+ GraphiteFaceWrapper * mpGraphiteFace;
+#endif
sal_IntPtr mnFontId;
ImplDevFontAttributes maDevFontAttributes;
const ImplFontCharMap* mpFontCharMap;
// cache unicode->glyphid mapping because looking it up is expensive
- // TODO: change to hash_multimap when a use case requires a m:n mapping
- typedef ::std::hash_map<int,int> Int2IntMap;
+ // TODO: change to boost::unordered_multimap when a use case requires a m:n mapping
+ typedef ::boost::unordered_map<int,int> Int2IntMap;
mutable Int2IntMap* mpChar2Glyph;
mutable Int2IntMap* mpGlyph2Char;
void InitHashes() const;
@@ -161,7 +172,7 @@ public:
FreetypeServerFont* CreateFont( const ImplFontSelectData& );
private:
- typedef ::std::hash_map<sal_IntPtr,FtFontInfo*> FontList;
+ typedef ::boost::unordered_map<sal_IntPtr,FtFontInfo*> FontList;
FontList maFontList;
sal_IntPtr mnMaxFontId;
@@ -180,7 +191,8 @@ public:
virtual int GetFontFaceNum() const { return mpFontInfo->GetFaceNum(); }
virtual bool TestFont() const;
virtual void* GetFtFace() const;
- virtual void SetFontOptions( const ImplFontOptions&);
+ virtual void SetFontOptions( boost::shared_ptr<ImplFontOptions> );
+ virtual boost::shared_ptr<ImplFontOptions> GetFontOptions() const;
virtual int GetLoadFlags() const { return (mnLoadFlags & ~FT_LOAD_IGNORE_TRANSFORM); }
virtual bool NeedsArtificialBold() const { return mbArtBold; }
virtual bool NeedsArtificialItalic() const { return mbArtItalic; }
@@ -203,12 +215,16 @@ public:
{ return mpFontInfo->GetTable( pName, pLength ); }
int GetEmUnits() const;
const FT_Size_Metrics& GetMetricsFT() const { return maSizeFT->metrics; }
+#ifdef ENABLE_GRAPHITE
+ GraphiteFaceWrapper* GetGraphiteFace() const { return mpFontInfo->GetGraphiteFace(); }
+#endif
protected:
friend class GlyphCache;
int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const;
virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const;
+ virtual bool GetFontCapabilities(vcl::FontCapabilities &) const;
bool ApplyGSUB( const ImplFontSelectData& );
virtual ServerFontLayoutEngine* GetLayoutEngine();
@@ -223,12 +239,14 @@ private:
FT_FaceRec_* maFaceFT;
FT_SizeRec_* maSizeFT;
+ boost::shared_ptr<ImplFontOptions> mpFontOptions;
+
bool mbFaceOk;
bool mbArtItalic;
bool mbArtBold;
bool mbUseGamma;
- typedef ::std::hash_map<int,int> GlyphSubstitution;
+ typedef ::boost::unordered_map<int,int> GlyphSubstitution;
GlyphSubstitution maGlyphSubstitution;
rtl_UnicodeToTextConverter maRecodeConverter;
@@ -258,3 +276,5 @@ public:
// -----------------------------------------------------------------------
#endif // _SV_GCACHFTYP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/gcach_layout.cxx b/vcl/source/glyphs/gcach_layout.cxx
index 3fb0a21bd13c..e5624b2910c1 100755..100644
--- a/vcl/source/glyphs/gcach_layout.cxx
+++ b/vcl/source/glyphs/gcach_layout.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -389,6 +390,9 @@ static bool lcl_CharIsJoiner(sal_Unicode cChar)
return ((cChar == 0x200C) || (cChar == 0x200D));
}
+//See https://bugs.freedesktop.org/show_bug.cgi?id=31016
+#define ARABIC_BANDAID
+
bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rArgs )
{
LEUnicode* pIcuChars;
@@ -522,17 +526,6 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
if( nCharPos >= 0 )
{
sal_UCS4 aChar = rArgs.mpStr[ nCharPos ];
-#if 0 // TODO: enable if some unicodes>0xFFFF should need glyph flags!=0
- if( (aChar >= 0xD800) && (aChar <= 0xDFFF) )
- {
- if( cChar >= 0xDC00 ) // this part of a surrogate pair was already processed
- continue;
- // calculate unicode scalar value of surrogate pair
- aChar = 0x10000 + ((aChar - 0xD800) << 10);
- sal_UCS4 aLow = rArgs.mpStr[ nCharPos+1 ];
- aChar += aLow & 0x03FF;
- }
-#endif
nGlyphIndex = rFont.FixupGlyphIndex( nGlyphIndex, aChar );
// #i99367# HACK: try to detect all diacritics
@@ -544,12 +537,40 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
aNewPos = Point( (int)(pPos->fX+0.5), (int)(pPos->fY+0.5) );
const GlyphMetric& rGM = rFont.GetGlyphMetric( nGlyphIndex );
int nGlyphWidth = rGM.GetCharWidth();
+ int nNewWidth = nGlyphWidth;
if( nGlyphWidth <= 0 )
bDiacritic |= true;
// #i99367# force all diacritics to zero width
// TODO: we need mnOrigWidth/mnLogicWidth/mnNewWidth
else if( bDiacritic )
- nGlyphWidth = 0;
+ nGlyphWidth = nNewWidth = 0;
+ else
+ {
+ // Hack, find next +ve width glyph and calculate current
+ // glyph width by substracting the two posituons
+ const IcuPosition* pNextPos = pPos+1;
+ for ( int j = i + 1; j <= nRawRunGlyphCount; ++j, ++pNextPos )
+ {
+ if ( j == nRawRunGlyphCount )
+ {
+ nNewWidth = pNextPos->fX - pPos->fX;
+ break;
+ }
+
+ LEGlyphID nNextGlyphIndex = pIcuGlyphs[j];
+ if( (nNextGlyphIndex == ICU_MARKED_GLYPH)
+ || (nNextGlyphIndex == ICU_DELETED_GLYPH) )
+ continue;
+
+ const GlyphMetric& rNextGM = rFont.GetGlyphMetric( nNextGlyphIndex );
+ int nNextGlyphWidth = rNextGM.GetCharWidth();
+ if ( nNextGlyphWidth > 0 )
+ {
+ nNewWidth = pNextPos->fX - pPos->fX;
+ break;
+ }
+ }
+ }
// heuristic to detect glyph clusters
bool bInCluster = true;
@@ -603,7 +624,10 @@ bool IcuLayoutEngine::operator()( ServerFontLayout& rLayout, ImplLayoutArgs& rAr
nGlyphFlags |= GlyphItem::IS_DIACRITIC;
// add resulting glyph item to layout
- const GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth );
+ GlyphItem aGI( nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nGlyphWidth );
+#ifdef ARABIC_BANDAID
+ aGI.mnNewWidth = nNewWidth;
+#endif
rLayout.AppendGlyph( aGI );
++nFilteredRunGlyphCount;
nLastCharPos = nCharPos;
@@ -642,3 +666,4 @@ ServerFontLayoutEngine* FreetypeServerFont::GetLayoutEngine()
// =======================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/gcach_rbmp.cxx b/vcl/source/glyphs/gcach_rbmp.cxx
index 34d0d4104590..71784f5dd083 100755..100644
--- a/vcl/source/glyphs/gcach_rbmp.cxx
+++ b/vcl/source/glyphs/gcach_rbmp.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -272,3 +273,5 @@ bool RawBitmap::Rotate( int nAngle )
}
//------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 5dbec89e9619..54e946dc3831 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -72,6 +73,12 @@ GlyphCache::GlyphCache( GlyphCachePeer& rPeer )
GlyphCache::~GlyphCache()
{
InvalidateAllGlyphs();
+ for( FontList::iterator it = maFontList.begin(), end = maFontList.end(); it != end; ++it )
+ {
+ ServerFont* pServerFont = it->second;
+ mrPeer.RemovingFont(*pServerFont);
+ delete pServerFont;
+ }
if( mpFtManager )
delete mpFtManager;
}
@@ -344,7 +351,7 @@ void GlyphCache::GarbageCollect()
pServerFont->GarbageCollect( mnLruIndex+0x10000000 );
if( pServerFont == mpCurrentGCFont )
mpCurrentGCFont = NULL;
- const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData();
+ const ImplFontSelectData& rIFSD = pServerFont->GetFontSelData();
maFontList.erase( rIFSD );
mrPeer.RemovingFont( *pServerFont );
mnBytesUsed -= pServerFont->GetByteCount();
@@ -530,7 +537,6 @@ ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
: ImplFontEntry( rFSD )
, mpServerFont( NULL )
, mbGotFontOptions( false )
-, mbValidFontOptions( false )
{}
// -----------------------------------------------------------------------
@@ -602,3 +608,4 @@ int ExtraKernInfo::GetUnscaledKernValue( sal_Unicode cLeft, sal_Unicode cRight )
// =======================================================================
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx
deleted file mode 100644
index 27c9eb02da64..000000000000
--- a/vcl/source/glyphs/graphite_adaptors.cxx
+++ /dev/null
@@ -1,336 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// Description: Implements the Graphite interfaces with access to the
-// platform's font and graphics systems.
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-
-// We need this to enable namespace support in libgrengine headers.
-#define GR_NAMESPACE
-
-// Header files
-//
-// Standard Library
-#include <string>
-#include <cassert>
-// Libraries
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <i18npool/mslangid.hxx>
-// Platform
-#ifndef WNT
-#include <unx/saldisp.hxx>
-
-#include <salgdi.hxx>
-
-#include <freetype/ftsynth.h>
-
-// Module
-#include "gcach_ftyp.hxx"
-
-#include <graphite_features.hxx>
-#include <graphite_adaptors.hxx>
-
-// Module private type definitions and forward declarations.
-//
-using gr::GrResult;
-namespace
-{
- inline float from_hinted(const int x) {
- return static_cast<float>(x + 32) / 64.0;
- }
- typedef std::hash_map<long,bool> SilfMap;
- SilfMap sSilfMap;
-}
-extern FT_Error (*pFTEmbolden)(FT_GlyphSlot);
-extern FT_Error (*pFTOblique)(FT_GlyphSlot);
-
-// class CharacterRenderProperties implentation.
-//
-FontProperties::FontProperties(const FreetypeServerFont &font) throw()
-{
- clrFore = gr::kclrBlack;
- clrBack = gr::kclrTransparent;
-
- pixHeight = from_hinted(font.GetMetricsFT().height);
-
- switch (font.GetFontSelData().meWeight)
- {
- case WEIGHT_SEMIBOLD: case WEIGHT_BOLD:
- case WEIGHT_ULTRABOLD: case WEIGHT_BLACK:
- fBold = true;
- break;
- default :
- fBold = false;
- }
-
- switch (font.GetFontSelData().meItalic)
- {
- case ITALIC_NORMAL: case ITALIC_OBLIQUE:
- fItalic = true;
- break;
- default :
- fItalic = false;
- }
-
- // Get the font name, but prefix with file name hash in case
- // there are 2 fonts on the system with the same face name
- sal_Int32 nHashCode = font.GetFontFileName()->hashCode();
- ::rtl::OUStringBuffer nHashFaceName;
- nHashFaceName.append(nHashCode, 16);
- const sal_Unicode * name = font.GetFontSelData().maName.GetBuffer();
- nHashFaceName.append(name);
-
- const size_t name_sz = std::min(sizeof szFaceName/sizeof(wchar_t)-1,
- static_cast<size_t>(nHashFaceName.getLength()));
-
- std::copy(nHashFaceName.getStr(), nHashFaceName.getStr() + name_sz, szFaceName);
- szFaceName[name_sz] = '\0';
-}
-
-// class GraphiteFontAdaptor implementaion.
-//
-GraphiteFontAdaptor::GraphiteFontAdaptor(ServerFont & sfont, const sal_Int32 dpiX, const sal_Int32 dpiY)
- : mrFont(static_cast<FreetypeServerFont &>(sfont)),
- maFontProperties(static_cast<FreetypeServerFont &>(sfont)),
- mnDpiX(dpiX),
- mnDpiY(dpiY),
- mfAscent(from_hinted(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().ascender)),
- mfDescent(from_hinted(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().descender)),
- mfEmUnits(static_cast<FreetypeServerFont &>(sfont).GetMetricsFT().y_ppem),
- mpFeatures(NULL)
-{
- const rtl::OString aLang = MsLangId::convertLanguageToIsoByteString( sfont.GetFontSelData().meLanguage );
- rtl::OString name = rtl::OUStringToOString(
- sfont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
-#ifdef DEBUG
- printf("GraphiteFontAdaptor %lx %s italic=%u bold=%u\n", (long)this, name.getStr(),
- maFontProperties.fItalic, maFontProperties.fBold);
-#endif
- sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1;
- if (nFeat > 0)
- {
- rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat);
- mpFeatures = new grutils::GrFeatureParser(*this, aFeat.getStr(), aLang.getStr());
-#ifdef DEBUG
- printf("GraphiteFontAdaptor %s/%s/%s %x language %d features %d errors\n",
- rtl::OUStringToOString( sfont.GetFontSelData().maName,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- rtl::OUStringToOString( sfont.GetFontSelData().maTargetName,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- rtl::OUStringToOString( sfont.GetFontSelData().maSearchName,
- RTL_TEXTENCODING_UTF8 ).getStr(),
- sfont.GetFontSelData().meLanguage,
- (int)mpFeatures->getFontFeatures(NULL), mpFeatures->parseErrors());
-#endif
- }
- else
- {
- mpFeatures = new grutils::GrFeatureParser(*this, aLang.getStr());
- }
-}
-
-GraphiteFontAdaptor::GraphiteFontAdaptor(const GraphiteFontAdaptor &rhs) throw()
- : Font(rhs),
- mrFont (rhs.mrFont), maFontProperties(rhs.maFontProperties),
- mnDpiX(rhs.mnDpiX), mnDpiY(rhs.mnDpiY),
- mfAscent(rhs.mfAscent), mfDescent(rhs.mfDescent), mfEmUnits(rhs.mfEmUnits),
- mpFeatures(NULL)
-{
- if (rhs.mpFeatures) mpFeatures = new grutils::GrFeatureParser(*(rhs.mpFeatures));
-}
-
-
-GraphiteFontAdaptor::~GraphiteFontAdaptor() throw()
-{
- maGlyphMetricMap.clear();
- if (mpFeatures) delete mpFeatures;
- mpFeatures = NULL;
-}
-
-void GraphiteFontAdaptor::UniqueCacheInfo(ext_std::wstring & face_name_out, bool & bold_out, bool & italic_out)
-{
- face_name_out = maFontProperties.szFaceName;
- bold_out = maFontProperties.fBold;
- italic_out = maFontProperties.fItalic;
-}
-
-bool GraphiteFontAdaptor::IsGraphiteEnabledFont(ServerFont & font) throw()
-{
- // NOTE: this assumes that the same FTFace pointer won't be reused,
- // so FtFontInfo::ReleaseFaceFT must only be called at shutdown.
- FreetypeServerFont & aFtFont = dynamic_cast<FreetypeServerFont &>(font);
- FT_Face aFace = reinterpret_cast<FT_FaceRec_*>(aFtFont.GetFtFace());
- SilfMap::iterator i = sSilfMap.find(reinterpret_cast<long>(aFace));
- if (i != sSilfMap.end())
- {
-#ifdef DEBUG
- if (static_cast<bool>(aFtFont.GetTable("Silf", 0)) != (*i).second)
- printf("Silf cache font mismatch\n");
-#endif
- return (*i).second;
- }
- bool bHasSilf = aFtFont.GetTable("Silf", 0);
- sSilfMap[reinterpret_cast<long>(aFace)] = bHasSilf;
- return bHasSilf;
-}
-
-
-gr::Font * GraphiteFontAdaptor::copyThis() {
- return new GraphiteFontAdaptor(*this);
-}
-
-
-unsigned int GraphiteFontAdaptor::getDPIx() {
- return mnDpiX;
-}
-
-
-unsigned int GraphiteFontAdaptor::getDPIy() {
- return mnDpiY;
-}
-
-
-float GraphiteFontAdaptor::ascent() {
- return mfAscent;
-}
-
-
-float GraphiteFontAdaptor::descent() {
- return mfDescent;
-}
-
-
-bool GraphiteFontAdaptor::bold() {
- return maFontProperties.fBold;
-}
-
-
-bool GraphiteFontAdaptor::italic() {
- return maFontProperties.fItalic;
-}
-
-
-float GraphiteFontAdaptor::height() {
- return maFontProperties.pixHeight;
-}
-
-
-void GraphiteFontAdaptor::getFontMetrics(float * ascent_out, float * descent_out, float * em_square_out) {
- if (ascent_out) *ascent_out = mfAscent;
- if (descent_out) *descent_out = mfDescent;
- if (em_square_out) *em_square_out = mfEmUnits;
-}
-
-
-const void * GraphiteFontAdaptor::getTable(gr::fontTableId32 table_id, size_t * buffer_sz)
-{
- char tag_name[5] = {char(table_id >> 24), char(table_id >> 16), char(table_id >> 8), char(table_id), 0};
- sal_uLong temp = *buffer_sz;
-
- const void * const tbl_buf = static_cast<FreetypeServerFont &>(mrFont).GetTable(tag_name, &temp);
- *buffer_sz = temp;
-
- return tbl_buf;
-}
-
-#define fix26_6(x) (x >> 6) + (x & 32 ? (x > 0 ? 1 : 0) : (x < 0 ? -1 : 0))
-
-// Return the glyph's metrics in pixels.
-void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBounding, gr::Point & advances)
-{
- // There used to be problems when orientation was set however, this no
- // longer seems to be the case and the Glyph Metric cache in
- // FreetypeServerFont is more efficient since it lasts between calls to VCL
-#if 1
- const GlyphMetric & metric = mrFont.GetGlyphMetric(nGlyphId);
-
- aBounding.right = aBounding.left = metric.GetOffset().X();
- aBounding.bottom = aBounding.top = -metric.GetOffset().Y();
- aBounding.right += metric.GetSize().Width();
- aBounding.bottom -= metric.GetSize().Height();
-
- advances.x = metric.GetDelta().X();
- advances.y = -metric.GetDelta().Y();
-
-#else
- // The problem with the code below is that the cache only lasts
- // as long as the life time of the GraphiteFontAdaptor, which
- // is created once per call to X11SalGraphics::GetTextLayout
- GlyphMetricMap::const_iterator gm_itr = maGlyphMetricMap.find(nGlyphId);
- if (gm_itr != maGlyphMetricMap.end())
- {
- // We've cached the results from last time.
- aBounding = gm_itr->second.first;
- advances = gm_itr->second.second;
- }
- else
- {
- // We need to look up the glyph.
- FT_Int nLoadFlags = mrFont.GetLoadFlags();
-
- FT_Face aFace = reinterpret_cast<FT_Face>(mrFont.GetFtFace());
- if (!aFace)
- {
- aBounding.top = aBounding.bottom = aBounding.left = aBounding.right = 0;
- advances.x = advances.y = 0;
- return;
- }
- FT_Error aStatus = -1;
- aStatus = FT_Load_Glyph(aFace, nGlyphId, nLoadFlags);
- if( aStatus != FT_Err_Ok || (!aFace->glyph))
- {
- aBounding.top = aBounding.bottom = aBounding.left = aBounding.right = 0;
- advances.x = advances.y = 0;
- return;
- }
- // check whether we need synthetic bold/italic otherwise metric is wrong
- if (mrFont.NeedsArtificialBold() && pFTEmbolden)
- (*pFTEmbolden)(aFace->glyph);
-
- if (mrFont.NeedsArtificialItalic() && pFTOblique)
- (*pFTOblique)(aFace->glyph);
-
- const FT_Glyph_Metrics &gm = aFace->glyph->metrics;
-
- // Fill out the bounding box an advances.
- aBounding.top = aBounding.bottom = fix26_6(gm.horiBearingY);
- aBounding.bottom -= fix26_6(gm.height);
- aBounding.left = aBounding.right = fix26_6(gm.horiBearingX);
- aBounding.right += fix26_6(gm.width);
- advances.x = fix26_6(gm.horiAdvance);
- advances.y = 0;
-
- // Now add an entry to our metrics map.
- maGlyphMetricMap[nGlyphId] = std::make_pair(aBounding, advances);
- }
-#endif
-}
-
-#endif
diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx
deleted file mode 100644
index a19f5c5a2c9d..000000000000
--- a/vcl/source/glyphs/graphite_cache.cxx
+++ /dev/null
@@ -1,200 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-
-#ifdef WNT
-#include <tools/svwin.h>
-#include <svsys.h>
-#endif
-
-#include <tools/debug.hxx>
-#include <sallayout.hxx>
-
-#include <preextstl.h>
-#include <graphite/GrClient.h>
-#include <graphite/Segment.h>
-#include <postextstl.h>
-
-#include <rtl/ustring.hxx>
-#include <graphite_layout.hxx>
-#include <graphite_cache.hxx>
-
-#include "graphite_textsrc.hxx"
-
-GrSegRecord::GrSegRecord(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl)
- : m_rope(rope), m_text(textSrc), m_seg(seg), m_nextKey(NULL),
- m_fontScale(0.0f), mbIsRtl(bIsRtl), m_lockCount(0)
-{
- m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter();
- m_startChar = seg->startCharacter();
-}
-
-GrSegRecord::~GrSegRecord()
-{
- clear();
-}
-
-void GrSegRecord::reuse(rtl::OUString * rope, TextSourceAdaptor * textSrc, gr::Segment * seg, bool bIsRtl)
-{
- clear();
- mnWidth = 0;
- m_rope = rope;
- m_text = textSrc;
- m_seg = seg;
- m_nextKey = NULL;
- m_pStr = textSrc->getLayoutArgs().mpStr + seg->startCharacter();
- m_startChar = seg->startCharacter();
- mbIsRtl = bIsRtl;
-}
-
-void GrSegRecord::clearVectors()
-{
- mvGlyphs.clear();
- mvCharDxs.clear();
- mvChar2BaseGlyph.clear();
- mvGlyph2Char.clear();
-}
-
-void GrSegRecord::clear()
-{
-#ifdef GR_DEBUG_TEXT
- if (m_lockCount != 0)
- OutputDebugString("GrSegRecord locked!");
-#endif
- clearVectors();
- delete m_rope;
- delete m_seg;
- delete m_text;
- m_rope = NULL;
- m_seg = NULL;
- m_text = NULL;
- m_fontScale = 0.0f;
- m_lockCount = 0;
-}
-
-GrSegRecord * GraphiteSegmentCache::cacheSegment(TextSourceAdaptor * adapter, gr::Segment * seg, bool bIsRtl)
-{
- GrSegRecord * record = NULL;
- // We keep a record of the oldest key and the last key added
- // when the next key is added, the record for the prevKey's m_nextKey field
- // is updated to the newest key so that m_oldestKey can be updated to the
- // next oldest key when the record for m_oldestKey is deleted
- if (m_segMap.size() > m_nSegCacheSize)
- {
- GraphiteSegMap::iterator oldestPair = m_segMap.find(reinterpret_cast<long>(m_oldestKey));
- // oldest record may no longer exist if a buffer was changed
- if (oldestPair != m_segMap.end())
- {
- record = oldestPair->second;
- m_segMap.erase(reinterpret_cast<long>(m_oldestKey));
- GrRMEntry range = m_ropeMap.equal_range((*(record->m_rope)).hashCode());
- while (range.first != range.second)
- {
- if (range.first->second == record)
- {
- m_ropeMap.erase(range.first);
- break;
- }
- ++range.first;
- }
- m_oldestKey = record->m_nextKey;
- // record will be reused, so don't delete
- }
- }
-
-
-// const int seg_char_limit = min(adapter->maLayoutArgs().mnLength,
-// adapter->maLayoutArgs().mnEndCharPos
-// + GraphiteLayout::EXTRA_CONTEXT_LENGTH);
-// if (seg->stopCharacter() - seg->startCharacter() <= 0)
-// OutputDebugString("Invalid seg indices\n");
- rtl::OUString * pRope = new rtl::OUString(adapter->getLayoutArgs().mpStr + seg->startCharacter(),
- seg->stopCharacter() - seg->startCharacter());
- if (!pRope) return NULL;
- bool reuse = false;
- if (record)
- record->reuse(pRope, adapter, seg, bIsRtl);
- else
- record = new GrSegRecord(pRope, adapter, seg, bIsRtl);
- if (!record)
- {
- delete pRope;
- return NULL;
- }
- GraphiteSegMap::iterator iMap =
- m_segMap.find(reinterpret_cast<long>(record->m_pStr));
- if (iMap != m_segMap.end())
- {
- // the buffer has changed, so the old cached Segment is useless
- reuse = true;
- GrSegRecord * found = iMap->second;
- // Note: we reuse the old next key to avoid breaking our history
- // chain. This means it will be prematurely deleted, but this is
- // unlikely to happen very often.
- record->m_nextKey = found->m_nextKey;
- // overwrite the old record
- m_segMap[reinterpret_cast<long>(record->m_pStr)] = record;
- // erase the old rope key and save the new one
- GrRMEntry range = m_ropeMap.equal_range((*(found->m_rope)).hashCode());
- while (range.first != range.second)
- {
- if (range.first->second == found)
- {
- m_ropeMap.erase(range.first);
- break;
- }
- ++range.first;
- }
- GraphiteRopeMap::value_type mapEntry(record->m_rope->hashCode(), record);
- m_ropeMap.insert(mapEntry);
- // remove the old record
- delete found;
- record->m_lockCount++;
- return record;
- }
- m_segMap[reinterpret_cast<long>(record->m_pStr)] = record;
- GraphiteRopeMap::value_type mapEntry((*(record->m_rope)).hashCode(), record);
- m_ropeMap.insert(mapEntry);
-
- if (m_oldestKey == NULL)
- {
- m_oldestKey = record->m_pStr;
- m_prevKey = record->m_pStr;
- }
- else if (reuse == false)
- {
- DBG_ASSERT(m_segMap.count(reinterpret_cast<long>(m_prevKey)),
- "Previous key got lost somehow!");
- m_segMap.find(reinterpret_cast<long>(m_prevKey))
- ->second->m_nextKey = record->m_pStr;
- m_prevKey = record->m_pStr;
- }
- record->m_lockCount++;
- return record;
-}
diff --git a/vcl/source/glyphs/graphite_features.cxx b/vcl/source/glyphs/graphite_features.cxx
index 4aba41c4b6d3..1db4a50564bd 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,8 +37,7 @@
#include <sal/types.h>
#ifdef WNT
-#include <tools/svwin.h>
-#include <svsys.h>
+#include <windows.h>
#endif
#include <graphite_features.hxx>
@@ -47,81 +47,108 @@ using namespace grutils;
const char GrFeatureParser::FEAT_PREFIX = ':';
const char GrFeatureParser::FEAT_SEPARATOR = '&';
const char GrFeatureParser::FEAT_ID_VALUE_SEPARATOR = '=';
-const std::string GrFeatureParser::ISO_LANG("lang");
-GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string lang)
- : mnNumSettings(0), mbErrors(false)
+GrFeatureParser::GrFeatureParser(const gr_face * pFace, const ::rtl::OString lang)
+ : mnNumSettings(0), mbErrors(false), mpSettings(NULL)
{
- maLang.rgch[0] = maLang.rgch[1] = maLang.rgch[2] = maLang.rgch[3] = '\0';
- setLang(font, lang);
+ maLang.label[0] = maLang.label[1] = maLang.label[2] = maLang.label[3] = '\0';
+ setLang(pFace, lang);
}
-GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, const std::string lang)
- : mnNumSettings(0), mbErrors(false)
+GrFeatureParser::GrFeatureParser(const gr_face * pFace, const ::rtl::OString features, const ::rtl::OString lang)
+ : mnNumSettings(0), mbErrors(false), mpSettings(NULL)
{
- size_t nEquals = 0;
- size_t nFeatEnd = 0;
- size_t pos = 0;
- maLang.rgch[0] = maLang.rgch[1] = maLang.rgch[2] = maLang.rgch[3] = '\0';
- setLang(font, lang);
- while (pos < features.length() && mnNumSettings < MAX_FEATURES)
+ sal_Int32 nEquals = 0;
+ sal_Int32 nFeatEnd = 0;
+ sal_Int32 pos = 0;
+ maLang.num = 0u;
+ setLang(pFace, lang);
+ while ((pos < features.getLength()) && (mnNumSettings < MAX_FEATURES))
{
- nEquals = features.find(FEAT_ID_VALUE_SEPARATOR,pos);
- if (nEquals == std::string::npos)
+ nEquals = features.indexOf(FEAT_ID_VALUE_SEPARATOR, pos);
+ if (nEquals == -1)
{
mbErrors = true;
break;
}
// check for a lang=xxx specification
- if (features.compare(pos, nEquals - pos, ISO_LANG) == 0)
+ const ::rtl::OString aLangPrefix("lang");
+ if (features.match(aLangPrefix, pos ))
{
pos = nEquals + 1;
- nFeatEnd = features.find(FEAT_SEPARATOR, pos);
- if (nFeatEnd == std::string::npos)
+ nFeatEnd = features.indexOf(FEAT_SEPARATOR, pos);
+ if (nFeatEnd == -1)
{
- nFeatEnd = features.length();
+ nFeatEnd = features.getLength();
}
if (nFeatEnd - pos > 3)
mbErrors = true;
else
{
- gr::isocode aLang = maLang;
- for (size_t i = pos; i < nFeatEnd; i++)
- aLang.rgch[i-pos] = features[i];
- ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
- = font.getSupportedLanguages();
- gr::LanguageIterator iL = aSupported.first;
- while (iL != aSupported.second)
+ FeatId aLang = maLang;
+ aLang.num = 0;
+ for (sal_Int32 i = pos; i < nFeatEnd; i++)
+ aLang.label[i-pos] = features[i];
+
+ //ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
+ // = font.getSupportedLanguages();
+ //gr::LanguageIterator iL = aSupported.first;
+ unsigned short i = 0;
+ for (; i < gr_face_n_languages(pFace); i++)
{
- gr::isocode aSupportedLang = *iL;
+ gr_uint32 nFaceLang = gr_face_lang_by_index(pFace, i);
+ FeatId aSupportedLang;
+ aSupportedLang.num = nFaceLang;
+#ifdef __BIG_ENDIAN__
// here we only expect full 3 letter codes
- if (aLang.rgch[0] == aSupportedLang.rgch[0] &&
- aLang.rgch[1] == aSupportedLang.rgch[1] &&
- aLang.rgch[2] == aSupportedLang.rgch[2] &&
- aLang.rgch[3] == aSupportedLang.rgch[3]) break;
- ++iL;
+ if (aLang.label[0] == aSupportedLang.label[0] &&
+ aLang.label[1] == aSupportedLang.label[1] &&
+ aLang.label[2] == aSupportedLang.label[2] &&
+ aLang.label[3] == aSupportedLang.label[3])
+#else
+ if (aLang.label[0] == aSupportedLang.label[3] &&
+ aLang.label[1] == aSupportedLang.label[2] &&
+ aLang.label[2] == aSupportedLang.label[1] &&
+ aLang.label[3] == aSupportedLang.label[0])
+#endif
+ {
+ maLang = aSupportedLang;
+ break;
+ }
+ }
+ if (i == gr_face_n_languages(pFace)) mbErrors = true;
+ else
+ {
+ mnHash = maLang.num;
+ mpSettings = gr_face_featureval_for_lang(pFace, maLang.num);
}
- if (iL == aSupported.second) mbErrors = true;
- else maLang = aLang;
}
}
else
{
+ sal_uInt32 featId = 0;
if (isCharId(features, pos, nEquals - pos))
- maSettings[mnNumSettings].id = getCharId(features, pos, nEquals - pos);
- else maSettings[mnNumSettings].id = getIntValue(features, pos, nEquals - pos);
- pos = nEquals + 1;
- nFeatEnd = features.find(FEAT_SEPARATOR, pos);
- if (nFeatEnd == std::string::npos)
{
- nFeatEnd = features.length();
+ featId = getCharId(features, pos, nEquals - pos);
}
- if (isCharId(features, pos, nFeatEnd - pos))
- maSettings[mnNumSettings].value = getCharId(features, pos, nFeatEnd - pos);
else
- maSettings[mnNumSettings].value= getIntValue(features, pos, nFeatEnd - pos);
- if (isValid(font, maSettings[mnNumSettings]))
+ {
+ featId = getIntValue(features, pos, nEquals - pos);
+ }
+ const gr_feature_ref * pFref = gr_face_find_fref(pFace, featId);
+ pos = nEquals + 1;
+ nFeatEnd = features.indexOf(FEAT_SEPARATOR, pos);
+ if (nFeatEnd == -1)
+ {
+ nFeatEnd = features.getLength();
+ }
+ sal_Int16 featValue = 0;
+ featValue = getIntValue(features, pos, nFeatEnd - pos);
+ if (pFref && gr_fref_set_feature_value(pFref, featValue, mpSettings))
+ {
+ mnHash = (mnHash << 16) ^ ((featId << 8) | featValue);
mnNumSettings++;
+ }
else
mbErrors = true;
}
@@ -129,89 +156,76 @@ GrFeatureParser::GrFeatureParser(gr::Font & font, const std::string features, co
}
}
-void GrFeatureParser::setLang(gr::Font & font, const std::string & lang)
+void GrFeatureParser::setLang(const gr_face * pFace, const rtl::OString & lang)
{
- gr::isocode aLang = {{0,0,0,0}};
- if (lang.length() > 2)
+ FeatId aLang;
+ aLang.num = 0;
+ if (lang.getLength() >= 2)
{
- for (size_t i = 0; i < lang.length() && i < 3; i++)
+ for (sal_Int32 i = 0; i < lang.getLength() && i < 3; i++)
{
if (lang[i] == '-') break;
- aLang.rgch[i] = lang[i];
+ aLang.label[i] = lang[i];
}
- ext_std::pair<gr::LanguageIterator,gr::LanguageIterator> aSupported
- = font.getSupportedLanguages();
- gr::LanguageIterator iL = aSupported.first;
- while (iL != aSupported.second)
+ unsigned short i = 0;
+ for (; i < gr_face_n_languages(pFace); i++)
{
- gr::isocode aSupportedLang = *iL;
- if (aLang.rgch[0] == aSupportedLang.rgch[0] &&
- aLang.rgch[1] == aSupportedLang.rgch[1] &&
- aLang.rgch[2] == aSupportedLang.rgch[2] &&
- aLang.rgch[3] == aSupportedLang.rgch[3]) break;
- ++iL;
- }
- if (iL != aSupported.second)
- maLang = aLang;
-#ifdef DEBUG
- else
- printf("%s has no features\n", aLang.rgch);
+ gr_uint32 nFaceLang = gr_face_lang_by_index(pFace, i);
+ FeatId aSupportedLang;
+ aSupportedLang.num = nFaceLang;
+ // here we only expect full 2 & 3 letter codes
+#ifdef __BIG_ENDIAN__
+ if (aLang.label[0] == aSupportedLang.label[0] &&
+ aLang.label[1] == aSupportedLang.label[1] &&
+ aLang.label[2] == aSupportedLang.label[2] &&
+ aLang.label[3] == aSupportedLang.label[3])
+#else
+ if (aLang.label[0] == aSupportedLang.label[3] &&
+ aLang.label[1] == aSupportedLang.label[2] &&
+ aLang.label[2] == aSupportedLang.label[1] &&
+ aLang.label[3] == aSupportedLang.label[0])
#endif
+ {
+ maLang = aSupportedLang;
+ break;
+ }
+ }
+ if (i != gr_face_n_languages(pFace))
+ {
+ if (mpSettings)
+ gr_featureval_destroy(mpSettings);
+ mpSettings = gr_face_featureval_for_lang(pFace, maLang.num);
+ mnHash = maLang.num;
+ }
}
-}
-
-GrFeatureParser::GrFeatureParser(const GrFeatureParser & aCopy)
- : maLang(aCopy.maLang), mbErrors(aCopy.mbErrors)
-{
- mnNumSettings = aCopy.getFontFeatures(maSettings);
+ if (!mpSettings)
+ mpSettings = gr_face_featureval_for_lang(pFace, 0);
}
GrFeatureParser::~GrFeatureParser()
{
-}
-
-size_t GrFeatureParser::getFontFeatures(gr::FeatureSetting settings[64]) const
-{
- if (settings)
- {
- std::copy(maSettings, maSettings + mnNumSettings, settings);
- }
- return mnNumSettings;
-}
-
-bool GrFeatureParser::isValid(gr::Font & font, gr::FeatureSetting & setting)
-{
- gr::FeatureIterator i = font.featureWithID(setting.id);
- if (font.getFeatures().second == i)
- {
- return false;
- }
- ext_std::pair< gr::FeatureSettingIterator, gr::FeatureSettingIterator >
- validValues = font.getFeatureSettings(i);
- gr::FeatureSettingIterator j = validValues.first;
- while (j != validValues.second)
+ if (mpSettings)
{
- if (*j == setting.value) return true;
- ++j;
+ gr_featureval_destroy(mpSettings);
+ mpSettings = NULL;
}
- return false;
}
-bool GrFeatureParser::isCharId(const std::string & id, size_t offset, size_t length)
+bool GrFeatureParser::isCharId(const rtl::OString & id, size_t offset, size_t length)
{
if (length > 4) return false;
for (size_t i = 0; i < length; i++)
{
if (i > 0 && id[offset+i] == '\0') continue;
- if ((id[offset+i]) < 0x20 || (id[offset+i]) < 0)
+ if ((id[offset+i] < 0x20) || (id[offset+i] < 0))
return false;
- if (i==0 && id[offset+i] < 0x41)
+ if (i==0 && (id[offset+i] < 0x41))
return false;
}
return true;
}
-int GrFeatureParser::getCharId(const std::string & id, size_t offset, size_t length)
+gr_uint32 GrFeatureParser::getCharId(const rtl::OString & id, size_t offset, size_t length)
{
FeatId charId;
charId.num = 0;
@@ -229,9 +243,9 @@ int GrFeatureParser::getCharId(const std::string & id, size_t offset, size_t len
return charId.num;
}
-int GrFeatureParser::getIntValue(const std::string & id, size_t offset, size_t length)
+short GrFeatureParser::getIntValue(const rtl::OString & id, size_t offset, size_t length)
{
- int value = 0;
+ short value = 0;
int sign = 1;
for (size_t i = 0; i < length; i++)
{
@@ -271,16 +285,4 @@ int GrFeatureParser::getIntValue(const std::string & id, size_t offset, size_t l
return value;
}
-
-sal_Int32 GrFeatureParser::hashCode() const
-{
- union IsoHash { sal_Int32 mInt; gr::isocode mCode; };
- IsoHash isoHash;
- isoHash.mCode = maLang;
- sal_Int32 hash = isoHash.mInt;
- for (size_t i = 0; i < mnNumSettings; i++)
- {
- hash = (hash << 16) ^ ((maSettings[i].id << 8) | maSettings[i].value);
- }
- return hash;
-}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 267454d825c5..b43a57b93392 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,8 +37,9 @@
// Enable lots of debug info
#ifdef DEBUG
+#include <cstdio>
//#define GRLAYOUT_DEBUG 1
-//#undef NDEBUG
+#undef NDEBUG
#endif
// Header files
@@ -51,14 +53,8 @@
#include <deque>
// Platform
-#ifdef WNT
-#include <tools/svwin.h>
#include <svsys.h>
-#endif
-
-#ifdef UNX
#include <graphite_adaptors.hxx>
-#endif
#include <salgdi.hxx>
@@ -67,18 +63,10 @@
#include <unicode/uscript.h>
// Graphite Libraries (must be after vcl headers on windows)
-#include <preextstl.h>
-#include <graphite/GrClient.h>
-#include <graphite/Font.h>
-#include <graphite/ITextSource.h>
-#include <graphite/Segment.h>
-#include <graphite/SegmentPainter.h>
-#include <postextstl.h>
-
-#include <graphite_layout.hxx>
-#include <graphite_features.hxx>
-#include "graphite_textsrc.hxx"
+#include <graphite2/Segment.h>
+#include "vcl/graphite_layout.hxx"
+#include "vcl/graphite_features.hxx"
// Module private type definitions and forward declarations.
//
@@ -86,48 +74,38 @@
//
#ifdef GRLAYOUT_DEBUG
-FILE * grLogFile = NULL;
-FILE * grLog()
+static FILE * grLogFile = NULL;
+static FILE * grLog()
{
#ifdef WNT
std::string logFileName(getenv("TEMP"));
- logFileName.append("\\graphitelayout.log");
+ logFileName.append("/graphitelayout.log");
if (grLogFile == NULL) grLogFile = fopen(logFileName.c_str(),"w");
else fflush(grLogFile);
return grLogFile;
#else
+ fflush(stdout);
return stdout;
#endif
}
#endif
-#ifdef GRCACHE
-#include <graphite_cache.hxx>
-#endif
-
-
namespace
{
- typedef ext_std::pair<gr::GlyphIterator, gr::GlyphIterator> glyph_range_t;
- typedef ext_std::pair<gr::GlyphSetIterator, gr::GlyphSetIterator> glyph_set_range_t;
-
inline long round(const float n) {
return long(n + (n < 0 ? -0.5 : 0.5));
}
-
template<typename T>
inline bool in_range(const T i, const T b, const T e) {
return !(b > i) && i < e;
}
-
template<typename T>
inline bool is_subrange(const T sb, const T se, const T b, const T e) {
return !(b > sb || se > e);
}
-
template<typename T>
inline bool is_subrange(const std::pair<T, T> &s, const T b, const T e) {
return is_subrange(s.first, s.second, b, e);
@@ -150,9 +128,18 @@ namespace
return limit;
}
-} // namespace
-
+ template <typename T>
+ T maximum(T a, T b)
+ {
+ return (a > b)? a : b;
+ }
+ template <typename T>
+ T minimum(T a, T b)
+ {
+ return (a < b)? a : b;
+ }
+} // namespace
// Impementation of the GraphiteLayout::Glyphs container class.
// This is an extended vector class with methods added to enable
@@ -161,413 +148,368 @@ namespace
// o manipulations that affect neighouring glyphs.
const int GraphiteLayout::EXTRA_CONTEXT_LENGTH = 10;
-#ifdef GRCACHE
-GraphiteCacheHandler GraphiteCacheHandler::instance;
-#endif
+
+// find first slot of cluster and first slot of subsequent cluster
+static void findFirstClusterSlot(const gr_slot* base, gr_slot const** first, gr_slot const** after, int * firstChar, int * lastChar, bool bRtl)
+{
+ if (gr_slot_attached_to(base) == NULL)
+ {
+ *first = base;
+ *after = (bRtl)? gr_slot_prev_in_segment(base) :
+ gr_slot_next_in_segment(base);
+ *firstChar = gr_slot_before(base);
+ *lastChar = gr_slot_after(base);
+ }
+ const gr_slot * attachment = gr_slot_first_attachment(base);
+ while (attachment)
+ {
+ if (gr_slot_origin_X(*first) > gr_slot_origin_X(attachment))
+ *first = attachment;
+ const gr_slot* attachmentNext = (bRtl)?
+ gr_slot_prev_in_segment(attachment) : gr_slot_next_in_segment(attachment);
+ if (attachmentNext)
+ {
+ if (*after && (gr_slot_origin_X(*after) < gr_slot_origin_X(attachmentNext)))
+ *after = attachmentNext;
+ }
+ else
+ {
+ *after = NULL;
+ }
+ if (gr_slot_before(attachment) < *firstChar)
+ *firstChar = gr_slot_before(attachment);
+ if (gr_slot_after(attachment) > *lastChar)
+ *lastChar = gr_slot_after(attachment);
+ if (gr_slot_first_attachment(attachment))
+ findFirstClusterSlot(attachment, first, after, firstChar, lastChar, bRtl);
+ attachment = gr_slot_next_sibling_attachment(attachment);
+ }
+}
// The Graphite glyph stream is really a sequence of glyph attachment trees
-// each rooted at a non-attached base glyph. fill_from walks the glyph stream
-// find each non-attached base glyph and calls append to record them as a
+// each rooted at a non-attached base glyph. fill_from walks the glyph stream,
+// finds each non-attached base glyph and calls append to record them as a
// sequence of clusters.
void
-GraphiteLayout::Glyphs::fill_from(gr::Segment & rSegment, ImplLayoutArgs &rArgs,
- bool bRtl, long &rWidth, float fScaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs)
+GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fScaling)
{
- // Create a glyph item for each of the glyph and append it to the base class glyph list.
- typedef ext_std::pair< gr::GlyphSetIterator, gr::GlyphSetIterator > GrGlyphSet;
- int nChar = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
- glyph_range_t iGlyphs = rSegment.glyphs();
- int nGlyphs = iGlyphs.second - iGlyphs.first;
- gr::GlyphIterator prevBase = iGlyphs.second;
- float fSegmentAdvance = rSegment.advanceWidth();
- float fMinX = fSegmentAdvance;
+ bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL);
+ int nCharRequested = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
+ int nChar = gr_seg_n_cinfo(pSegment);
+ float fMinX = gr_seg_advance_X(pSegment);
float fMaxX = 0.0f;
- rGlyph2Char.assign(nGlyphs, -1);
- long nDxOffset = 0;
- int nGlyphIndex = (bRtl)? (nGlyphs - 1) : 0;
- // OOo always expects the glyphs in ltr order
- int nDelta = (bRtl)? -1 : 1;
-
- int nLastGlyph = (bRtl)? nGlyphs - 1: 0;
- int nNextChar = (bRtl)? (rSegment.stopCharacter() - 1) : rSegment.startCharacter();//rArgs.mnMinCharPos;
- // current glyph number (Graphite glyphs)
- //int currGlyph = 0;
- int nFirstCharInCluster = nNextChar;
- int nFirstGlyphInCluster = nLastGlyph;
-
- // ltr first char in cluster is lowest, same is true for rtl
- // ltr first glyph in cluster is lowest, rtl first glyph is highest
-
- // loop over the glyphs determining which characters are linked to them
- gr::GlyphIterator gi;
- for (gi = iGlyphs.first + nGlyphIndex;
- nGlyphIndex >= 0 && nGlyphIndex < nGlyphs;
- nGlyphIndex+= nDelta, gi = iGlyphs.first + nGlyphIndex)
+ long nDxOffset = 0; // from dropped glyphs
+ int nFirstCharInCluster = 0;
+ int nLastCharInCluster = 0;
+ unsigned int nGlyphs = gr_seg_n_slots(pSegment);
+ mvGlyph2Char.assign(nGlyphs, -1);
+ mvGlyphs.reserve(nGlyphs);
+
+ if (bRtl)
{
- gr::GlyphInfo info = (*gi);
-#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Glyph %d %f,%f\n", (int)info.logicalIndex(), info.origin(), info.yOffset());
-#endif
- // the last character associated with this glyph is after
- // our current cluster buffer position
- if ((bRtl && ((signed)info.firstChar() <= nNextChar)) ||
- (!bRtl && ((signed)info.lastChar() >= nNextChar)))
+ const gr_slot* baseSlot = gr_seg_last_slot(pSegment);
+ // find first base
+ while (baseSlot && (gr_slot_attached_to(baseSlot) != NULL))
+ baseSlot = gr_slot_prev_in_segment(baseSlot);
+ int iChar = nChar - 1;
+ int iNextChar = nChar - 1;
+ bool reordered = false;
+ int nBaseGlyphIndex = 0;
+ // now loop over bases
+ while (baseSlot)
{
- if ((bRtl && nGlyphIndex < nLastGlyph) ||
- (!bRtl && nGlyphIndex > nLastGlyph))
+ bool bCluster = !reordered;
+ const gr_slot * clusterFirst = NULL;
+ const gr_slot * clusterAfter = NULL;
+ int firstChar = -1;
+ int lastChar = -1;
+ findFirstClusterSlot(baseSlot, &clusterFirst, &clusterAfter, &firstChar, &lastChar, bRtl);
+ iNextChar = minimum<int>(firstChar, iNextChar);
+ if (bCluster)
{
- // this glyph is after the previous one left->right
- // if insertion is allowed before it then we are in a
- // new cluster
- int nAttachedBase = (*(info.attachedClusterBase())).logicalIndex();
- if (!info.isAttached() ||
- !in_range(nAttachedBase, nFirstGlyphInCluster, nGlyphIndex))
+ nBaseGlyphIndex = mvGlyphs.size();
+ mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset;
+ nFirstCharInCluster = firstChar;
+ nLastCharInCluster = lastChar;
+ }
+ else
+ {
+ mvGlyph2Char[mvGlyphs.size()] = firstChar + mnSegCharOffset;
+ nFirstCharInCluster = minimum<int>(firstChar, nFirstCharInCluster);
+ nLastCharInCluster = maximum<int>(firstChar, nLastCharInCluster);
+ }
+ float leftBoundary = gr_slot_origin_X(clusterFirst);
+ float rightBoundary = (clusterAfter)?
+ gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment);
+ if (
+ lastChar < iChar &&
+ (gr_cinfo_after(gr_seg_cinfo(pSegment, iChar)) >
+ static_cast<int>(gr_slot_index(clusterAfter)))
+ )
+ {
+ reordered = true;
+ }
+ else
+ {
+ reordered = false;
+ iChar = iNextChar - 1;
+ }
+ if (mnSegCharOffset + nFirstCharInCluster >= mnMinCharPos &&
+ mnSegCharOffset + nFirstCharInCluster < mnEndCharPos)
+ {
+ fMinX = minimum<float>(fMinX, leftBoundary);
+ fMaxX = maximum<float>(fMaxX, rightBoundary);
+ if (!reordered)
{
- if (in_range(nFirstCharInCluster, rArgs.mnMinCharPos, rArgs.mnEndCharPos) &&
- nFirstGlyphInCluster != nGlyphIndex)
+ for (int i = nFirstCharInCluster; i <= nLastCharInCluster; i++)
{
- std::pair <float,float> aBounds =
- appendCluster(rSegment, rArgs, bRtl,
- fSegmentAdvance, nFirstCharInCluster,
- nNextChar, nFirstGlyphInCluster, nGlyphIndex, fScaling,
- rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
- fMinX = std::min(aBounds.first, fMinX);
- fMaxX = std::max(aBounds.second, fMaxX);
+ if (mnSegCharOffset + i >= mnEndCharPos)
+ break;
+ // from the point of view of the dx array, the xpos is
+ // the origin of the first glyph of the cluster rtl
+ mvCharDxs[mnSegCharOffset + i - mnMinCharPos] =
+ static_cast<int>(leftBoundary * fScaling) + nDxOffset;
+ mvCharBreaks[mnSegCharOffset + i - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, i));
}
- nFirstCharInCluster = (bRtl)? info.lastChar() : info.firstChar();
- nFirstGlyphInCluster = nGlyphIndex;
+ mvChar2BaseGlyph[mnSegCharOffset + nFirstCharInCluster - mnMinCharPos] = nBaseGlyphIndex;
}
- nLastGlyph = (bRtl)? std::min(nGlyphIndex, nAttachedBase) :
- std::max(nGlyphIndex, nAttachedBase);
+ append(pSegment, rArgs, baseSlot, rightBoundary, fScaling,
+ nDxOffset, bCluster, mnSegCharOffset + firstChar);
+ }
+ if (mnSegCharOffset + nLastCharInCluster < mnMinCharPos)
+ break;
+ baseSlot = gr_slot_next_sibling_attachment(baseSlot);
+ }
+ }
+ else
+ {
+ const gr_slot* baseSlot = gr_seg_first_slot(pSegment);
+ // find first base
+ while (baseSlot && (gr_slot_attached_to(baseSlot) != NULL))
+ baseSlot = gr_slot_next_in_segment(baseSlot);
+ int iChar = 0; // relative to segment
+ int iNextChar = 0;
+ bool reordered = false;
+ int nBaseGlyphIndex = 0;
+ // now loop over bases
+ while (baseSlot)
+ {
+ bool bCluster = !reordered;
+ const gr_slot * clusterFirst = NULL;
+ const gr_slot * clusterAfter = NULL;
+ int firstChar = -1;
+ int lastChar = -1;
+ findFirstClusterSlot(baseSlot, &clusterFirst, &clusterAfter, &firstChar, &lastChar, bRtl);
+ iNextChar = maximum<int>(lastChar, iNextChar);
+ if (bCluster)
+ {
+ nBaseGlyphIndex = mvGlyphs.size();
+ mvGlyph2Char[nBaseGlyphIndex] = iChar + mnSegCharOffset;
+ nFirstCharInCluster = firstChar;
+ nLastCharInCluster = lastChar;
}
- // loop over chacters associated with this glyph and characters
- // between nextChar and the last character associated with this glyph
- // giving them the current cluster id. This allows for character /glyph
- // order reversal.
- // For each character we do a reverse glyph id look up
- // and store the glyph id with the highest logical index in nLastGlyph
- while ((bRtl && ((signed)info.firstChar() <= nNextChar)) ||
- (!bRtl && (signed)info.lastChar() >= nNextChar))
+ else
{
- GrGlyphSet charGlyphs = rSegment.charToGlyphs(nNextChar);
- nNextChar += nDelta;
- gr::GlyphSetIterator gj = charGlyphs.first;
- while (gj != charGlyphs.second)
- {
- nLastGlyph = (bRtl)? min(nLastGlyph, (signed)(*gj).logicalIndex()) : max(nLastGlyph, (signed)(*gj).logicalIndex());
- ++gj;
- }
+ mvGlyph2Char[mvGlyphs.size()] = firstChar + mnSegCharOffset;
+ nFirstCharInCluster = minimum<int>(firstChar, nFirstCharInCluster);
+ nLastCharInCluster = maximum<int>(lastChar, nLastCharInCluster);
}
- // Loop over attached glyphs and make sure they are all in the cluster since you
- // can have glyphs attached with another base glyph in between
- glyph_set_range_t iAttached = info.attachedClusterGlyphs();
- for (gr::GlyphSetIterator agi = iAttached.first; agi != iAttached.second; ++agi)
+ if (
+ firstChar > iChar &&
+ (gr_cinfo_before(gr_seg_cinfo(pSegment, iChar)) >
+ static_cast<int>(gr_slot_index(clusterFirst)))
+ )
{
- nLastGlyph = (bRtl)? min(nLastGlyph, (signed)(*agi).logicalIndex()) : max(nLastGlyph, (signed)(*agi).logicalIndex());
+ reordered = true;
}
-
- // if this is a rtl attached glyph, then we need to include its
- // base in the cluster, which will have a lower graphite index
- if (bRtl)
+ else
+ {
+ reordered = false;
+ iChar = iNextChar + 1;
+ }
+ float leftBoundary = gr_slot_origin_X(clusterFirst);
+ float rightBoundary = (clusterAfter)?
+ gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment);
+ if (mnSegCharOffset + nFirstCharInCluster >= mnMinCharPos &&
+ mnSegCharOffset + nFirstCharInCluster < mnEndCharPos)
{
- if ((signed)info.attachedClusterBase()->logicalIndex() < nLastGlyph)
+ fMinX = minimum<float>(fMinX, leftBoundary);
+ fMaxX = maximum<float>(fMaxX, rightBoundary);
+ if (!reordered)
{
- nLastGlyph = info.attachedClusterBase()->logicalIndex();
+ for (int i = nFirstCharInCluster; i <= nLastCharInCluster; i++)
+ {
+ if (mnSegCharOffset + i >= mnEndCharPos)
+ break;
+ // from the point of view of the dx array, the xpos is
+ // the origin of the first glyph of the next cluster ltr
+ mvCharDxs[mnSegCharOffset + i - mnMinCharPos] =
+ static_cast<int>(rightBoundary * fScaling) + nDxOffset;
+ mvCharBreaks[mnSegCharOffset + i - mnMinCharPos] = gr_cinfo_break_weight(gr_seg_cinfo(pSegment, i));
+ }
+ // only set mvChar2BaseGlyph for first character of cluster
+ mvChar2BaseGlyph[mnSegCharOffset + nFirstCharInCluster - mnMinCharPos] = nBaseGlyphIndex;
}
+ append(pSegment, rArgs, baseSlot, rightBoundary, fScaling,
+ nDxOffset, true, mnSegCharOffset + firstChar);
}
- }
-
- // it is possible for the lastChar to be after nextChar and
- // firstChar to be before the nFirstCharInCluster in rare
- // circumstances e.g. Myanmar word for cemetery
- if ((bRtl && ((signed)info.lastChar() > nFirstCharInCluster)) ||
- (!bRtl && ((signed)info.firstChar() < nFirstCharInCluster)))
- {
- nFirstCharInCluster = info.firstChar();
+ if (mnSegCharOffset + nFirstCharInCluster >= mnEndCharPos)
+ break;
+ baseSlot = gr_slot_next_sibling_attachment(baseSlot);
}
}
- // process last cluster
- if (in_range(nFirstCharInCluster, rArgs.mnMinCharPos, rArgs.mnEndCharPos) &&
- nFirstGlyphInCluster != nGlyphIndex)
- {
- std::pair <float,float> aBounds =
- appendCluster(rSegment, rArgs, bRtl, fSegmentAdvance,
- nFirstCharInCluster, nNextChar,
- nFirstGlyphInCluster, nGlyphIndex, fScaling,
- rChar2Base, rGlyph2Char, rCharDxs, nDxOffset);
- fMinX = std::min(aBounds.first, fMinX);
- fMaxX = std::max(aBounds.second, fMaxX);
- }
long nXOffset = round(fMinX * fScaling);
- rWidth = round(fMaxX * fScaling) - nXOffset + nDxOffset;
- if (rWidth < 0)
+ mnWidth = round(fMaxX * fScaling) - nXOffset + nDxOffset;
+ if (mnWidth < 0)
{
// This can happen when there was no base inside the range
- rWidth = 0;
+ mnWidth = 0;
}
// fill up non-base char dx with cluster widths from previous base glyph
if (bRtl)
{
- if (rCharDxs[nChar-1] == -1)
- rCharDxs[nChar-1] = 0;
+ if (mvCharDxs[nCharRequested-1] == -1)
+ mvCharDxs[nCharRequested-1] = 0;
else
- rCharDxs[nChar-1] -= nXOffset;
- for (int i = nChar - 2; i >= 0; i--)
+ mvCharDxs[nCharRequested-1] -= nXOffset;
+ for (int i = nCharRequested - 2; i >= 0; i--)
{
- if (rCharDxs[i] == -1) rCharDxs[i] = rCharDxs[i+1];
- else rCharDxs[i] -= nXOffset;
+ if (mvCharDxs[i] == -1) mvCharDxs[i] = mvCharDxs[i+1];
+ else mvCharDxs[i] -= nXOffset;
}
}
else
{
- if (rCharDxs[0] == -1)
- rCharDxs[0] = 0;
+ if (mvCharDxs[0] == -1)
+ mvCharDxs[0] = 0;
else
- rCharDxs[0] -= nXOffset;
- for (int i = 1; i < nChar; i++)
+ mvCharDxs[0] -= nXOffset;
+ for (int i = 1; i < nCharRequested; i++)
{
- if (rCharDxs[i] == -1) rCharDxs[i] = rCharDxs[i-1];
- else rCharDxs[i] -= nXOffset;
- }
- }
+ if (mvCharDxs[i] == -1) mvCharDxs[i] = mvCharDxs[i-1];
+ else mvCharDxs[i] -= nXOffset;
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Glyphs xOff%ld dropDx%ld w%ld\n", nXOffset, nDxOffset, rWidth);
+ fprintf(grLog(),"%d,%d ", (int)i, (int)mvCharDxs[i]);
#endif
- // remove offset due to context if there is one
- if (nXOffset != 0)
- {
- for (size_t i = 0; i < size(); i++)
- (*this)[i].maLinearPos.X() -= nXOffset;
- }
-}
-
-std::pair<float,float> GraphiteLayout::Glyphs::appendCluster(gr::Segment& rSeg,
- ImplLayoutArgs & rArgs, bool bRtl,float fSegmentAdvance,
- int nFirstCharInCluster, int nNextChar, int nFirstGlyphInCluster,
- int nNextGlyph, float fScaling, std::vector<int> & rChar2Base,
- std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset)
-{
- glyph_range_t iGlyphs = rSeg.glyphs();
- int nGlyphs = iGlyphs.second - iGlyphs.first;
- int nDelta = (bRtl)? -1 : 1;
- gr::GlyphInfo aFirstGlyph = *(iGlyphs.first + nFirstGlyphInCluster);
- std::pair <float, float> aBounds;
- aBounds.first = aFirstGlyph.origin();
- aBounds.second = aFirstGlyph.origin();
- // before we add the glyphs to this vector, we record the
- // glyph's index in the vector (which is not the same as
- // the Segment's glyph index!)
- assert(size() < rGlyph2Char.size());
- rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] = size();
- rGlyph2Char[size()] = nFirstCharInCluster;
-
- // can we break before this cluster?
- // Glyphs may have either a positive or negative breakWeight refering to
- // the position after or before the glyph respectively
- int nPrevBreakWeight = 0;
- if (nFirstGlyphInCluster > 0)
- {
- nPrevBreakWeight = (iGlyphs.first + (nFirstGlyphInCluster - 1))->breakweight();
- }
- int nBreakWeight = aFirstGlyph.breakweight();
- if (nBreakWeight < 0)
- {
- // negative means it applies to the position before the glyph's character
- nBreakWeight *= -1;
- if (nPrevBreakWeight > 0 && nPrevBreakWeight < nBreakWeight)
- {
- // prevBreakWeight wins
- nBreakWeight = nPrevBreakWeight;
}
}
- else
- {
- nBreakWeight = 0;
- // positive means break after
- if (nPrevBreakWeight > 0)
- nBreakWeight = nPrevBreakWeight;
- }
- if (nBreakWeight > gr::klbNoBreak/*0*/ &&
- // nBreakWeight <= gr::klbHyphenBreak) // uses Graphite hyphenation
- nBreakWeight <= gr::klbLetterBreak) // Needed for issue 111272
- {
- if (nBreakWeight < gr::klbHyphenBreak)
- rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
- else
- rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= HYPHEN_BREAK_BEFORE;
- }
- // always allow a break before a space even if graphite doesn't
- if (rArgs.mpStr[nFirstCharInCluster] == 0x20)
- rChar2Base[nFirstCharInCluster-rArgs.mnMinCharPos] |= WORD_BREAK_BEFORE;
-
- bool bBaseGlyph = true;
- for (int j = nFirstGlyphInCluster;
- j != nNextGlyph; j += nDelta)
- {
- long nNextOrigin;
- float fNextOrigin;
- gr::GlyphInfo aGlyph = *(iGlyphs.first + j);
- if (j + nDelta >= nGlyphs || j + nDelta < 0) // at rhs ltr,rtl
- {
- fNextOrigin = fSegmentAdvance;
- nNextOrigin = round(fSegmentAdvance * fScaling + rDXOffset);
- aBounds.second = std::max(fSegmentAdvance, aBounds.second);
- }
- else
- {
- gr::GlyphInfo aNextGlyph = *(iGlyphs.first + j + nDelta);
- fNextOrigin = std::max(aNextGlyph.attachedClusterBase()->origin(), aNextGlyph.origin());
- aBounds.second = std::max(fNextOrigin, aBounds.second);
- nNextOrigin = round(fNextOrigin * fScaling + rDXOffset);
- }
- aBounds.first = std::min(aGlyph.origin(), aBounds.first);
- if ((signed)aGlyph.firstChar() < rArgs.mnEndCharPos &&
- (signed)aGlyph.firstChar() >= rArgs.mnMinCharPos)
- {
- rCharDxs[aGlyph.firstChar()-rArgs.mnMinCharPos] = nNextOrigin;
- }
- if ((signed)aGlyph.attachedClusterBase()->logicalIndex() == j)
- {
- append(rSeg, rArgs, aGlyph, fNextOrigin, fScaling, rChar2Base, rGlyph2Char, rCharDxs, rDXOffset, bBaseGlyph);
- bBaseGlyph = false;
- }
- }
- // from the point of view of the dx array, the xpos is
- // the origin of the first glyph of the next cluster ltr
- // rtl it is the origin of the 1st glyph of the cluster
- long nXPos = (bRtl)?
- round(aFirstGlyph.attachedClusterBase()->origin() * fScaling) + rDXOffset :
- round(aBounds.second * fScaling) + rDXOffset;
- // force the last char in range to have the width of the cluster
- if (bRtl)
- {
- for (int n = nNextChar + 1; n <= nFirstCharInCluster; n++)
- {
- if ((n < rArgs.mnEndCharPos) && (n >= rArgs.mnMinCharPos))
- rCharDxs[n-rArgs.mnMinCharPos] = nXPos;
- }
- }
- else
+ // remove offset due to context if there is one
+ if (nXOffset != 0)
{
- for (int n = nNextChar - 1; n >= nFirstCharInCluster; n--)
- {
- if (n < rArgs.mnEndCharPos && n >= rArgs.mnMinCharPos)
- rCharDxs[n-rArgs.mnMinCharPos] = nXPos;
- }
+ for (size_t i = 0; i < mvGlyphs.size(); i++)
+ mvGlyphs[i].maLinearPos.X() -= nXOffset;
}
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Cluster g[%d-%d) c[%d-%d)%x x%ld y%f bw%d\n", nFirstGlyphInCluster, nNextGlyph, nFirstCharInCluster, nNextChar, rArgs.mpStr[nFirstCharInCluster], nXPos, aFirstGlyph.yOffset(), nBreakWeight);
+ fprintf(grLog(), "fillFrom %d glyphs offset %ld width %d\n", mvGlyphs.size(), nXOffset, mnWidth);
#endif
- return aBounds;
}
// append walks an attachment tree, flattening it, and converting it into a
// sequence of GlyphItem objects which we can later manipulate.
void
-GraphiteLayout::Glyphs::append(gr::Segment &segment, ImplLayoutArgs &args, gr::GlyphInfo & gi, float nextGlyphOrigin, float scaling, std::vector<int> & rChar2Base, std::vector<int> & rGlyph2Char, std::vector<int> & rCharDxs, long & rDXOffset, bool bIsBase)
+GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs,
+ const gr_slot * gi, float nextGlyphOrigin, float scaling, long & rDXOffset,
+ bool bIsBase, int baseChar)
{
+ bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL);
float nextOrigin = nextGlyphOrigin;
- int firstChar = std::min(gi.firstChar(), gi.lastChar());
- assert(size() < rGlyph2Char.size());
- if (!bIsBase) rGlyph2Char[size()] = firstChar;
+ assert(gi);
+ assert(gr_slot_before(gi) <= gr_slot_after(gi));
+ int firstChar = gr_slot_before(gi) + mnSegCharOffset;
+ assert(mvGlyphs.size() < mvGlyph2Char.size());
+ if (!bIsBase) mvGlyph2Char[mvGlyphs.size()] = baseChar;//firstChar;
// is the next glyph attached or in the next cluster?
- glyph_set_range_t iAttached = gi.attachedClusterGlyphs();
- if (iAttached.first != iAttached.second)
+ //glyph_set_range_t iAttached = gi.attachedClusterGlyphs();
+ const gr_slot * pFirstAttached = gr_slot_first_attachment(gi);
+ if (pFirstAttached)
{
- nextOrigin = iAttached.first->origin();
+ nextOrigin = gr_slot_origin_X(pFirstAttached);
}
- long glyphId = gi.glyphID();
+ long glyphId = gr_slot_gid(gi);
long deltaOffset = 0;
- int glyphWidth = round(nextOrigin * scaling) - round(gi.origin() * scaling);
+ int scaledGlyphPos = round(gr_slot_origin_X(gi) * scaling);
+ int glyphWidth = round(nextOrigin * scaling) - scaledGlyphPos;
+ if (glyphWidth < 0)
+ glyphWidth = 0;
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"c%d g%d gWidth%d x%f ", firstChar, (int)gi.logicalIndex(), glyphWidth, nextOrigin);
+ fprintf(grLog(),"c%d g%ld,X%d W%d nX%f ", firstChar, glyphId,
+ (int)(gr_slot_origin_X(gi) * scaling), glyphWidth, nextOrigin * scaling);
#endif
if (glyphId == 0)
{
- args.NeedFallback(
- firstChar,
- gr::RightToLeftDir(gr::DirCode(gi.directionality())));
- if( (SAL_LAYOUT_FOR_FALLBACK & args.mnFlags ))
+ rArgs.NeedFallback(firstChar, bRtl);
+ if( (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags ))
{
glyphId = GF_DROPPED;
deltaOffset -= glyphWidth;
glyphWidth = 0;
}
}
- else if(args.mnFlags & SAL_LAYOUT_FOR_FALLBACK)
+ else if(rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK)
{
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"fallback c%d %x in run %d\n", firstChar, args.mpStr[firstChar],
- args.maRuns.PosIsInAnyRun(firstChar));
+ fprintf(grLog(),"fallback c%d %x in run %d\n", firstChar, rArgs.mpStr[firstChar],
+ rArgs.maRuns.PosIsInAnyRun(firstChar));
#endif
// glyphs that aren't requested for fallback will be taken from base
// layout, so mark them as dropped (should this wait until Simplify(false) is called?)
- if (!args.maRuns.PosIsInAnyRun(firstChar) &&
- in_range(firstChar, args.mnMinCharPos, args.mnEndCharPos))
+ if (!rArgs.maRuns.PosIsInAnyRun(firstChar) &&
+ in_range(firstChar, rArgs.mnMinCharPos, rArgs.mnEndCharPos))
{
glyphId = GF_DROPPED;
deltaOffset -= glyphWidth;
glyphWidth = 0;
}
}
- // append this glyph.
+ // append this glyph. Set the cluster flag if this glyph is attached to another
long nGlyphFlags = bIsBase ? 0 : GlyphItem::IS_IN_CLUSTER;
- // directionality seems to be unreliable
- //nGlyphFlags |= gr::RightToLeftDir(gr::DirCode(gi.attachedClusterBase()->directionality())) ? GlyphItem::IS_RTL_GLYPH : 0;
- nGlyphFlags |= (gi.directionLevel() & 0x1)? GlyphItem::IS_RTL_GLYPH : 0;
- GlyphItem aGlyphItem(size(),//gi.logicalIndex(),
+ nGlyphFlags |= (bRtl)? GlyphItem::IS_RTL_GLYPH : 0;
+ GlyphItem aGlyphItem(mvGlyphs.size(),
glyphId,
- Point(round(gi.origin() * scaling + rDXOffset),
- round((-gi.yOffset() * scaling) - segment.AscentOffset()* scaling)),
+ Point(scaledGlyphPos + rDXOffset,
+ round((-gr_slot_origin_Y(gi) * scaling))),
nGlyphFlags,
glyphWidth);
- aGlyphItem.mnOrigWidth = round(gi.advanceWidth() * scaling);
- push_back(aGlyphItem);
+ if (glyphId != static_cast<long>(GF_DROPPED))
+ aGlyphItem.mnOrigWidth = round(gr_slot_advance_X(gi, mpFace, mpFont) * scaling);
+ mvGlyphs.push_back(aGlyphItem);
// update the offset if this glyph was dropped
rDXOffset += deltaOffset;
- // Recursively apply append all the attached glyphs.
- for (gr::GlyphSetIterator agi = iAttached.first; agi != iAttached.second; ++agi)
+ // Recursively append all the attached glyphs.
+ for (const gr_slot * agi = gr_slot_first_attachment(gi); agi != NULL;
+ agi = gr_slot_next_sibling_attachment(agi))
{
- if (agi + 1 == iAttached.second)
- append(segment, args, *agi, nextGlyphOrigin, scaling, rChar2Base, rGlyph2Char,rCharDxs, rDXOffset, false);
+ if (gr_slot_next_sibling_attachment(agi) == NULL)
+ append(pSeg, rArgs, agi, nextGlyphOrigin, scaling, rDXOffset,
+ false, baseChar);
else
- append(segment, args, *agi, (agi + 1)->origin(), scaling, rChar2Base, rGlyph2Char, rCharDxs, rDXOffset, false);
+ append(pSeg, rArgs, agi, gr_slot_origin_X(gr_slot_next_sibling_attachment(agi)),
+ scaling, rDXOffset, false, baseChar);
}
}
//
// An implementation of the SalLayout interface to enable Graphite enabled fonts to be used.
//
-GraphiteLayout::GraphiteLayout(const gr::Font & font, const grutils::GrFeatureParser * pFeatures) throw()
- : mpTextSrc(0),
- mrFont(font),
+GraphiteLayout::GraphiteLayout(const gr_face * face, gr_font * font,
+ const grutils::GrFeatureParser * pFeatures) throw()
+ : mpFace(face),
+ mpFont(font),
mnWidth(0),
mfScaling(1.0),
mpFeatures(pFeatures)
{
- // Line settings can have subtle affects on space handling
- // since we don't really know whether it is the end of a line or just a run
- // in the middle, it is hard to know what to set them to.
- // If true, it can cause end of line spaces to be hidden e.g. Doulos SIL
- maLayout.setStartOfLine(false);
- maLayout.setEndOfLine(false);
- maLayout.setDumbFallback(true);
- // trailing ws doesn't seem to always take affect if end of line is true
- maLayout.setTrailingWs(gr::ktwshAll);
-#ifdef GRLAYOUT_DEBUG
- gr::ScriptDirCode aDirCode = font.getSupportedScriptDirections();
- fprintf(grLog(),"GraphiteLayout scripts %x %lx\n", aDirCode, long(this));
-#endif
-}
+}
GraphiteLayout::~GraphiteLayout() throw()
{
clear();
- // the features are owned by the platform layers
+ // the features and font are owned by the platform layers
mpFeatures = NULL;
+ mpFont = NULL;
}
void GraphiteLayout::clear()
@@ -579,12 +521,7 @@ void GraphiteLayout::clear()
mvChar2BaseGlyph.clear();
mvGlyph2Char.clear();
-#ifndef GRCACHE
- delete mpTextSrc;
-#endif
-
// Reset the state to the empty state.
- mpTextSrc=0;
mnWidth = 0;
// Don't reset the scaling, because it is set before LayoutText
}
@@ -592,28 +529,7 @@ void GraphiteLayout::clear()
// This method shouldn't be called on windows, since it needs the dc reset
bool GraphiteLayout::LayoutText(ImplLayoutArgs & rArgs)
{
-#ifdef GRCACHE
- GrSegRecord * pSegRecord = NULL;
- gr::Segment * pSegment = NULL;
- // Graphite can in rare cases crash with a zero length
- if (rArgs.mnMinCharPos < rArgs.mnEndCharPos)
- {
- pSegment = CreateSegment(rArgs, &pSegRecord);
- if (!pSegment)
- return false;
- }
- else
- {
- clear();
- return true;
- }
- // layout the glyphs as required by OpenOffice
- bool success = LayoutGlyphs(rArgs, pSegment, pSegRecord);
-
- if (pSegRecord) pSegRecord->unlock();
- else delete pSegment;
-#else
- gr::Segment * pSegment = NULL;
+ gr_segment * pSegment = NULL;
bool success = true;
if (rArgs.mnMinCharPos < rArgs.mnEndCharPos)
{
@@ -621,88 +537,25 @@ bool GraphiteLayout::LayoutText(ImplLayoutArgs & rArgs)
if (!pSegment)
return false;
success = LayoutGlyphs(rArgs, pSegment);
- if (pSegment) delete pSegment;
+ if (pSegment)
+ {
+ gr_seg_destroy(pSegment);
+ pSegment = NULL;
+ }
}
else
{
clear();
}
-#endif
return success;
}
-#ifdef GRCACHE
-class GrFontHasher : public gr::Font
-{
-public:
- GrFontHasher(const gr::Font & aFont) : gr::Font(aFont), mrRealFont(const_cast<gr::Font&>(aFont)) {};
- ~GrFontHasher(){};
- virtual bool bold() { return mrRealFont.bold(); };
- virtual bool italic() { return mrRealFont.italic(); };
- virtual float ascent() { return mrRealFont.ascent(); };
- virtual float descent() { return mrRealFont.descent(); };
- virtual float height() { return mrRealFont.height(); };
- virtual gr::Font* copyThis() { return mrRealFont.copyThis(); };
- virtual unsigned int getDPIx() { return mrRealFont.getDPIx(); };
- virtual unsigned int getDPIy() { return mrRealFont.getDPIy(); };
- virtual const void* getTable(gr::fontTableId32 nId, size_t* nSize)
- { return mrRealFont.getTable(nId,nSize); }
- virtual void getFontMetrics(float*pA, float*pB, float*pC) { mrRealFont.getFontMetrics(pA,pB,pC); };
-
- sal_Int32 hashCode(const grutils::GrFeatureParser * mpFeatures)
- {
- // is this sufficient?
- ext_std::wstring aFace;
- bool bBold;
- bool bItalic;
- UniqueCacheInfo(aFace, bBold, bItalic);
- sal_Unicode uName[32]; // max length used in gr::Font
- // Note: graphite stores font names as UTF-16 even if wchar_t is 32bit
- // this conversion should be OK.
- for (size_t i = 0; i < aFace.size() && i < 32; i++)
- {
- uName[i] = aFace[i];
- }
- size_t iSize = aFace.size();
- if (0 == iSize) return 0;
- sal_Int32 hash = rtl_ustr_hashCode_WithLength(uName, iSize);
- hash ^= static_cast<sal_Int32>(height());
- hash |= (bBold)? 0x1000000 : 0;
- hash |= (bItalic)? 0x2000000 : 0;
- if (mpFeatures)
- hash ^= mpFeatures->hashCode();
-#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(), "font hash %x size %f\n", (int)hash, height());
-#endif
- return hash;
- };
-protected:
- virtual void UniqueCacheInfo( ext_std::wstring& stuFace, bool& fBold, bool& fItalic )
- {
-#ifdef WIN32
- dynamic_cast<GraphiteWinFont&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic);
-#else
-#ifdef UNX
- dynamic_cast<GraphiteFontAdaptor&>(mrRealFont).UniqueCacheInfo(stuFace, fBold, fItalic);
-#else
-#error Unknown base type for gr::Font::UniqueCacheInfo
-#endif
-#endif
- }
-private:
- gr::Font & mrRealFont;
-};
-#endif
-#ifdef GRCACHE
-gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs, GrSegRecord ** pSegRecord)
-#else
-gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
-#endif
+gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
{
assert(rArgs.mnLength >= 0);
- gr::Segment * pSegment = NULL;
+ gr_segment * pSegment = NULL;
// Set the SalLayouts values to be the inital ones.
SalLayout::AdjustLayout(rArgs);
@@ -717,89 +570,47 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
{
// Don't set RTL if font doesn't support it otherwise it forces rtl on
// everything
- if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl))
- maLayout.setRightToLeft(bRtl);
+ //if (bRtl && (mrFont.getSupportedScriptDirections() & gr::kfsdcHorizRtl))
+ // maLayout.setRightToLeft(bRtl);
// Context is often needed beyond the specified end, however, we don't
// want it if there has been a direction change, since it is hard
// to tell between reordering within one direction and multi-directional
// text. Extra context, can also cause problems with ligatures stradling
// a hyphenation point, so disable if CTL is disabled.
- const int nSegCharLimit = min(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ mnSegCharOffset = rArgs.mnMinCharPos;
int limit = rArgs.mnEndCharPos;
- if ((nSegCharLimit > limit) && !(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags))
- {
- limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
- nSegCharLimit - rArgs.mnEndCharPos, bRtl);
- }
-
-#ifdef GRCACHE
- GrFontHasher hasher(mrFont);
- sal_Int32 aFontHash = hasher.hashCode(mpFeatures);
- GraphiteSegmentCache * pCache =
- (GraphiteCacheHandler::instance).getCache(aFontHash);
- if (pCache)
+ if (!(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags))
{
- *pSegRecord = pCache->getSegment(rArgs, bRtl, limit);
- if (*pSegRecord)
+ const int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
+ const int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ if (nSegCharMin < mnSegCharOffset)
{
- pSegment = (*pSegRecord)->getSegment();
- mpTextSrc = (*pSegRecord)->getTextSrc();
- maLayout.setRightToLeft((*pSegRecord)->isRtl());
- if (rArgs.mpStr != mpTextSrc->getLayoutArgs().mpStr ||
- rArgs.mnMinCharPos != mpTextSrc->getLayoutArgs().mnMinCharPos ||
- rArgs.mnEndCharPos != mpTextSrc->getLayoutArgs().mnEndCharPos ||
- (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags) )
- {
- (*pSegRecord)->clearVectors();
- }
- mpTextSrc->switchLayoutArgs(rArgs);
- if (limit > rArgs.mnMinCharPos && limit == rArgs.mnEndCharPos
- && pSegment->stopCharacter() != limit)
- {
- // check that the last character is not part of a ligature
- glyph_set_range_t aGlyphSet = pSegment->charToGlyphs(limit - 1);
- if (aGlyphSet.first == aGlyphSet.second)
- {
- // no glyphs associated with this glyph - occurs mid ligature
- pSegment = NULL;
- *pSegRecord = NULL;
- }
- else
- {
- while (aGlyphSet.first != aGlyphSet.second)
- {
- int lastChar = static_cast<int>((*aGlyphSet.first).lastChar());
- if (lastChar >= limit)
- {
- pSegment = NULL;
- *pSegRecord = NULL;
- break;
- }
- aGlyphSet.first++;
- }
- }
- }
- if (pSegment)
- return pSegment;
+ int sameDirEnd = findSameDirLimit(rArgs.mpStr + nSegCharMin,
+ rArgs.mnEndCharPos - nSegCharMin, bRtl);
+ if (sameDirEnd == rArgs.mnEndCharPos)
+ mnSegCharOffset = nSegCharMin;
+ }
+ if (nSegCharLimit > limit)
+ {
+ limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
+ nSegCharLimit - rArgs.mnEndCharPos, bRtl);
}
}
-#endif
- // Create a new TextSource object for the engine.
- mpTextSrc = new TextSourceAdaptor(rArgs, limit);
- if (mpFeatures) mpTextSrc->setFeatures(mpFeatures);
+ if (mpFeatures)
+ pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures->values(), gr_utf16,
+ rArgs.mpStr + mnSegCharOffset, limit - mnSegCharOffset, bRtl);
+ else
+ pSegment = gr_make_seg(mpFont, mpFace, 0, NULL, gr_utf16,
+ rArgs.mpStr + mnSegCharOffset, limit - mnSegCharOffset, bRtl);
- pSegment = new gr::RangeSegment((gr::Font *)&mrFont, mpTextSrc, &maLayout, mnMinCharPos, limit);
+ //pSegment = new gr::RangeSegment((gr::Font *)&mrFont, mpTextSrc, &maLayout, mnMinCharPos, limit);
if (pSegment != NULL)
{
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"Gr::LayoutText %d-%d, context %d,len%d rtl%d/%d scaling %f\n", rArgs.mnMinCharPos,
- rArgs.mnEndCharPos, limit, rArgs.mnLength, maLayout.rightToLeft(), pSegment->rightToLeft(), mfScaling);
-#endif
-#ifdef GRCACHE
- // on a new segment rightToLeft should be correct
- *pSegRecord = pCache->cacheSegment(mpTextSrc, pSegment, pSegment->rightToLeft());
+ fprintf(grLog(),"Gr::LayoutText %d-%d, context %d,len%d rtl%d scaling %f\n", rArgs.mnMinCharPos,
+ rArgs.mnEndCharPos, limit, rArgs.mnLength, bRtl, mfScaling);
#endif
}
else
@@ -824,47 +635,20 @@ gr::Segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
return pSegment;
}
-#ifdef GRCACHE
-bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment, GrSegRecord * pSegRecord)
-#else
-bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
-#endif
+bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment)
{
-#ifdef GRCACHE
-#ifdef GRCACHE_REUSE_VECTORS
- // if we have an exact match, then we can reuse the glyph vectors from before
- if (pSegRecord && (pSegRecord->glyphs().size() > 0) &&
- (pSegRecord->fontScale() == mfScaling) &&
- !(SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags) )
- {
- mnWidth = pSegRecord->width();
- mvGlyphs = pSegRecord->glyphs();
- mvCharDxs = pSegRecord->charDxs();
- mvChar2BaseGlyph = pSegRecord->char2BaseGlyph();
- mvGlyph2Char = pSegRecord->glyph2Char();
- return true;
- }
-#endif
-#endif
// Calculate the initial character dxs.
mvCharDxs.assign(mnEndCharPos - mnMinCharPos, -1);
mvChar2BaseGlyph.assign(mnEndCharPos - mnMinCharPos, -1);
+ mvCharBreaks.assign(mnEndCharPos - mnMinCharPos, 0);
mnWidth = 0;
if (mvCharDxs.size() > 0)
{
// Discover all the clusters.
try
{
- // Note: we use the layout rightToLeft() because in cached segments
- // rightToLeft() may no longer be valid if the engine has been run
- // ltr since the segment was created.
-#ifdef GRCACHE
- bool bRtl = pSegRecord? pSegRecord->isRtl() : pSegment->rightToLeft();
-#else
- bool bRtl = pSegment->rightToLeft();
-#endif
- mvGlyphs.fill_from(*pSegment, rArgs, bRtl,
- mnWidth, mfScaling, mvChar2BaseGlyph, mvGlyph2Char, mvCharDxs);
+ bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL;
+ fillFrom(pSegment, rArgs, mfScaling);
if (bRtl)
{
@@ -874,17 +658,6 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr::Segment * pSegment)
// fixup last dx to ensure it always equals the width
mvCharDxs[mvCharDxs.size() - 1] = mnWidth;
}
-#ifdef GRCACHE
-#ifdef GRCACHE_REUSE_VECTORS
- if (pSegRecord && rArgs.maReruns.IsEmpty() &&
- !(SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags))
- {
- pSegRecord->setGlyphVectors(mnWidth, mvGlyphs, mvCharDxs,
- mvChar2BaseGlyph, mvGlyph2Char,
- mfScaling);
- }
-#endif
-#endif
}
catch (std::exception e)
{
@@ -920,24 +693,36 @@ int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) c
return STRING_LEN;
long nWidth = mvCharDxs[0] * factor;
+ long wLastBreak = 0;
int nLastBreak = -1;
+ int nEmergency = -1;
for (size_t i = 1; i < mvCharDxs.size(); i++)
{
nWidth += char_extra;
if (nWidth > maxmnWidth) break;
if (mvChar2BaseGlyph[i] != -1)
{
- if (mvChar2BaseGlyph[i] & (WORD_BREAK_BEFORE | HYPHEN_BREAK_BEFORE))
+ if (
+ (mvCharBreaks[i] > -25 || (mvCharBreaks[i-1] > 0 && mvCharBreaks[i-1] < 25)) &&
+ (mvCharBreaks[i-1] < 25 || (mvCharBreaks[i] < 0 && mvCharBreaks[i] > -25))
+ )
+ {
nLastBreak = static_cast<int>(i);
+ wLastBreak = nWidth;
+ }
+ nEmergency = static_cast<int>(i);
}
nWidth += (mvCharDxs[i] - mvCharDxs[i-1]) * factor;
}
int nBreak = mnMinCharPos;
- if (nLastBreak > -1)
+ if (wLastBreak > 9 * maxmnWidth / 10)
nBreak += nLastBreak;
+ else
+ if (nEmergency > -1)
+ nBreak += nEmergency;
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(), "Gr::GetTextBreak break after %d\n", nBreak - mnMinCharPos);
+ fprintf(grLog(), "Gr::GetTextBreak break after %d, weights(%d, %d)\n", nBreak - mnMinCharPos, mvCharBreaks[nBreak - mnMinCharPos], mvCharBreaks[nBreak - mnMinCharPos - 1]);
#endif
if (nBreak > mnEndCharPos) nBreak = STRING_LEN;
@@ -945,7 +730,6 @@ int GraphiteLayout::GetTextBreak(long maxmnWidth, long char_extra, int factor) c
return nBreak;
}
-
long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
{
if (mnEndCharPos == mnMinCharPos)
@@ -957,9 +741,9 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
for (size_t i = 0; i < mvCharDxs.size(); i++)
{
assert( (mvChar2BaseGlyph[i] == -1) ||
- ((signed)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK) < (signed)mvGlyphs.size()));
+ ((signed)(mvChar2BaseGlyph[i]) < (signed)mvGlyphs.size()));
if (mvChar2BaseGlyph[i] != -1 &&
- mvGlyphs[mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK].mnGlyphIndex == GF_DROPPED)
+ mvGlyphs[mvChar2BaseGlyph[i]].mnGlyphIndex == GF_DROPPED)
{
// when used in MultiSalLayout::GetTextBreak dropped glyphs
// must have zero width
@@ -980,12 +764,11 @@ long GraphiteLayout::FillDXArray( sal_Int32* pDXArray ) const
//fprintf(grLog(),"FillDX %ld,%d\n", mnWidth, std::accumulate(pDXArray, pDXArray + mvCharDxs.size(), 0));
}
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"FillDXArray %d-%d,%d=%ld\n", mnMinCharPos, mnEndCharPos, (int)mpTextSrc->getLength(), mnWidth);
+ fprintf(grLog(),"FillDXArray %d-%d=%ld\n", mnMinCharPos, mnEndCharPos, mnWidth);
#endif
return mnWidth;
}
-
void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs)
{
SalLayout::AdjustLayout(rArgs);
@@ -1031,6 +814,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
int nDeltaWidth = rArgs.mnLayoutWidth - mnWidth;
if (nDeltaWidth > 0) // expand, just expand between clusters
{
+ // NOTE: for expansion we can use base glyphs (which have IsClusterStart set)
+ // even though they may have been reordered in which case they will have
+ // been placed in a bigger cluster for other purposes.
int nClusterCount = 0;
for (size_t j = 0; j < mvGlyphs.size(); j++)
{
@@ -1048,15 +834,18 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
{
if (mvGlyphs[i].IsClusterStart())
{
- nOffset = FRound( fExtraPerCluster * nCluster );
- size_t nCharIndex = mvGlyph2Char[i];
- mvCharDxs[nCharIndex] += nOffset;
+ nOffset = static_cast<int>(fExtraPerCluster * nCluster);
+ int nCharIndex = mvGlyph2Char[i];
+ assert(nCharIndex > -1);
+ mvCharDxs[nCharIndex-mnMinCharPos] += nOffset;
// adjust char dxs for rest of characters in cluster
- while (++nCharIndex < mvGlyph2Char.size())
+ while (++nCharIndex < static_cast<int>(mvGlyph2Char.size()))
{
- int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : (int)(mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK);
+ int nChar2Base = mvChar2BaseGlyph[nCharIndex-mnMinCharPos];
if (nChar2Base == -1 || nChar2Base == static_cast<int>(i))
- mvCharDxs[nCharIndex] += nOffset;
+ mvCharDxs[nCharIndex-mnMinCharPos] += nOffset;
+ else
+ break;
}
++nCluster;
}
@@ -1064,25 +853,27 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
}
}
}
- else // condense - apply a factor to all glyph positions
+ else if (nDeltaWidth < 0)// condense - apply a factor to all glyph positions
{
if (mvGlyphs.size() == 0) return;
Glyphs::iterator iLastGlyph = mvGlyphs.begin() + (mvGlyphs.size() - 1);
// position last glyph using original width
float fXFactor = static_cast<float>(rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth) / static_cast<float>(iLastGlyph->maLinearPos.X());
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(), "Condense by factor %f\n", fXFactor);
+ fprintf(grLog(), "Condense by factor %f last x%ld\n", fXFactor, iLastGlyph->maLinearPos.X());
#endif
+ if (fXFactor < 0)
+ return; // probably a bad mnOrigWidth value
iLastGlyph->maLinearPos.X() = rArgs.mnLayoutWidth - iLastGlyph->mnOrigWidth;
Glyphs::iterator iGlyph = mvGlyphs.begin();
while (iGlyph != iLastGlyph)
{
- iGlyph->maLinearPos.X() = FRound( fXFactor * iGlyph->maLinearPos.X() );
+ iGlyph->maLinearPos.X() = static_cast<int>(static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor);
++iGlyph;
}
for (size_t i = 0; i < mvCharDxs.size(); i++)
{
- mvCharDxs[i] = FRound( fXFactor * mvCharDxs[i] );
+ mvCharDxs[i] = static_cast<int>(fXFactor * static_cast<float>(mvCharDxs[i]));
}
}
mnWidth = rArgs.mnLayoutWidth;
@@ -1108,7 +899,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
int nPrevClusterLastChar = -1;
for (size_t i = 0; i < nChars; i++)
{
- int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : (int)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK);
+ int nChar2Base = mvChar2BaseGlyph[i];
if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph))
{
assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size()));
@@ -1120,11 +911,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
size_t j = i + 1;
int nLastChar = i;
int nLastGlyph = nChar2Base;
+ int nChar2BaseJ = -1;
for (; j < nChars; j++)
{
- int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : (int)(mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK);
+ nChar2BaseJ = mvChar2BaseGlyph[j];
assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size()));
- if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart())
+ if (nChar2BaseJ != -1 )
{
nLastGlyph = nChar2BaseJ + ((bRtl)? +1 : -1);
nLastChar = j - 1;
@@ -1152,6 +944,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
nLastChar = nChars - 1;
if (!bRtl) nLastGlyph = mvGlyphs.size() - 1;
}
+ int nBaseCount = 0;
+ // count bases within cluster - may be more than 1 with reordering
+ for (int k = nChar2Base; k <= nLastGlyph; k++)
+ {
+ if (mvGlyphs[k].IsClusterStart()) ++nBaseCount;
+ }
assert((nLastChar > -1) && (nLastChar < (signed)nChars));
long nNewClusterWidth = args.mpDXArray[nLastChar];
long nOrigClusterWidth = mvCharDxs[nLastChar];
@@ -1173,21 +971,25 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
mvGlyphs[nLastGlyph].mnNewWidth += nDWidth;
else
nDGlyphOrigin += nDWidth;
+ long nDOriginPerBase = (nBaseCount > 0)? nDWidth / nBaseCount : 0;
+ nBaseCount = -1;
// update glyph positions
if (bRtl)
{
for (int n = nChar2Base; n <= nLastGlyph; n++)
{
+ if (mvGlyphs[n].IsClusterStart()) ++nBaseCount;
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
- mvGlyphs[n].maLinearPos.X() += -nDGlyphOrigin + nXOffset;
+ mvGlyphs[n].maLinearPos.X() += -(nDGlyphOrigin + nDOriginPerBase * nBaseCount) + nXOffset;
}
}
else
{
for (int n = nChar2Base; n <= nLastGlyph; n++)
{
+ if (mvGlyphs[n].IsClusterStart()) ++nBaseCount;
assert((n > - 1) && (n < (signed)mvGlyphs.size()));
- mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + nXOffset;
+ mvGlyphs[n].maLinearPos.X() += nDGlyphOrigin + (nDOriginPerBase * nBaseCount) + nXOffset;
}
}
rDeltaWidth[nChar2Base] = nDWidth;
@@ -1262,7 +1064,7 @@ void GraphiteLayout::kashidaJustify(std::vector<int>& rDeltaWidths, sal_GlyphId
{
(*(i)).maLinearPos.X() -= nGapWidth;
nGapWidth -= nKashidaWidth;
- i++;
+ ++i;
}
// fixup rightmost kashida for gap remainder
@@ -1290,15 +1092,15 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
std::fill(pCaretXArray, pCaretXArray + nArraySize, -1);
// the layout method doesn't modify the layout even though it isn't
// const in the interface
- bool bRtl = const_cast<GraphiteLayout*>(this)->maLayout.rightToLeft();
+ bool bRtl = (mnLayoutFlags & SAL_LAYOUT_BIDI_RTL);//const_cast<GraphiteLayout*>(this)->maLayout.rightToLeft();
int prevBase = -1;
long prevClusterWidth = 0;
for (int i = 0, nCharSlot = 0; i < nArraySize && nCharSlot < static_cast<int>(mvCharDxs.size()); ++nCharSlot, i+=2)
{
if (mvChar2BaseGlyph[nCharSlot] != -1)
{
- int nChar2Base = mvChar2BaseGlyph[nCharSlot] & GLYPH_INDEX_MASK;
- assert((mvChar2BaseGlyph[nCharSlot] > -1) && (nChar2Base < (signed)mvGlyphs.size()));
+ int nChar2Base = mvChar2BaseGlyph[nCharSlot];
+ assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size()));
GlyphItem gi = mvGlyphs[nChar2Base];
if (gi.mnGlyphIndex == GF_DROPPED)
{
@@ -1315,8 +1117,8 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
origClusterWidth += mvGlyphs[nCluster].mnNewWidth;
if (mvGlyph2Char[nCluster] == nCharSlot)
{
- nMin = std::min(nMin, mvGlyphs[nCluster].maLinearPos.X());
- nMax = std::min(nMax, mvGlyphs[nCluster].maLinearPos.X() + mvGlyphs[nCluster].mnNewWidth);
+ nMin = minimum(nMin, mvGlyphs[nCluster].maLinearPos.X());
+ nMax = maximum(nMax, mvGlyphs[nCluster].maLinearPos.X() + mvGlyphs[nCluster].mnNewWidth);
}
}
if (bRtl)
@@ -1348,12 +1150,10 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
break;
}
}
- long nGWidth = gi.mnNewWidth;
// if no match position at end of cluster
if (nGlyph == static_cast<int>(mvGlyphs.size()) ||
mvGlyphs[nGlyph].IsClusterStart())
{
- nGWidth = prevClusterWidth;
if (bRtl)
{
pCaretXArray[i+1] = gi.maLinearPos.X();
@@ -1392,7 +1192,6 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray
#endif
}
-
// GetNextGlyphs returns a contiguous sequence of glyphs that can be
// rendered together. It should never return a dropped glyph.
// The glyph_slot returned should be the index of the next visible
@@ -1420,7 +1219,7 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
++glyph_slot) {};
// Update the length
- const int nGlyphSlotEnd = std::min(size_t(glyph_slot + length), mvGlyphs.size());
+ const int nGlyphSlotEnd = minimum(size_t(glyph_slot + length), mvGlyphs.size());
// We're all out of glyphs here.
if (glyph_slot == nGlyphSlotEnd)
@@ -1438,17 +1237,23 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
//aPosOut = glyph_itr->maLinearPos;
aPosOut = GetDrawPosition(aStartPos);
-
for (;;) // Forever
{
// last index of the range from glyph_to_chars does not include this glyph
if (char_index)
{
- assert((glyph_slot >= -1) && (glyph_slot < (signed)mvGlyph2Char.size()));
- if (mvGlyph2Char[glyph_slot] == -1)
- *char_index++ = mvCharDxs.size();
- else
- *char_index++ = mvGlyph2Char[glyph_slot];
+ if (glyph_slot >= (signed)mvGlyph2Char.size())
+ {
+ *char_index++ = mnMinCharPos + mvCharDxs.size();
+ }
+ else
+ {
+ assert(glyph_slot > -1);
+ if (mvGlyph2Char[glyph_slot] == -1)
+ *char_index++ = mnMinCharPos + mvCharDxs.size();
+ else
+ *char_index++ = mvGlyph2Char[glyph_slot];
+ }
}
// Copy out this glyphs data.
++glyph_slot;
@@ -1461,8 +1266,9 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
((glyph_itr+1)->maLinearPos.X() - glyph_itr->maLinearPos.X());
#ifdef GRLAYOUT_DEBUG
- fprintf(grLog(),"GetNextGlyphs g%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n", glyph_slot - 1,
- GLYPH_INDEX_MASK&mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
+ fprintf(grLog(),"GetNextGlyphs g%d gid%d c%d x%ld,%ld adv%ld, pos %ld,%ld\n",
+ glyph_slot - 1, glyph_itr->mnGlyphIndex,
+ mvGlyph2Char[glyph_slot-1], glyph_itr->maLinearPos.X(), glyph_itr->maLinearPos.Y(), nGlyphAdvance,
aPosOut.X(), aPosOut.Y());
#endif
@@ -1492,7 +1298,6 @@ int GraphiteLayout::GetNextGlyphs( int length, sal_GlyphId * glyph_out,
return numGlyphs;
}
-
void GraphiteLayout::MoveGlyph( int nGlyphIndex, long nNewPos )
{
// TODO it might be better to actualy implement simplify properly, but this
@@ -1519,7 +1324,6 @@ void GraphiteLayout::MoveGlyph( int nGlyphIndex, long nNewPos )
mnWidth += dx;
}
-
void GraphiteLayout::DropGlyph( int nGlyphIndex )
{
if(nGlyphIndex >= signed(mvGlyphs.size()))
@@ -1551,7 +1355,6 @@ void GraphiteLayout::Simplify( bool isBaseLayout )
{
deltaX = 0;
}
- //mvCharDxs[mvGlyph2Char[gi->mnCharPos]] -= deltaX;
++gi;
}
#ifdef GRLAYOUT_DEBUG
@@ -1560,3 +1363,5 @@ void GraphiteLayout::Simplify( bool isBaseLayout )
// discard width from trailing dropped glyphs, but not those in the middle
mnWidth -= deltaX;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/graphite_serverfont.cxx b/vcl/source/glyphs/graphite_serverfont.cxx
index ceba4dd4f6c8..4ce0ebcc3f31 100644
--- a/vcl/source/glyphs/graphite_serverfont.cxx
+++ b/vcl/source/glyphs/graphite_serverfont.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -35,44 +36,119 @@
//
// Platform
-#include <sallayout.hxx>
+#include <i18npool/mslangid.hxx>
// Module
#include "gcach_ftyp.hxx"
+#include <vcl/glyphcache.hxx>
#include <graphite_features.hxx>
-#include "graphite_textsrc.hxx"
+//#include "graphite_textsrc.hxx"
#include <graphite_serverfont.hxx>
#ifndef WNT
+float freetypeServerFontAdvance(const void* appFontHandle, gr_uint16 glyphId)
+{
+ FreetypeServerFont * pServerFont =
+ const_cast<FreetypeServerFont*>
+ (reinterpret_cast<const FreetypeServerFont*>(appFontHandle));
+ if (pServerFont)
+ {
+ return static_cast<float>(pServerFont->GetGlyphMetric(glyphId).GetCharWidth());
+ }
+ return .0f;
+}
+
//
// An implementation of the GraphiteLayout interface to enable Graphite enabled fonts to be used.
//
-GraphiteServerFontLayout::GraphiteServerFontLayout(GraphiteFontAdaptor * pFont) throw()
- : ServerFontLayout(pFont->font()), mpFont(pFont),
- maImpl(*mpFont, mpFont->features(), pFont)
+GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont & rServerFont) throw()
+ : ServerFontLayout(rServerFont),
+ maImpl(dynamic_cast<FreetypeServerFont&>(rServerFont).GetGraphiteFace()->face(),
+ rServerFont),
+ mpFeatures(NULL)
{
- // Nothing needed here
+ FreetypeServerFont& rFTServerFont = dynamic_cast<FreetypeServerFont&>(rServerFont);
+ gr_font * pFont = rFTServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight);
+ if (!pFont)
+ {
+ pFont = gr_make_font_with_advance_fn(
+ // need to use mnHeight here, mfExactHeight can give wrong values
+ static_cast<float>(rServerFont.GetFontSelData().mnHeight),
+ &rFTServerFont,
+ freetypeServerFontAdvance,
+ rFTServerFont.GetGraphiteFace()->face());
+ rFTServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont);
+ }
+ maImpl.SetFont(pFont);
+ rtl::OString aLang("");
+ if (rServerFont.GetFontSelData().meLanguage != LANGUAGE_DONTKNOW)
+ {
+ aLang = MsLangId::convertLanguageToIsoByteString(
+ rServerFont.GetFontSelData().meLanguage );
+ }
+ rtl::OString name = rtl::OUStringToOString(
+ rServerFont.GetFontSelData().maTargetName, RTL_TEXTENCODING_UTF8 );
+#ifdef DEBUG
+ printf("GraphiteServerFontLayout %lx %s size %d %f\n", (long unsigned int)this, name.getStr(),
+ rFTServerFont.GetMetricsFT().x_ppem,
+ rServerFont.GetFontSelData().mfExactHeight);
+#endif
+ sal_Int32 nFeat = name.indexOf(grutils::GrFeatureParser::FEAT_PREFIX) + 1;
+ if (nFeat > 0)
+ {
+ rtl::OString aFeat = name.copy(nFeat, name.getLength() - nFeat);
+ mpFeatures = new grutils::GrFeatureParser(
+ rFTServerFont.GetGraphiteFace()->face(), aFeat, aLang);
+#ifdef DEBUG
+ if (mpFeatures)
+ printf("GraphiteServerFontLayout %s/%s/%s %x language %d features %d errors\n",
+ rtl::OUStringToOString( rServerFont.GetFontSelData().maName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( rServerFont.GetFontSelData().maTargetName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( rServerFont.GetFontSelData().maSearchName,
+ RTL_TEXTENCODING_UTF8 ).getStr(),
+ rServerFont.GetFontSelData().meLanguage,
+ (int)mpFeatures->numFeatures(), mpFeatures->parseErrors());
+#endif
+ }
+ else
+ {
+ mpFeatures = new grutils::GrFeatureParser(
+ rFTServerFont.GetGraphiteFace()->face(), aLang);
+ }
+ maImpl.SetFeatures(mpFeatures);
}
GraphiteServerFontLayout::~GraphiteServerFontLayout() throw()
{
- delete mpFont;
- mpFont = NULL;
+ delete mpFeatures;
+ mpFeatures = NULL;
}
-const sal_Unicode* GraphiteServerFontLayout::getTextPtr() const
+bool GraphiteServerFontLayout::IsGraphiteEnabledFont(ServerFont * pServerFont)
{
- return maImpl.textSrc()->getLayoutArgs().mpStr +
- maImpl.textSrc()->getLayoutArgs().mnMinCharPos;
+ FreetypeServerFont * pFtServerFont = dynamic_cast<FreetypeServerFont*>(pServerFont);
+ if (pFtServerFont)
+ {
+ if (pFtServerFont->GetGraphiteFace())
+ {
+#ifdef DEBUG
+ printf("IsGraphiteEnabledFont\n");
+#endif
+ return true;
+ }
+ }
+ return false;
}
sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width)
{
- int nKashidaIndex = mpFont->font().GetGlyphIndex( 0x0640 );
+ int nKashidaIndex = mrServerFont.GetGlyphIndex( 0x0640 );
if( nKashidaIndex != 0 )
{
- const GlyphMetric& rGM = mpFont->font().GetGlyphMetric( nKashidaIndex );
+ const GlyphMetric& rGM = mrServerFont.GetGlyphMetric( nKashidaIndex );
width = rGM.GetCharWidth();
}
else
@@ -83,3 +159,5 @@ sal_GlyphId GraphiteLayoutImpl::getKashidaGlyph(int & width)
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/graphite_textsrc.cxx b/vcl/source/glyphs/graphite_textsrc.cxx
index ac5fd0c558af..0758c10564c6 100644
--- a/vcl/source/glyphs/graphite_textsrc.cxx
+++ b/vcl/source/glyphs/graphite_textsrc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -135,16 +136,16 @@ gr::isocode TextSourceAdaptor::getLanguage(gr::toffset)
return unknown;
}
-ext_std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
+std::pair<gr::toffset, gr::toffset> TextSourceAdaptor::propertyRange(gr::toffset nCharIdx)
{
if (nCharIdx < unsigned(maLayoutArgs.mnMinCharPos))
- return ext_std::make_pair(0, maLayoutArgs.mnMinCharPos);
+ return std::make_pair(0, maLayoutArgs.mnMinCharPos);
if (nCharIdx < mnEnd)
- return ext_std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
+ return std::make_pair(maLayoutArgs.mnMinCharPos, mnEnd);
- return ext_std::make_pair(mnEnd, maLayoutArgs.mnLength);
+ return std::make_pair(mnEnd, maLayoutArgs.mnLength);
}
size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * settings)
@@ -156,7 +157,7 @@ size_t TextSourceAdaptor::getFontFeatures(gr::toffset, gr::FeatureSetting * sett
bool TextSourceAdaptor::sameSegment(gr::toffset char_idx1, gr::toffset char_idx2)
{
- const ext_std::pair<gr::toffset, gr::toffset>
+ const std::pair<gr::toffset, gr::toffset>
range1 = propertyRange(char_idx1),
range2 = propertyRange(char_idx2);
@@ -167,3 +168,5 @@ void TextSourceAdaptor::setFeatures(const grutils::GrFeatureParser * pFeatures)
{
mpFeatures = new grutils::GrFeatureParser(*pFeatures);
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx
index ece01cc1a532..f40f6052725d 100644
--- a/vcl/source/glyphs/graphite_textsrc.hxx
+++ b/vcl/source/glyphs/graphite_textsrc.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -39,23 +40,18 @@
#include <stdexcept>
// Platform
-#ifndef _SVWIN_H
-#include <tools/svwin.h>
+#ifdef WNT
+#include <windows.h>
#endif
-#include <svsys.h>
-#include <salgdi.hxx>
-#include <sallayout.hxx>
// Module
#include "vcl/dllapi.h"
// Libraries
-#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-#include <postextstl.h>
// Module type definitions and forward declarations.
//
@@ -82,7 +78,7 @@ public:
virtual float getVerticalOffset(gr::toffset ich);
virtual gr::isocode getLanguage(gr::toffset ich);
- virtual ext_std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
+ virtual std::pair<gr::toffset, gr::toffset> propertyRange(gr::toffset ich);
virtual size_t getFontFeatures(gr::toffset ich, gr::FeatureSetting * prgfset);
virtual bool sameSegment(gr::toffset ich1, gr::toffset ich2);
virtual bool featureVariations() { return false; }
@@ -121,3 +117,5 @@ inline void TextSourceAdaptor::switchLayoutArgs(ImplLayoutArgs & aNewArgs)
}
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx
index f541ad92b552..d86a0a07bedf 100644
--- a/vcl/source/helper/canvasbitmap.cxx
+++ b/vcl/source/helper/canvasbitmap.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -34,7 +35,7 @@
#include <com/sun/star/rendering/RenderingIntent.hpp>
#include <rtl/instance.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <tools/diagnose_ex.h>
#include <canvasbitmap.hxx>
@@ -367,7 +368,7 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) :
break;
default:
- DBG_ERROR( "unsupported bitmap format" );
+ OSL_FAIL( "unsupported bitmap format" );
break;
}
@@ -445,20 +446,20 @@ VclCanvasBitmap::~VclCanvasBitmap()
// XBitmap
geometry::IntegerSize2D SAL_CALL VclCanvasBitmap::getSize() throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return integerSize2DFromSize( m_aBitmap.GetSizePixel() );
}
::sal_Bool SAL_CALL VclCanvasBitmap::hasAlpha() throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return m_aBmpEx.IsTransparent();
}
uno::Reference< rendering::XBitmap > SAL_CALL VclCanvasBitmap::getScaledBitmap( const geometry::RealSize2D& newSize,
sal_Bool beFast ) throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
BitmapEx aNewBmp( m_aBitmap );
aNewBmp.Scale( sizeFromRealSize2D( newSize ), beFast ? BMP_SCALE_FAST : BMP_SCALE_INTERPOLATE );
@@ -471,7 +472,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB
rendering::VolatileContentDestroyedException,
uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
bitmapLayout = getMemoryLayout();
@@ -576,7 +577,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
rendering::VolatileContentDestroyedException,
uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
bitmapLayout = getMemoryLayout();
@@ -642,7 +643,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getPixel( rendering::Integer
uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette() throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
uno::Reference< XBitmapPalette > aRet;
if( m_bPalette )
@@ -653,7 +654,7 @@ uno::Reference< rendering::XBitmapPalette > SAL_CALL VclCanvasBitmap::getPalette
rendering::IntegerBitmapLayout SAL_CALL VclCanvasBitmap::getMemoryLayout() throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
rendering::IntegerBitmapLayout aLayout( m_aLayout );
@@ -670,7 +671,7 @@ rendering::IntegerBitmapLayout SAL_CALL VclCanvasBitmap::getMemoryLayout() throw
sal_Int32 SAL_CALL VclCanvasBitmap::getNumberOfEntries() throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
if( !m_pBmpAcc )
return 0;
@@ -680,13 +681,13 @@ sal_Int32 SAL_CALL VclCanvasBitmap::getNumberOfEntries() throw (uno::RuntimeExce
sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_uInt16 nCount( m_pBmpAcc ?
(m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 );
OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range");
if( nIndex < 0 || nIndex >= nCount )
- throw lang::IndexOutOfBoundsException(::rtl::OUString::createFromAscii("Palette index out of range"),
+ throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")),
static_cast<rendering::XBitmapPalette*>(this));
const BitmapColor aCol = m_pBmpAcc->GetPaletteColor(sal::static_int_cast<sal_uInt16>(nIndex));
@@ -701,14 +702,14 @@ sal_Bool SAL_CALL VclCanvasBitmap::getIndex( uno::Sequence< double >& o_entry, s
sal_Bool SAL_CALL VclCanvasBitmap::setIndex( const uno::Sequence< double >&, sal_Bool, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::IllegalArgumentException, uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_uInt16 nCount( m_pBmpAcc ?
(m_pBmpAcc->HasPalette() ? m_pBmpAcc->GetPaletteEntryCount() : 0 ) : 0 );
OSL_ENSURE(nIndex >= 0 && nIndex < nCount,"Palette index out of range");
if( nIndex < 0 || nIndex >= nCount )
- throw lang::IndexOutOfBoundsException(::rtl::OUString::createFromAscii("Palette index out of range"),
+ throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Palette index out of range")),
static_cast<rendering::XBitmapPalette*>(this));
return sal_False; // read-only implementation
@@ -740,7 +741,7 @@ sal_Int8 SAL_CALL VclCanvasBitmap::getType( ) throw (uno::RuntimeException)
uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::getComponentTags( ) throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return m_aComponentTags;
}
@@ -766,7 +767,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertColorSpace( const uno::
uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( deviceColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -815,7 +816,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertToRGB( const
uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( deviceColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -868,7 +869,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con
uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( deviceColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -921,7 +922,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( co
uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -961,7 +962,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Seq
uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -1001,7 +1002,7 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Se
uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -1043,19 +1044,19 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::S
sal_Int32 SAL_CALL VclCanvasBitmap::getBitsPerPixel( ) throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return m_nBitsPerOutputPixel;
}
uno::Sequence< ::sal_Int32 > SAL_CALL VclCanvasBitmap::getComponentBitCounts( ) throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return m_aComponentBitCounts;
}
sal_Int8 SAL_CALL VclCanvasBitmap::getEndianness( ) throw (uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
return m_nEndianness;
}
@@ -1064,7 +1065,7 @@ uno::Sequence<double> SAL_CALL VclCanvasBitmap::convertFromIntegerColorSpace( co
{
if( dynamic_cast<VclCanvasBitmap*>(targetColorSpace.get()) )
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( deviceColor.getLength() );
const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength());
@@ -1143,7 +1144,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertToIntegerColorSpace
uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) );
const sal_Size nLen( deviceColor.getLength() );
@@ -1198,7 +1199,7 @@ uno::Sequence<rendering::RGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToRGB
uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) );
const sal_Size nLen( deviceColor.getLength() );
@@ -1256,7 +1257,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR
uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_uInt8* pIn( reinterpret_cast<const sal_uInt8*>(deviceColor.getConstArray()) );
const sal_Size nLen( deviceColor.getLength() );
@@ -1315,7 +1316,7 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPA
uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8);
@@ -1364,7 +1365,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( con
uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8);
@@ -1413,7 +1414,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co
uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException)
{
- vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
const sal_Size nLen( rgbColor.getLength() );
const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8);
@@ -1465,3 +1466,5 @@ BitmapEx VclCanvasBitmap::getBitmapEx() const
{
return m_aBmpEx;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx
index 1ab4f9a619d0..930be4d27931 100644
--- a/vcl/source/helper/canvastools.cxx
+++ b/vcl/source/helper/canvastools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -71,7 +72,7 @@
#include <canvasbitmap.hxx>
#include <vcl/canvastools.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
using namespace ::com::sun::star;
@@ -186,8 +187,8 @@ namespace vcl
const uno::Sequence< sal_Int8 > getTunnelIdentifier( TunnelIdentifierType eType )
{
- static std::hash_map< int, uno::Sequence< sal_Int8 > > aIds;
- std::hash_map< int, uno::Sequence< sal_Int8 > >::iterator it =
+ static boost::unordered_map< int, uno::Sequence< sal_Int8 > > aIds;
+ boost::unordered_map< int, uno::Sequence< sal_Int8 > >::iterator it =
aIds.find( eType );
if( it == aIds.end() )
{
@@ -819,13 +820,13 @@ namespace vcl
const uno::Sequence< double > rColor,
const uno::Reference< rendering::XColorSpace >& xColorSpace )
{
- const rendering::ARGBColor& rARGBColor(
+ const rendering::ARGBColor aARGBColor(
xColorSpace->convertToARGB(rColor)[0]);
- return Color( 255-toByteColor(rARGBColor.Alpha),
- toByteColor(rARGBColor.Red),
- toByteColor(rARGBColor.Green),
- toByteColor(rARGBColor.Blue) );
+ return Color( 255-toByteColor(aARGBColor.Alpha),
+ toByteColor(aARGBColor.Red),
+ toByteColor(aARGBColor.Green),
+ toByteColor(aARGBColor.Blue) );
}
//---------------------------------------------------------------------------------------
@@ -835,3 +836,5 @@ namespace vcl
} // namespace canvas
// eof
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/evntpost.cxx b/vcl/source/helper/evntpost.cxx
index 9e200a3136c3..a8a68640ec36 100644
--- a/vcl/source/helper/evntpost.cxx
+++ b/vcl/source/helper/evntpost.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -63,3 +64,5 @@ IMPL_LINK_INLINE_START( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
IMPL_LINK_INLINE_END( EventPoster, DoEvent_Impl, UserEvent*, pEvent )
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx
index b8ede1b5220a..3fa046bc076c 100644
--- a/vcl/source/helper/lazydelete.cxx
+++ b/vcl/source/helper/lazydelete.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -123,3 +124,4 @@ void DeleteOnDeinitBase::ImplDeleteOnDeInit()
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index b1da78ebbf23..c8b5cc7fbf22 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -440,3 +441,5 @@ ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect )
}
} // namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx
index cff1ec4a7d82..ad351410e2c2 100644
--- a/vcl/source/helper/threadex.cxx
+++ b/vcl/source/helper/threadex.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -101,7 +102,7 @@ IMPL_LINK( SolarThreadExecutor, worker, void*, EMPTYARG )
long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout )
{
- if( ::vos::OThread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() )
+ if( ::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() )
{
osl_setCondition( m_aStart );
m_nReturn = doIt();
@@ -125,3 +126,5 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout )
}
return m_nReturn;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx
index d8bd96cfd0cf..5250cc067b25 100644
--- a/vcl/source/helper/xconnection.cxx
+++ b/vcl/source/helper/xconnection.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -40,31 +41,12 @@ namespace css = com::sun::star;
}
-namespace vcl
-{
- class SolarMutexReleaser
- {
- sal_uLong mnReleased;
- public:
- SolarMutexReleaser()
- {
- mnReleased = Application::ReleaseSolarMutex();
- }
-
- ~SolarMutexReleaser()
- {
- if( mnReleased )
- Application::AcquireSolarMutex( mnReleased );
- }
- };
-}
-
-using namespace rtl;
using namespace osl;
using namespace vcl;
using namespace com::sun::star::uno;
using namespace com::sun::star::awt;
+using ::rtl::OUString;
DisplayConnection::DisplayConnection()
{
@@ -178,3 +160,5 @@ bool DisplayConnection::dispatchErrorEvent( void* pData, int nBytes )
return false;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/salmain/salmain.cxx b/vcl/source/salmain/salmain.cxx
index 56f197966276..80e853b3b654 100644
--- a/vcl/source/salmain/salmain.cxx
+++ b/vcl/source/salmain/salmain.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -37,5 +38,7 @@
SAL_IMPLEMENT_MAIN() {
tools::extendApplicationEnvironment();
- return SVMain() ? EXIT_SUCCESS : EXIT_FAILURE;
+ return SVMain();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src
index a8962044b47d..44561a89f513 100644
--- a/vcl/source/src/btntext.src
+++ b/vcl/source/src/btntext.src
@@ -78,4 +78,3 @@ String SV_BUTTONTEXT_ABORT
{
Text [ en-US ] = "~Abort";
};
-
diff --git a/vcl/source/src/helptext.src b/vcl/source/src/helptext.src
index f66683bfd5dc..1f3def6f8cd4 100644
--- a/vcl/source/src/helptext.src
+++ b/vcl/source/src/helptext.src
@@ -136,26 +136,3 @@ String SV_SHORTCUT_SPLITTER
{
Text [ en-US ] = "Split window separator" ;
};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src
index 987ee29277c7..f836306cba45 100644
--- a/vcl/source/src/images.src
+++ b/vcl/source/src/images.src
@@ -33,7 +33,7 @@
Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_STDOFFSET)
{
- File = "check.bmp";
+ File = "check.png";
};
@@ -44,19 +44,19 @@ Bitmap (SV_RESID_BITMAP_CHECK + SV_RESID_MONOOFFSET)
Bitmap (SV_RESID_BITMAP_SCROLLBMP)
{
- File = "scrbmp.bmp";
+ File = "scrbmp.png";
};
Bitmap (SV_RESID_BITMAP_SCROLLMSK)
{
- File = "scrmsk.bmp";
+ File = "scrmsk.png";
};
// -----------------------------------------------------------------------
Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_STDOFFSET)
{
- File = "radio.bmp";
+ File = "radio.png";
};
Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET)
@@ -64,63 +64,41 @@ Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET)
File = "radiomono.bmp";
};
-// -----------------------------------------------------------------------
-
Bitmap SV_RESID_BITMAP_MSGBOX
{
File = "msgbox.png";
};
-// -----------------------------------------------------------------------
-
-Bitmap SV_RESID_BITMAP_MSGBOX_HC
-{
- File = "msgbox_hc.png";
-};
-
-// -----------------------------------------------------------------------
-
Bitmap SV_RESID_BITMAP_PIN
{
- File = "pin.bmp";
+ File = "pin.png";
};
-// -----------------------------------------------------------------------
-
Bitmap SV_RESID_BITMAP_CLOSEDOC
{
- File = "closedoc.bmp";
-};
-
-Bitmap SV_RESID_BITMAP_CLOSEDOCHC
-{
- File = "closedochc.bmp";
+ File = "closedoc.png";
};
-// -----------------------------------------------------------------------
-
Bitmap SV_RESID_BITMAP_SPLITHPIN
{
- File = "splhpin.bmp";
+ File = "splhpin.png";
};
Bitmap SV_RESID_BITMAP_SPLITVPIN
{
- File = "splvpin.bmp";
+ File = "splvpin.png";
};
Bitmap SV_RESID_BITMAP_SPLITHARW
{
- File = "splharw.bmp";
+ File = "splharw.png";
};
Bitmap SV_RESID_BITMAP_SPLITVARW
{
- File = "splvarw.bmp";
+ File = "splvarw.png";
};
-// -----------------------------------------------------------------------
-
Bitmap (SV_ICON_SIZE48_START)
{
File = "mainapp_48_8.png" ;
@@ -419,16 +397,6 @@ Bitmap (SV_ICON_SMALL_START)
File = "mainapp_16.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START)
-{
- File = "mainapp_32_h.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START)
-{
- File = "mainapp_16_h.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_OFFICE)
{
File = "mainapp_32.png" ;
@@ -439,16 +407,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_OFFICE)
File = "mainapp_16.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_OFFICE)
-{
- File = "mainapp_32_h.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_OFFICE)
-{
- File = "mainapp_16_h" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEXT)
{
File = "lx03251.png" ;
@@ -459,16 +417,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEXT)
File = "sx03251.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEXT)
-{
- File = "lxh03251.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEXT)
-{
- File = "sxh03251.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEXT_TEMPLATE)
{
File = "lx03255.png" ;
@@ -479,16 +427,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEXT_TEMPLATE)
File = "sx03255.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEXT_TEMPLATE)
-{
- File = "lxh03255.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEXT_TEMPLATE)
-{
- File = "sxh03255.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_SPREADSHEET)
{
File = "lx03250.png" ;
@@ -499,16 +437,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_SPREADSHEET)
File = "sx03250.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_SPREADSHEET)
-{
- File = "lxh03250.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_SPREADSHEET)
-{
- File = "sxh03250.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_SPREADSHEET_TEMPLATE)
{
File = "lx03254.png" ;
@@ -519,16 +447,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_SPREADSHEET_TEMPLATE)
File = "sx03254.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_SPREADSHEET_TEMPLATE)
-{
- File = "lxh03254.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_SPREADSHEET_TEMPLATE)
-{
- File = "sxh03254.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DRAWING)
{
File = "lx03246.png" ;
@@ -539,16 +457,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DRAWING)
File = "sx03246.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DRAWING)
-{
- File = "lxh03246.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DRAWING)
-{
- File = "sxh03246.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DRAWING_TEMPLATE)
{
File = "lx03252.png" ;
@@ -559,16 +467,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DRAWING_TEMPLATE)
File = "sx03252.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DRAWING_TEMPLATE)
-{
- File = "lxh03252.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DRAWING_TEMPLATE)
-{
- File = "sxh03252.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION)
{
File = "lx03249.png" ;
@@ -579,16 +477,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION)
File = "sx03249.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION)
-{
- File = "lxh03249.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION)
-{
- File = "sxh03249.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION_TEMPLATE)
{
File = "lx03253.png" ;
@@ -599,16 +487,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION_TEMPLATE)
File = "sx03253.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION_TEMPLATE)
-{
- File = "lxh03253.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION_TEMPLATE)
-{
- File = "sxh03253.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRESENTATION_COMPRESSED)
{
File = "lx03241.png" ;
@@ -619,16 +497,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRESENTATION_COMPRESSED)
File = "sx03241.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRESENTATION_COMPRESSED)
-{
- File = "lxh03241.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRESENTATION_COMPRESSED)
-{
- File = "sxh03241.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_MASTER_DOCUMENT)
{
File = "lx03248.png" ;
@@ -639,16 +507,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_MASTER_DOCUMENT)
File = "sx03248.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_MASTER_DOCUMENT)
-{
- File = "lxh03248.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_MASTER_DOCUMENT)
-{
- File = "sxh03248.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_HTML_DOCUMENT)
{
File = "lx03139.png" ;
@@ -659,16 +517,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_HTML_DOCUMENT)
File = "sx03139.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_HTML_DOCUMENT)
-{
- File = "lxh03139.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_HTML_DOCUMENT)
-{
- File = "sxh03139.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_CHART)
{
File = "lx03128.png" ;
@@ -679,16 +527,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_CHART)
File = "sx03128.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_CHART)
-{
- File = "lxh03128.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_CHART)
-{
- File = "sxh03128.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_DATABASE)
{
File = "lx03245.png" ;
@@ -699,16 +537,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_DATABASE)
File = "sx03245.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_DATABASE)
-{
- File = "lxh03245.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_DATABASE)
-{
- File = "sxh03245.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_FORMULA)
{
File = "lx03247.png" ;
@@ -719,16 +547,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_FORMULA)
File = "sx03247.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_FORMULA)
-{
- File = "lxh03247.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_FORMULA)
-{
- File = "sxh03247.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_TEMPLATE)
{
File = "lx03242.png" ;
@@ -739,16 +557,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_TEMPLATE)
File = "sx03242.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_TEMPLATE)
-{
- File = "lxh03242.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_TEMPLATE)
-{
- File = "sxh03242.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_MACRO)
{
File = "lx03216.png" ;
@@ -759,16 +567,6 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_MACRO)
File = "sx03216.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_MACRO)
-{
- File = "lxh03216.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_MACRO)
-{
- File = "sxh03216.png" ;
-};
-
Bitmap (SV_ICON_LARGE_START + SV_ICON_ID_PRINTERADMIN)
{
File = "printeradmin_32.png" ;
@@ -779,33 +577,13 @@ Bitmap (SV_ICON_SMALL_START + SV_ICON_ID_PRINTERADMIN)
File = "printeradmin_16.png" ;
};
-Bitmap (SV_ICON_LARGE_HC_START + SV_ICON_ID_PRINTERADMIN)
-{
- File = "printeradmin_32_h.png" ;
-};
-
-Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRINTERADMIN)
-{
- File = "printeradmin_16_h.png" ;
-};
-
Bitmap SV_DISCLOSURE_PLUS
{
File = "plus.png";
};
-Bitmap SV_DISCLOSURE_PLUS_HC
-{
- File = "plus_sch.png";
-};
-
Bitmap SV_DISCLOSURE_MINUS
{
File = "minus.png";
};
-Bitmap SV_DISCLOSURE_MINUS_HC
-{
- File = "minus_sch.png";
-};
-
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
index 82b0c00c2e15..e1dab9679bda 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -403,16 +403,6 @@ ModalDialog SV_DLG_PRINT
ImageBitmap = Bitmap { File = "ncollate.png" ; };
};
- Image SV_PRINT_COLLATE_HC_IMG
- {
- ImageBitmap = Bitmap { File = "collate_h.png" ; };
- };
-
- Image SV_PRINT_NOCOLLATE_HC_IMG
- {
- ImageBitmap = Bitmap { File = "ncollate_h.png" ; };
- };
-
CheckBox SV_PRINT_OPT_REVERSE
{
HelpID = ".HelpID:vcl:PrintDialog:OptPage:ToReverse";
diff --git a/vcl/source/src/throbber.src b/vcl/source/src/throbber.src
index d3c5ea44035c..d3c5ea44035c 100755..100644
--- a/vcl/source/src/throbber.src
+++ b/vcl/source/src/throbber.src
diff --git a/vcl/source/src/units.src b/vcl/source/src/units.src
index ea5f6ecad2ce..57025c9b2a2f 100644
--- a/vcl/source/src/units.src
+++ b/vcl/source/src/units.src
@@ -28,6 +28,7 @@
#include <svids.hrc>
+// Amelia : adds two units , 'ch' and 'line'
StringArray SV_FUNIT_STRINGS
{
ItemList [ en-US ] =
@@ -49,6 +50,8 @@ StringArray SV_FUNIT_STRINGS
< "feet" ; FUNIT_FOOT ; > ;
< "miles" ; FUNIT_MILE ; > ;
< "mile" ; FUNIT_MILE ; > ;
+ < "ch" ; FUNIT_CHAR ; > ;
+ < "line" ; FUNIT_LINE ; > ;
< "%" ; FUNIT_PERCENT ; > ;
};
};
diff --git a/vcl/source/window/abstdlg.cxx b/vcl/source/window/abstdlg.cxx
index 58f235bea25e..e11e50533647 100644
--- a/vcl/source/window/abstdlg.cxx
+++ b/vcl/source/window/abstdlg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,7 +44,7 @@ VclAbstractDialogFactory* VclAbstractDialogFactory::Create()
static ::osl::Module aDialogLibrary;
if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( CUI_DLL_NAME ) ) ) )
fp = ( VclAbstractDialogFactory* (__LOADONCALLAPI*)() )
- aDialogLibrary.getFunctionSymbol( ::rtl::OUString::createFromAscii("CreateDialogFactory") );
+ aDialogLibrary.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDialogFactory")) );
if ( fp )
return fp();
return 0;
@@ -61,3 +62,5 @@ VclAbstractDialog2::~VclAbstractDialog2()
VclAbstractDialogFactory::~VclAbstractDialogFactory()
{
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index 29f6cc16a176..a07c0ee17b28 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/list.hxx>
+
#include <tools/table.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
@@ -35,13 +36,12 @@
#include <vcl/svapp.hxx>
#include <accel.h>
#include <vcl/accel.hxx>
-
-
+#include <vector>
// =======================================================================
DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* )
-DECLARE_LIST( ImplAccelList, ImplAccelEntry* )
+typedef ::std::vector< ImplAccelEntry* > ImplAccelList;
#define ACCELENTRY_NOTFOUND ((sal_uInt16)0xFFFF)
@@ -63,14 +63,14 @@ DBG_NAME( Accelerator )
sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
sal_uInt16* pIndex = NULL )
{
- sal_uLong nLow;
- sal_uLong nHigh;
- sal_uLong nMid;
- sal_uLong nCount = pList->Count();
+ size_t nLow;
+ size_t nHigh;
+ size_t nMid;
+ size_t nCount = pList->size();
sal_uInt16 nCompareId;
// Abpruefen, ob der erste Key groesser als der Vergleichskey ist
- if ( !nCount || (nId < pList->GetObject( 0 )->mnId) )
+ if ( !nCount || (nId < (*pList)[ 0 ]->mnId) )
{
if ( pIndex )
*pIndex = 0;
@@ -83,7 +83,7 @@ sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
do
{
nMid = (nLow + nHigh) / 2;
- nCompareId = pList->GetObject( nMid )->mnId;
+ nCompareId = (*pList)[ nMid ]->mnId;
if ( nId < nCompareId )
nHigh = nMid-1;
else
@@ -119,16 +119,29 @@ static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry )
do
{
nIndex++;
- ImplAccelEntry* pTempEntry = pList->GetObject( nIndex );
+ ImplAccelEntry* pTempEntry = (*pList)[ nIndex ];
if ( !pTempEntry || (pTempEntry->mnId != pEntry->mnId) )
break;
}
- while ( nIndex < pList->Count() );
-
- pList->Insert( pEntry, (sal_uLong)nIndex );
+ while ( nIndex < pList->size() );
+
+ if ( nIndex < pList->size() ) {
+ ImplAccelList::iterator it = pList->begin();
+ ::std::advance( it, nIndex );
+ pList->insert( it, pEntry );
+ } else {
+ pList->push_back( pEntry );
+ }
+ }
+ else {
+ if ( nInsIndex < pList->size() ) {
+ ImplAccelList::iterator it = pList->begin();
+ ::std::advance( it, nInsIndex );
+ pList->insert( it, pEntry );
+ } else {
+ pList->push_back( pEntry );
+ }
}
- else
- pList->Insert( pEntry, (sal_uLong)nInsIndex );
}
// -----------------------------------------------------------------------
@@ -141,11 +154,11 @@ static sal_uInt16 ImplAccelEntryGetFirstPos( ImplAccelList* pList, sal_uInt16 nI
while ( nIndex )
{
nIndex--;
- if ( pList->GetObject( nIndex )->mnId != nId )
+ if ( (*pList)[ nIndex ]->mnId != nId )
break;
}
- if ( pList->GetObject( nIndex )->mnId != nId )
+ if ( (*pList)[ nIndex ]->mnId != nId )
nIndex++;
}
@@ -174,10 +187,9 @@ ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode& rKeyCode ) const
void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
{
// Tabellen kopieren
- ImplAccelEntry* pEntry = rAccelData.maIdList.First();
- while ( pEntry )
+ for ( size_t i = 0, n = rAccelData.maIdList.size(); i < n; ++i )
{
- pEntry = new ImplAccelEntry( *pEntry );
+ ImplAccelEntry* pEntry = new ImplAccelEntry( *rAccelData.maIdList[ i ] );
// Folge-Accelerator, dann auch kopieren
if ( pEntry->mpAccel )
@@ -189,9 +201,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
pEntry->mpAutoAccel = NULL;
mpData->maKeyTable.Insert( (sal_uLong)pEntry->maKeyCode.GetFullKeyCode(), pEntry );
- mpData->maIdList.Insert( pEntry, LIST_APPEND );
-
- pEntry = rAccelData.maIdList.Next();
+ mpData->maIdList.push_back( pEntry );
}
}
@@ -200,16 +210,14 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
void Accelerator::ImplDeleteData()
{
// Accelerator-Eintraege ueber die Id-Tabelle loeschen
- ImplAccelEntry* pEntry = mpData->maIdList.First();
- while ( pEntry )
- {
- // AutoResAccel zerstoeren
- if ( pEntry->mpAutoAccel )
+ for ( size_t i = 0, n = mpData->maIdList.size(); i < n; ++i ) {
+ ImplAccelEntry* pEntry = mpData->maIdList[ i ];
+ if ( pEntry->mpAutoAccel ) {
delete pEntry->mpAutoAccel;
+ }
delete pEntry;
-
- pEntry = mpData->maIdList.Next();
}
+ mpData->maIdList.clear();
}
// -----------------------------------------------------------------------
@@ -256,12 +264,12 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, const KeyCode& rKeyCode,
sal_uLong nCode = rKeyCode.GetFullKeyCode();
if ( !nCode )
{
- DBG_ERROR( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
+ OSL_FAIL( "Accelerator::InsertItem(): KeyCode with KeyCode 0 not allowed" );
delete pEntry;
}
else if ( !mpData->maKeyTable.Insert( nCode, pEntry ) )
{
- DBG_ERROR1( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
+ OSL_TRACE( "Accelerator::InsertItem(): KeyCode (Key: %lx) already exists", nCode );
delete pEntry;
}
else
@@ -411,11 +419,14 @@ void Accelerator::RemoveItem( sal_uInt16 nItemId )
sal_uInt16 nItemCount = GetItemCount();
do
{
- ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
+ ImplAccelEntry* pEntry = ( nIndex < mpData->maIdList.size() ) ? mpData->maIdList[ nIndex ] : NULL;
if ( pEntry && pEntry->mnId == nItemId )
{
mpData->maKeyTable.Remove( pEntry->maKeyCode.GetFullKeyCode() );
- mpData->maIdList.Remove( (sal_uLong)nIndex );
+
+ ImplAccelList::iterator it = mpData->maIdList.begin();
+ ::std::advance( it, nIndex );
+ mpData->maIdList.erase( it );
// AutoResAccel zerstoeren
if ( pEntry->mpAutoAccel )
@@ -444,14 +455,17 @@ void Accelerator::RemoveItem( const KeyCode rKeyCode )
sal_uInt16 nItemCount = GetItemCount();
do
{
- if ( mpData->maIdList.GetObject( (sal_uLong)nIndex ) == pEntry )
+ if ( mpData->maIdList[ nIndex ] == pEntry )
break;
nIndex++;
}
while ( nIndex < nItemCount );
mpData->maKeyTable.Remove( rKeyCode.GetFullKeyCode() );
- mpData->maIdList.Remove( (sal_uLong)nIndex );
+
+ ImplAccelList::iterator it = mpData->maIdList.begin();
+ ::std::advance( it, nIndex );
+ mpData->maIdList.erase( it );
// AutoResAccel zerstoeren
if ( pEntry->mpAutoAccel )
@@ -469,7 +483,6 @@ void Accelerator::Clear()
ImplDeleteData();
mpData->maKeyTable.Clear();
- mpData->maIdList.Clear();
}
// -----------------------------------------------------------------------
@@ -478,7 +491,7 @@ sal_uInt16 Accelerator::GetItemCount() const
{
DBG_CHKTHIS( Accelerator, NULL );
- return (sal_uInt16)mpData->maIdList.Count();
+ return (sal_uInt16)mpData->maIdList.size();
}
// -----------------------------------------------------------------------
@@ -487,7 +500,7 @@ sal_uInt16 Accelerator::GetItemId( sal_uInt16 nPos ) const
{
DBG_CHKTHIS( Accelerator, NULL );
- ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos );
+ ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL;
if ( pEntry )
return pEntry->mnId;
else
@@ -500,7 +513,7 @@ KeyCode Accelerator::GetItemKeyCode( sal_uInt16 nPos ) const
{
DBG_CHKTHIS( Accelerator, NULL );
- ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nPos );
+ ImplAccelEntry* pEntry = ( nPos < mpData->maIdList.size() ) ? mpData->maIdList[ nPos ] : NULL;
if ( pEntry )
return pEntry->maKeyCode;
else
@@ -528,7 +541,7 @@ KeyCode Accelerator::GetKeyCode( sal_uInt16 nItemId ) const
sal_uInt16 nIndex = ImplAccelEntryGetFirstPos( &(mpData->maIdList), nItemId );
if ( nIndex != ACCELENTRY_NOTFOUND )
- return mpData->maIdList.GetObject( (sal_uLong)nIndex )->maKeyCode;
+ return mpData->maIdList[ nIndex ]->maKeyCode;
else
return KeyCode();
}
@@ -596,7 +609,7 @@ void Accelerator::SetAccel( sal_uInt16 nItemId, Accelerator* pAccel )
sal_uInt16 nItemCount = GetItemCount();
do
{
- ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
+ ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ];
if ( pEntry->mnId != nItemId )
break;
@@ -615,7 +628,7 @@ Accelerator* Accelerator::GetAccel( sal_uInt16 nItemId ) const
sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
if ( nIndex != ACCELENTRY_NOTFOUND )
- return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mpAccel;
+ return mpData->maIdList[ nIndex ]->mpAccel;
else
return NULL;
}
@@ -656,7 +669,7 @@ void Accelerator::EnableItem( sal_uInt16 nItemId, sal_Bool bEnable )
sal_uInt16 nItemCount = GetItemCount();
do
{
- ImplAccelEntry* pEntry = mpData->maIdList.GetObject( (sal_uLong)nIndex );
+ ImplAccelEntry* pEntry = mpData->maIdList[ nIndex ];
if ( pEntry->mnId != nItemId )
break;
@@ -675,7 +688,7 @@ sal_Bool Accelerator::IsItemEnabled( sal_uInt16 nItemId ) const
sal_uInt16 nIndex = ImplAccelEntryGetIndex( &(mpData->maIdList), nItemId );
if ( nIndex != ACCELENTRY_NOTFOUND )
- return mpData->maIdList.GetObject( (sal_uLong)nIndex )->mbEnabled;
+ return mpData->maIdList[ nIndex ]->mbEnabled;
else
return sal_False;
}
@@ -721,8 +734,9 @@ Accelerator& Accelerator::operator=( const Accelerator& rAccel )
// Tabellen loeschen und kopieren
ImplDeleteData();
mpData->maKeyTable.Clear();
- mpData->maIdList.Clear();
ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
return *this;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index 0781b50eb37b..43c78d55adc1 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,19 +28,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/list.hxx>
+
#include <tools/debug.hxx>
#include <accel.h>
#include <vcl/accel.hxx>
#include <accmgr.hxx>
-
-
-// =======================================================================
-
-DECLARE_LIST( ImplAccelList, Accelerator* )
-
// =======================================================================
DBG_NAMEEX( Accelerator )
@@ -58,18 +53,17 @@ ImplAccelManager::~ImplAccelManager()
sal_Bool ImplAccelManager::InsertAccel( Accelerator* pAccel )
{
- if ( !mpAccelList )
+ if ( !mpAccelList ) {
mpAccelList = new ImplAccelList;
- else
- {
- // Gibts den schon ?
- if ( mpAccelList->GetPos( pAccel ) != LIST_ENTRY_NOTFOUND )
- return sal_False;
+ } else {
+ for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i ) {
+ if ( (*mpAccelList)[ i ] == pAccel ) {
+ return sal_False;
+ }
+ }
}
- // Am Anfang der Liste einfuegen
- mpAccelList->Insert( pAccel, (sal_uLong)0 );
-
+ mpAccelList->insert( mpAccelList->begin(), pAccel );
return sal_True;
}
@@ -85,21 +79,29 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
//end it, and then closes the dialog, deleting the accelerators. So if
//we're removing an accelerator that a sub-accelerator which is in the
//sequence list, throw away the entire sequence
- if ( mpSequenceList )
- {
- for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i)
- {
- Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i));
- if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND )
- {
- EndSequence( true );
- break;
+ if ( mpSequenceList ) {
+ for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i) {
+ Accelerator* pSubAccel = pAccel->GetAccel( pAccel->GetItemId(i) );
+ for ( size_t j = 0, n = mpSequenceList->size(); j < n; ++j ) {
+ if ( (*mpSequenceList)[ j ] == pSubAccel ) {
+ EndSequence( true );
+ i = pAccel->GetItemCount();
+ break;
+ }
}
}
}
// Raus damit
- mpAccelList->Remove( pAccel );
+ for ( ImplAccelList::iterator it = mpAccelList->begin();
+ it < mpAccelList->end();
+ ++it
+ ) {
+ if ( *it == pAccel ) {
+ mpAccelList->erase( it );
+ break;
+ }
+ }
}
// -----------------------------------------------------------------------
@@ -111,9 +113,9 @@ void ImplAccelManager::EndSequence( sal_Bool bCancel )
return;
// Alle Deactivate-Handler der Acceleratoren in der Sequenz rufen
- Accelerator* pTempAccel = mpSequenceList->First();
- while( pTempAccel )
+ for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i )
{
+ Accelerator* pTempAccel = (*mpSequenceList)[ i ];
sal_Bool bDel = sal_False;
pTempAccel->mbIsCancel = bCancel;
pTempAccel->mpDel = &bDel;
@@ -123,8 +125,6 @@ void ImplAccelManager::EndSequence( sal_Bool bCancel )
pTempAccel->mbIsCancel = sal_False;
pTempAccel->mpDel = NULL;
}
-
- pTempAccel = mpSequenceList->Next();
}
// Sequenz-Liste loeschen
@@ -141,13 +141,13 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
// Haben wir ueberhaupt Acceleratoren ??
if ( !mpAccelList )
return sal_False;
- if ( !mpAccelList->Count() )
+ if ( mpAccelList->empty() )
return sal_False;
// Sind wir in einer Sequenz ?
if ( mpSequenceList )
{
- pAccel = mpSequenceList->GetObject( 0 );
+ pAccel = mpSequenceList->empty() ? NULL : (*mpSequenceList)[ 0 ];
DBG_CHKOBJ( pAccel, Accelerator, NULL );
// Nicht Gefunden ?
@@ -169,7 +169,7 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
{
DBG_CHKOBJ( pNextAccel, Accelerator, NULL );
- mpSequenceList->Insert( pNextAccel, (sal_uLong)0 );
+ mpSequenceList->insert( mpSequenceList->begin(), pNextAccel );
// Activate-Handler vom Neuen rufen
pNextAccel->Activate();
@@ -222,9 +222,9 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
}
// Durch die Liste der Acceleratoren wuehlen
- pAccel = mpAccelList->First();
- while ( pAccel )
+ for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i )
{
+ pAccel = (*mpAccelList)[ i ];
DBG_CHKOBJ( pAccel, Accelerator, NULL );
// Ist der Eintrag da drin ?
@@ -240,8 +240,8 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
// Sequenz-Liste erzeugen
mpSequenceList = new ImplAccelList;
- mpSequenceList->Insert( pAccel, (sal_uLong)0 );
- mpSequenceList->Insert( pNextAccel, (sal_uLong)0 );
+ mpSequenceList->insert( mpSequenceList->begin(), pAccel );
+ mpSequenceList->insert( mpSequenceList->begin(), pNextAccel );
// Activate-Handler vom Neuen rufen
pNextAccel->Activate();
@@ -282,10 +282,9 @@ sal_Bool ImplAccelManager::IsAccelKey( const KeyCode& rKeyCode, sal_uInt16 nRepe
return sal_False;
}
}
-
- // Nicht gefunden, vielleicht im naechsten Accelerator
- pAccel = mpAccelList->Next();
}
return sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx
index 90f8bc9a4c1e..0d5be0d2b625 100644
--- a/vcl/source/window/arrange.cxx
+++ b/vcl/source/window/arrange.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1073,3 +1074,4 @@ void MatrixArranger::remove( boost::shared_ptr<WindowArranger> const &i_pChild )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 3a00b522952e..26397d7adf7f 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -27,7 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-
#include <svids.hrc>
#include <svdata.hxx>
#include <brdwin.hxx>
@@ -212,7 +212,7 @@ void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData )
{
ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
- if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) ||
+ if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) ||
(pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
{
pData->mnTitleType = BORDERWINDOW_TITLE_NONE;
@@ -277,7 +277,7 @@ sal_uInt16 ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const
// no corner resize for floating toolbars, which would lead to jumps while formatting
// setting nSizeWidth = 0 will only return pure left,top,right,bottom
- if( pBorderWindow->GetStyle() & WB_OWNERDRAWDECORATION )
+ if( pBorderWindow->GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP) )
nSizeWidth = 0;
if ( rPos.X() < pData->mnLeftBorder )
@@ -1497,7 +1497,7 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh
pData->mnTitleType = pBorderWindow->mnTitleType;
pData->mbFloatWindow = pBorderWindow->mbFloatWindow;
- if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
+ if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) )
pData->mnBorderSize = 0;
else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF )
pData->mnBorderSize = 0;
@@ -1522,7 +1522,7 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh
// set a proper background for drawing
// highlighted buttons in the title
- pBorderWindow->SetBackground( rStyleSettings.GetWindowColor() );
+ pBorderWindow->SetBackground( rStyleSettings.GetFaceColor() );
pData->maTitleRect.Left() = pData->mnLeftBorder;
pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1;
@@ -1665,19 +1665,43 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p
Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings();
DecorationView aDecoView( pDev );
- Color aFrameColor( rStyleSettings.GetFaceColor() );
+ Color aFaceColor( rStyleSettings.GetFaceColor() );
+ Color aFrameColor( aFaceColor );
aFrameColor.DecreaseContrast( (sal_uInt8) (0.50 * 255));
// Draw Frame
if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME )
{
+ Region oldClipRgn( pDev->GetClipRegion( ) );
+
+ // for popups, don't draw part of the frame
+ if ( pData->mnTitleType == BORDERWINDOW_TITLE_POPUP )
+ {
+ FloatingWindow *pWin = dynamic_cast< FloatingWindow* >( pData->mpBorderWindow->GetWindow( WINDOW_CLIENT ) );
+ if ( pWin )
+ {
+ Region aClipRgn( aInRect );
+ Rectangle aItemClipRect( pWin->ImplGetItemEdgeClipRect() );
+ if( !aItemClipRect.IsEmpty() )
+ {
+ aItemClipRect.SetPos( pData->mpBorderWindow->AbsoluteScreenToOutputPixel( aItemClipRect.TopLeft() ) );
+ aClipRgn.Exclude( aItemClipRect );
+ pDev->SetClipRegion( aClipRgn );
+ }
+ }
+ }
+
// single line frame
pDev->SetLineColor( aFrameColor );
pDev->SetFillColor();
pDev->DrawRect( aInRect );
aInRect.nLeft++; aInRect.nRight--;
aInRect.nTop++; aInRect.nBottom--;
+
+ // restore
+ if ( pData->mnTitleType == BORDERWINDOW_TITLE_POPUP )
+ pDev->SetClipRegion( oldClipRgn );
}
else
aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW);
@@ -1704,7 +1728,11 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p
aInRect = pData->maTitleRect;
// use no gradient anymore, just a static titlecolor
- pDev->SetFillColor( aFrameColor );
+ if ( pData->mnTitleType != BORDERWINDOW_TITLE_POPUP )
+ pDev->SetFillColor( aFrameColor );
+ else
+ pDev->SetFillColor( aFaceColor );
+
pDev->SetTextColor( rStyleSettings.GetButtonTextColor() );
Rectangle aTitleRect( pData->maTitleRect );
if( pOffset )
@@ -1839,7 +1867,7 @@ void ImplBorderWindow::ImplInit( Window* pParent,
{
// Alle WindowBits entfernen, die wir nicht haben wollen
WinBits nOrgStyle = nStyle;
- WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS);
+ WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS | WB_POPUP);
if ( nTypeStyle & BORDERWINDOW_STYLE_APP )
nTestStyle |= WB_APP;
nStyle &= nTestStyle;
@@ -1854,7 +1882,7 @@ void ImplBorderWindow::ImplInit( Window* pParent,
mpWindowImpl->mbFrame = sal_True;
mbFrameBorder = sal_False;
}
- else if( (nStyle & WB_OWNERDRAWDECORATION) )
+ else if( (nStyle & (WB_OWNERDRAWDECORATION | WB_POPUP)) )
{
mpWindowImpl->mbOverlapWin = sal_True;
mpWindowImpl->mbFrame = sal_True;
@@ -2106,7 +2134,7 @@ void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
{
- if ( !mpWindowImpl->mbFrame || (GetStyle() & WB_OWNERDRAWDECORATION) )
+ if ( !mpWindowImpl->mbFrame || (GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP)) )
UpdateView( sal_True, ImplGetWindow()->GetOutputSizePixel() );
}
@@ -2354,3 +2382,5 @@ Rectangle ImplBorderWindow::GetMenuRect() const
{
return mpBorderView->GetMenuRect();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx
index 08132496dc36..577b7ad89edc 100644
--- a/vcl/source/window/btndlg.cxx
+++ b/vcl/source/window/btndlg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/ref.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
@@ -36,43 +36,33 @@
#include <vcl/button.hxx>
#include <vcl/btndlg.hxx>
-
-
-
-// =======================================================================
+#include <vcl/svdata.hxx>
+typedef boost::ptr_vector<ImplBtnDlgItem>::iterator btn_iterator;
+typedef boost::ptr_vector<ImplBtnDlgItem>::const_iterator btn_const_iterator;
struct ImplBtnDlgItem
{
sal_uInt16 mnId;
- sal_Bool mbOwnButton;
- sal_Bool mbDummyAlign;
+ bool mbOwnButton;
+ bool mbDummyAlign;
long mnSepSize;
PushButton* mpPushButton;
};
-DECLARE_LIST( ImplBtnDlgItemList, ImplBtnDlgItem* )
-
-// =======================================================================
-
void ButtonDialog::ImplInitButtonDialogData()
{
- mpItemList = new ImplBtnDlgItemList( 8, 8 );
mnButtonSize = 0;
mnCurButtonId = 0;
mnFocusButtonId = BUTTONDIALOG_BUTTON_NOTFOUND;
mbFormat = sal_True;
}
-// -----------------------------------------------------------------------
-
ButtonDialog::ButtonDialog( WindowType nType ) :
Dialog( nType )
{
ImplInitButtonDialogData();
}
-// -----------------------------------------------------------------------
-
ButtonDialog::ButtonDialog( Window* pParent, WinBits nStyle ) :
Dialog( WINDOW_BUTTONDIALOG )
{
@@ -80,8 +70,6 @@ ButtonDialog::ButtonDialog( Window* pParent, WinBits nStyle ) :
ImplInit( pParent, nStyle );
}
-// -----------------------------------------------------------------------
-
ButtonDialog::ButtonDialog( Window* pParent, const ResId& rResId ) :
Dialog( WINDOW_BUTTONDIALOG )
{
@@ -91,24 +79,15 @@ ButtonDialog::ButtonDialog( Window* pParent, const ResId& rResId ) :
ImplLoadRes( rResId );
}
-// -----------------------------------------------------------------------
-
ButtonDialog::~ButtonDialog()
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( pItem->mpPushButton && pItem->mbOwnButton )
- delete pItem->mpPushButton;
- delete pItem;
- pItem = mpItemList->Next();
+ if ( it->mpPushButton && it->mbOwnButton )
+ delete it->mpPushButton;
}
-
- delete mpItemList;
}
-// -----------------------------------------------------------------------
-
PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags )
{
PushButton* pBtn;
@@ -131,60 +110,53 @@ PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags )
return pBtn;
}
-// -----------------------------------------------------------------------
-
ImplBtnDlgItem* ButtonDialog::ImplGetItem( sal_uInt16 nId ) const
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ for ( btn_const_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( pItem->mnId == nId )
- return pItem;
-
- pItem = mpItemList->Next();
+ if (it->mnId == nId)
+ return const_cast<ImplBtnDlgItem*>(&(*it));
}
return NULL;
}
-// -----------------------------------------------------------------------
-
long ButtonDialog::ImplGetButtonSize()
{
if ( !mbFormat )
return mnButtonSize;
// Calculate ButtonSize
- long nLastSepSize = 0;
- long nSepSize = 0;
- long nButtonCount = 0;
+ long nLastSepSize = 0;
+ long nSepSize = 0;
maCtrlSize = Size( IMPL_MINSIZE_BUTTON_WIDTH, IMPL_MINSIZE_BUTTON_HEIGHT );
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+
+ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
nSepSize += nLastSepSize;
- long nTxtWidth = pItem->mpPushButton->GetCtrlTextWidth( pItem->mpPushButton->GetText() );
+ long nTxtWidth = it->mpPushButton->GetCtrlTextWidth(it->mpPushButton->GetText());
nTxtWidth += IMPL_EXTRA_BUTTON_WIDTH;
+
if ( nTxtWidth > maCtrlSize.Width() )
maCtrlSize.Width() = nTxtWidth;
- long nTxtHeight = pItem->mpPushButton->GetTextHeight();
+
+ long nTxtHeight = it->mpPushButton->GetTextHeight();
nTxtHeight += IMPL_EXTRA_BUTTON_HEIGHT;
+
if ( nTxtHeight > maCtrlSize.Height() )
maCtrlSize.Height() = nTxtHeight;
- nSepSize += pItem->mnSepSize;
+ nSepSize += it->mnSepSize;
if ( GetStyle() & WB_HORZ )
nLastSepSize = IMPL_SEP_BUTTON_X;
else
nLastSepSize = IMPL_SEP_BUTTON_Y;
-
- nButtonCount++;
-
- pItem = mpItemList->Next();
}
+ long nButtonCount = maItemList.size();
+
if ( GetStyle() & WB_HORZ )
mnButtonSize = nSepSize + (nButtonCount*maCtrlSize.Width());
else
@@ -193,8 +165,6 @@ long ButtonDialog::ImplGetButtonSize()
return mnButtonSize;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::ImplPosControls()
{
if ( !mbFormat )
@@ -204,7 +174,6 @@ void ButtonDialog::ImplPosControls()
ImplGetButtonSize();
// determine dialog size
- ImplBtnDlgItem* pItem;
Size aDlgSize = maPageSize;
long nX;
long nY;
@@ -238,21 +207,20 @@ void ButtonDialog::ImplPosControls()
}
// Arrange PushButtons
- pItem = mpItemList->First();
- while ( pItem )
+ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
if ( GetStyle() & WB_HORZ )
- nX += pItem->mnSepSize;
+ nX += it->mnSepSize;
else
- nY += pItem->mnSepSize;
- pItem->mpPushButton->SetPosSizePixel( Point( nX, nY ), maCtrlSize );
- pItem->mpPushButton->Show();
+ nY += it->mnSepSize;
+
+ it->mpPushButton->SetPosSizePixel( Point( nX, nY ), maCtrlSize );
+ it->mpPushButton->Show();
+
if ( GetStyle() & WB_HORZ )
nX += maCtrlSize.Width()+IMPL_SEP_BUTTON_X;
else
nY += maCtrlSize.Height()+IMPL_SEP_BUTTON_Y;
-
- pItem = mpItemList->Next();
}
SetOutputSizePixel( aDlgSize );
@@ -260,54 +228,43 @@ void ButtonDialog::ImplPosControls()
mbFormat = sal_False;
}
-// -----------------------------------------------------------------------
-
IMPL_LINK( ButtonDialog, ImplClickHdl, PushButton*, pBtn )
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( pItem->mpPushButton == pBtn )
+ if ( it->mpPushButton == pBtn )
{
- mnCurButtonId = pItem->mnId;
+ mnCurButtonId = it->mnId;
Click();
break;
}
-
- pItem = mpItemList->Next();
}
return 0;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::Resize()
{
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::StateChanged( StateChangedType nType )
{
if ( nType == STATE_CHANGE_INITSHOW )
{
ImplPosControls();
- // Focus evt. auf den entsprechenden Button setzen
+ // Set focus on default button.
if ( mnFocusButtonId != BUTTONDIALOG_BUTTON_NOTFOUND )
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ for ( btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( pItem->mnId == mnFocusButtonId )
+ if (it->mnId == mnFocusButtonId )
{
- if ( pItem->mpPushButton->IsVisible() )
- pItem->mpPushButton->GrabFocus();
+ if (it->mpPushButton->IsVisible())
+ it->mpPushButton->GrabFocus();
+
break;
}
-
- pItem = mpItemList->Next();
}
}
}
@@ -315,8 +272,6 @@ void ButtonDialog::StateChanged( StateChangedType nType )
Dialog::StateChanged( nType );
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::Click()
{
if ( !maClickHdl )
@@ -328,8 +283,6 @@ void ButtonDialog::Click()
maClickHdl.Call( this );
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId,
sal_uInt16 nBtnFlags, long nSepPixel )
{
@@ -339,11 +292,11 @@ void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId,
pItem->mbOwnButton = sal_True;
pItem->mnSepSize = nSepPixel;
pItem->mpPushButton = ImplCreatePushButton( nBtnFlags );
+
if ( rText.Len() )
pItem->mpPushButton->SetText( rText );
- // In die Liste eintragen
- mpItemList->Insert( pItem, LIST_APPEND );
+ maItemList.push_back(pItem);
if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
mnFocusButtonId = nId;
@@ -351,8 +304,6 @@ void ButtonDialog::AddButton( const XubString& rText, sal_uInt16 nId,
mbFormat = sal_True;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
sal_uInt16 nBtnFlags, long nSepPixel )
{
@@ -382,14 +333,11 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
mnFocusButtonId = nId;
- // In die Liste eintragen
- mpItemList->Insert( pItem, LIST_APPEND );
+ maItemList.push_back(pItem);
mbFormat = sal_True;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::AddButton( PushButton* pBtn, sal_uInt16 nId,
sal_uInt16 nBtnFlags, long nSepPixel )
{
@@ -403,73 +351,59 @@ void ButtonDialog::AddButton( PushButton* pBtn, sal_uInt16 nId,
if ( nBtnFlags & BUTTONDIALOG_FOCUSBUTTON )
mnFocusButtonId = nId;
- // In die View-Liste eintragen
- mpItemList->Insert( pItem, LIST_APPEND );
+ maItemList.push_back(pItem);
mbFormat = sal_True;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::RemoveButton( sal_uInt16 nId )
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ btn_iterator it;
+ for (it = maItemList.begin(); it != maItemList.end(); ++it)
{
- if ( pItem->mnId == nId )
+ if (it->mnId == nId)
{
- pItem->mpPushButton->Hide();
- if ( pItem->mbOwnButton )
- delete pItem->mpPushButton;
- delete pItem;
- mpItemList->Remove();
- mbFormat = sal_True;
+ it->mpPushButton->Hide();
+
+ if (it->mbOwnButton )
+ delete it->mpPushButton;
+
+ maItemList.erase(it);
break;
}
-
- pItem = mpItemList->Next();
}
- DBG_ERRORFILE( "ButtonDialog::RemoveButton(): ButtonId invalid" );
+ if (it == maItemList.end())
+ DBG_ERRORFILE( "ButtonDialog::RemoveButton(): ButtonId invalid" );
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::Clear()
{
- ImplBtnDlgItem* pItem = mpItemList->First();
- while ( pItem )
+ for (btn_iterator it = maItemList.begin(); it != maItemList.end(); ++it)
{
- pItem->mpPushButton->Hide();
- if ( pItem->mbOwnButton )
- delete pItem->mpPushButton;
- delete pItem;
- pItem = mpItemList->Next();
+ it->mpPushButton->Hide();
+
+ if (it->mbOwnButton )
+ delete it->mpPushButton;
}
- mpItemList->Clear();
+ maItemList.clear();
mbFormat = sal_True;
}
-// -----------------------------------------------------------------------
-
sal_uInt16 ButtonDialog::GetButtonCount() const
{
- return (sal_uInt16)mpItemList->Count();
+ return (sal_uInt16)maItemList.size();
}
-// -----------------------------------------------------------------------
-
sal_uInt16 ButtonDialog::GetButtonId( sal_uInt16 nButton ) const
{
- if ( nButton < mpItemList->Count() )
- return (sal_uInt16)mpItemList->GetObject( nButton )->mnId;
+ if ( nButton < maItemList.size() )
+ return maItemList[nButton].mnId;
else
return BUTTONDIALOG_BUTTON_NOTFOUND;
}
-// -----------------------------------------------------------------------
-
PushButton* ButtonDialog::GetPushButton( sal_uInt16 nId ) const
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -480,8 +414,6 @@ PushButton* ButtonDialog::GetPushButton( sal_uInt16 nId ) const
return NULL;
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::SetButtonText( sal_uInt16 nId, const XubString& rText )
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -493,8 +425,6 @@ void ButtonDialog::SetButtonText( sal_uInt16 nId, const XubString& rText )
}
}
-// -----------------------------------------------------------------------
-
XubString ButtonDialog::GetButtonText( sal_uInt16 nId ) const
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -505,8 +435,6 @@ XubString ButtonDialog::GetButtonText( sal_uInt16 nId ) const
return ImplGetSVEmptyStr();
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::SetButtonHelpText( sal_uInt16 nId, const XubString& rText )
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -515,8 +443,6 @@ void ButtonDialog::SetButtonHelpText( sal_uInt16 nId, const XubString& rText )
pItem->mpPushButton->SetHelpText( rText );
}
-// -----------------------------------------------------------------------
-
XubString ButtonDialog::GetButtonHelpText( sal_uInt16 nId ) const
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -527,8 +453,6 @@ XubString ButtonDialog::GetButtonHelpText( sal_uInt16 nId ) const
return ImplGetSVEmptyStr();
}
-// -----------------------------------------------------------------------
-
void ButtonDialog::SetButtonHelpId( sal_uInt16 nId, const rtl::OString& rHelpId )
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
@@ -537,11 +461,11 @@ void ButtonDialog::SetButtonHelpId( sal_uInt16 nId, const rtl::OString& rHelpId
pItem->mpPushButton->SetHelpId( rHelpId );
}
-// -----------------------------------------------------------------------
-
rtl::OString ButtonDialog::GetButtonHelpId( sal_uInt16 nId ) const
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
return pItem ? rtl::OString( pItem->mpPushButton->GetHelpId() ) : rtl::OString();
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/cmdevt.cxx b/vcl/source/window/cmdevt.cxx
index e10d33028fbc..1fa77a3621cd 100644
--- a/vcl/source/window/cmdevt.cxx
+++ b/vcl/source/window/cmdevt.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,13 +29,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _STRING_H
#include <string.h>
-#endif
-#ifndef _SV_CMDEVT_HXX
#include <vcl/cmdevt.hxx>
-#endif
// =======================================================================
@@ -99,3 +96,5 @@ CommandExtTextInputData::~CommandExtTextInputData()
if ( mpTextAttr )
delete [] mpTextAttr;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 03648a078193..6cecea6a24a7 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -470,3 +471,5 @@ sal_Bool Cursor::operator==( const Cursor& rCursor ) const
else
return sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index b82f029370c7..125c927bf673 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1286,3 +1287,4 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
mpOutDev->Pop();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 031e947cbf13..5c4c786a1f39 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <tools/debug.hxx>
#include <tools/rc.h>
-
#include <svdata.hxx>
#include <window.h>
#include <brdwin.hxx>
@@ -559,7 +559,18 @@ sal_Bool Dialog::Close()
{
ImplDelData aDelData;
ImplAddDel( &aDelData );
+ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
+ mnCancelClose = 0;
ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
+ // basic boolean ( and what the user might use in the event handler) can
+ // be ambiguous ( e.g. basic true = -1 )
+ // test agains 0 ( false ) and assume anything else is true
+ // ( Note: ) this used to work ( something changes somewhere )
+ if (mnCancelClose != 0)
+ {
+ return sal_False;
+ }
+ //liuchen 2009-7-22
if ( aDelData.IsDelete() )
return sal_False;
ImplRemoveDel( &aDelData );
@@ -612,7 +623,7 @@ sal_Bool Dialog::ImplStartExecuteModal()
#ifdef DBG_UTIL
ByteString aErrorStr( "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): " );
aErrorStr += ImplGetDialogText( this );
- DBG_ERROR( aErrorStr.GetBuffer() );
+ OSL_FAIL( aErrorStr.GetBuffer() );
#endif
return sal_False;
}
@@ -622,7 +633,7 @@ sal_Bool Dialog::ImplStartExecuteModal()
#ifdef DBG_UTIL
ByteString aErrorStr( "Dialog::StartExecuteModal() is called in a none UI application: " );
aErrorStr += ImplGetDialogText( this );
- DBG_ERROR( aErrorStr.GetBuffer() );
+ OSL_FAIL( aErrorStr.GetBuffer() );
#endif
return sal_False;
}
@@ -712,7 +723,7 @@ short Dialog::Execute()
if( ! aParentDelData.IsDelete() )
pDialogParent->ImplRemoveDel( &aParentDelData );
else
- DBG_ERROR( "Dialog::Execute() - Parent of dialog destroyed in Execute()" );
+ OSL_FAIL( "Dialog::Execute() - Parent of dialog destroyed in Execute()" );
}
#endif
if ( !aDelData.IsDelete() )
@@ -720,7 +731,7 @@ short Dialog::Execute()
#ifdef DBG_UTIL
else
{
- DBG_ERROR( "Dialog::Execute() - Dialog destroyed in Execute()" );
+ OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
}
#endif
@@ -1026,3 +1037,5 @@ ModalDialog::ModalDialog( Window* pParent, const ResId& rResId ) :
ImplInit( pParent, ImplInitRes( rResId ) );
ImplLoadRes( rResId );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index cf49dad4173a..24468089e88a 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -898,10 +899,8 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput )
sal_Bool Window::ImplHasDlgCtrl()
{
Window* pDlgCtrlParent;
- Window* pDlgCtrl;
// lookup window for dialog control
- pDlgCtrl = this;
pDlgCtrlParent = ImplGetParent();
while ( pDlgCtrlParent &&
!pDlgCtrlParent->ImplIsOverlapWindow() &&
@@ -1335,3 +1334,5 @@ KeyEvent Window::GetActivationKey() const
}
return aKeyEvent;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx
index 70453d6c4f9a..5d6a309e838e 100644
--- a/vcl/source/window/dndevdis.cxx
+++ b/vcl/source/window/dndevdis.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -33,11 +34,9 @@
#include <window.h>
#include <svdata.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
-using namespace ::osl;
-using namespace ::vos;
using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -62,20 +61,11 @@ DNDEventDispatcher::~DNDEventDispatcher()
{
}
-//==================================================================================================
-// DNDEventDispatcher::drop
-//==================================================================================================
-
-void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
- throw(RuntimeException)
+Window* DNDEventDispatcher::findTopLevelWindow(Point location)
{
- MutexGuard aImplGuard( m_aMutex );
-
- Point location( dtde.LocationX, dtde.LocationY );
+ SolarMutexGuard aSolarGuard;
// find the window that is toplevel for this coordinates
- OClearableGuard aSolarGuard( Application::GetSolarMutex() );
-
// because those coordinates come from outside, they must be mirrored if RTL layout is active
if( Application::GetSettings().GetLayoutRTL() )
m_pTopWindow->ImplMirrorFramePos( location );
@@ -90,7 +80,21 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
if( pChildWindow->ImplIsAntiparallel() )
pChildWindow->ImplReMirror( location );
- aSolarGuard.clear();
+ return pChildWindow;
+}
+
+//==================================================================================================
+// DNDEventDispatcher::drop
+//==================================================================================================
+
+void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
+ throw(RuntimeException)
+{
+ osl::MutexGuard aImplGuard( m_aMutex );
+
+ Point location( dtde.LocationX, dtde.LocationY );
+
+ Window* pChildWindow = findTopLevelWindow(location);
// handle the case that drop is in an other vcl window than the last dragOver
if( pChildWindow != m_pCurrentWindow )
@@ -126,27 +130,10 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtdee )
throw(RuntimeException)
{
- MutexGuard aImplGuard( m_aMutex );
+ osl::MutexGuard aImplGuard( m_aMutex );
Point location( dtdee.LocationX, dtdee.LocationY );
- // find the window that is toplevel for this coordinates
- OClearableGuard aSolarGuard( Application::GetSolarMutex() );
-
- // because those coordinates come from outside, they must be mirrored if RTL layout is active
- if( Application::GetSettings().GetLayoutRTL() )
- m_pTopWindow->ImplMirrorFramePos( location );
- Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
-
- if( NULL == pChildWindow )
- pChildWindow = m_pTopWindow;
-
- while( pChildWindow->ImplGetClientWindow() )
- pChildWindow = pChildWindow->ImplGetClientWindow();
-
- if( pChildWindow->ImplIsAntiparallel() )
- pChildWindow->ImplReMirror( location );
-
- aSolarGuard.clear();
+ Window * pChildWindow = findTopLevelWindow(location);
// assume pointer write operation to be atomic
m_pCurrentWindow = pChildWindow;
@@ -171,7 +158,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd
void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ )
throw(RuntimeException)
{
- MutexGuard aImplGuard( m_aMutex );
+ osl::MutexGuard aImplGuard( m_aMutex );
fireDragExitEvent( m_pCurrentWindow );
@@ -187,29 +174,12 @@ void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ )
void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
throw(RuntimeException)
{
- MutexGuard aImplGuard( m_aMutex );
+ osl::MutexGuard aImplGuard( m_aMutex );
Point location( dtde.LocationX, dtde.LocationY );
sal_Int32 nListeners;
- // find the window that is toplevel for this coordinates
- OClearableGuard aSolarGuard( Application::GetSolarMutex() );
-
- // because those coordinates come from outside, they must be mirrored if RTL layout is active
- if( Application::GetSettings().GetLayoutRTL() )
- m_pTopWindow->ImplMirrorFramePos( location );
- Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
-
- if( NULL == pChildWindow )
- pChildWindow = m_pTopWindow;
-
- while( pChildWindow->ImplGetClientWindow() )
- pChildWindow = pChildWindow->ImplGetClientWindow();
-
- if( pChildWindow->ImplIsAntiparallel() )
- pChildWindow->ImplReMirror( location );
-
- aSolarGuard.clear();
+ Window * pChildWindow = findTopLevelWindow(location);
if( pChildWindow != m_pCurrentWindow )
{
@@ -245,29 +215,12 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& dtde )
throw(RuntimeException)
{
- MutexGuard aImplGuard( m_aMutex );
+ osl::MutexGuard aImplGuard( m_aMutex );
Point location( dtde.LocationX, dtde.LocationY );
sal_Int32 nListeners;
- // find the window that is toplevel for this coordinates
- OClearableGuard aSolarGuard( Application::GetSolarMutex() );
-
- // because those coordinates come from outside, they must be mirrored if RTL layout is active
- if( Application::GetSettings().GetLayoutRTL() )
- m_pTopWindow->ImplMirrorFramePos( location );
- Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
-
- if( NULL == pChildWindow )
- pChildWindow = m_pTopWindow;
-
- while( pChildWindow->ImplGetClientWindow() )
- pChildWindow = pChildWindow->ImplGetClientWindow();
-
- if( pChildWindow->ImplIsAntiparallel() )
- pChildWindow->ImplReMirror( location );
-
- aSolarGuard.clear();
+ Window* pChildWindow = findTopLevelWindow(location);
if( pChildWindow != m_pCurrentWindow )
{
@@ -303,28 +256,12 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent&
void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& dge )
throw(RuntimeException)
-{ MutexGuard aImplGuard( m_aMutex );
+{
+ osl::MutexGuard aImplGuard( m_aMutex );
Point origin( dge.DragOriginX, dge.DragOriginY );
- // find the window that is toplevel for this coordinates
- OClearableGuard aSolarGuard( Application::GetSolarMutex() );
-
- // because those coordinates come from outside, they must be mirrored if RTL layout is active
- if( Application::GetSettings().GetLayoutRTL() )
- m_pTopWindow->ImplMirrorFramePos( origin );
- Window * pChildWindow = m_pTopWindow->ImplFindWindow( origin );
-
- if( NULL == pChildWindow )
- pChildWindow = m_pTopWindow;
-
- while( pChildWindow->ImplGetClientWindow() )
- pChildWindow = pChildWindow->ImplGetClientWindow();
-
- if( pChildWindow->ImplIsAntiparallel() )
- pChildWindow->ImplReMirror( origin );
-
- aSolarGuard.clear();
+ Window* pChildWindow = findTopLevelWindow(origin);
fireDragGestureEvent( pChildWindow, dge.DragSource, dge.Event, origin, dge.DragAction );
}
@@ -368,7 +305,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( Window *pWindow,
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aSolarGuard;
// set an UI lock
pWindow->IncrementLockCount();
@@ -380,7 +317,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( Window *pWindow,
{
// retrieve relative mouse position
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
- aGuard.clear();
+ aSolarGuard.clear();
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragEnterEvent(
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions, aFlavorList );
@@ -404,7 +341,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( Window *pWindow,
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aSolarGuard;
// query DropTarget from window
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
@@ -413,7 +350,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( Window *pWindow,
{
// retrieve relative mouse position
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
- aGuard.clear();
+ aSolarGuard.clear();
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragOverEvent(
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions );
@@ -433,7 +370,7 @@ sal_Int32 DNDEventDispatcher::fireDragExitEvent( Window *pWindow ) throw(Runtime
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aGuard;
// query DropTarget from window
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
@@ -464,7 +401,7 @@ sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( Window *pWindow,
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aGuard;
// query DropTarget from window
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
@@ -497,7 +434,7 @@ sal_Int32 DNDEventDispatcher::fireDropEvent( Window *pWindow,
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aGuard;
// query DropTarget from window
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
@@ -542,7 +479,7 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( Window *pWindow,
if( pWindow && pWindow->IsInputEnabled() && ! pWindow->IsInModalMode() )
{
- OClearableGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexClearableGuard aGuard;
// query DropTarget from window
Reference< XDragGestureRecognizer > xDragGestureRecognizer = pWindow->GetDragGestureRecognizer();
@@ -563,3 +500,5 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( Window *pWindow,
return n;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dndlcon.cxx b/vcl/source/window/dndlcon.cxx
index 9d768ad49ac9..54013a9bca03 100644
--- a/vcl/source/window/dndlcon.cxx
+++ b/vcl/source/window/dndlcon.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -565,3 +566,5 @@ void SAL_CALL DNDListenerContainer::dropComplete( sal_Bool success ) throw (Runt
m_xDropTargetDropContext.clear();
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx
index 4d1c77ab09b5..df29d9e3a07a 100644
--- a/vcl/source/window/dockingarea.cxx
+++ b/vcl/source/window/dockingarea.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -247,3 +248,4 @@ void DockingAreaWindow::Resize()
// -----------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 314aa67597b2..624a42593b07 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#include "precompiled_vcl.hxx"
#include <tools/time.hxx>
-#ifndef _SV_RC_H
#include <tools/rc.h>
-#endif
#include <brdwin.hxx>
#include <svdata.hxx>
@@ -1686,3 +1685,5 @@ sal_Bool ImplDockingWindowWrapper::IsLocked() const
{
return mbLocked;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index a3caabce0c5c..6440d118fe54 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <tools/time.hxx>
#include <tools/rc.h>
-
#include <vcl/event.hxx>
#include <vcl/floatwin.hxx>
#include <vcl/dockwin.hxx>
@@ -1115,3 +1115,5 @@ const Size& DockingWindow::GetMaxOutputSizePixel() const
return mpFloatWin->GetMaxOutputSizePixel();
return mpImplData->maMaxOutSize;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f8bf9a97d6dd..118c60f214cc 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -135,7 +136,7 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle )
mpNextFloat = NULL;
mpFirstPopupModeWin = NULL;
mnPostId = 0;
- mnTitle = (nStyle & WB_MOVEABLE) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE;
+ mnTitle = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE;
mnOldTitle = mnTitle;
mnPopupModeFlags = 0;
mbInPopupMode = sal_False;
@@ -649,6 +650,8 @@ void FloatingWindow::SetTitleType( sal_uInt16 nTitle )
nTitleStyle = BORDERWINDOW_TITLE_SMALL;
else if ( nTitle == FLOATWIN_TITLE_TEAROFF )
nTitleStyle = BORDERWINDOW_TITLE_TEAROFF;
+ else if ( nTitle == FLOATWIN_TITLE_POPUP )
+ nTitleStyle = BORDERWINDOW_TITLE_POPUP;
else // nTitle == FLOATWIN_TITLE_NONE
nTitleStyle = BORDERWINDOW_TITLE_NONE;
((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetTitleType( nTitleStyle, aOutSize );
@@ -669,7 +672,9 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags )
// remove title
mnOldTitle = mnTitle;
- if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
+ if ( ( mpWindowImpl->mnStyle & WB_POPUP ) && GetText().Len() )
+ SetTitleType( FLOATWIN_TITLE_POPUP );
+ else if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
SetTitleType( FLOATWIN_TITLE_TEAROFF );
else
SetTitleType( FLOATWIN_TITLE_NONE );
@@ -873,3 +878,4 @@ void FloatingWindow::RemovePopupModeWindow( Window* pWindow )
mpFirstPopupModeWin = NULL;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/introwin.cxx b/vcl/source/window/introwin.cxx
index 4ed808852336..538bd6bf25a6 100644
--- a/vcl/source/window/introwin.cxx
+++ b/vcl/source/window/introwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -83,3 +84,5 @@ void IntroWindow::SetBackgroundBitmap( const BitmapEx& rBitmapEx )
ImplGetFrame()->SetBackgroundBitmap( pBmp );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/javachild.cxx b/vcl/source/window/javachild.cxx
index aa198c85c138..1f15019999e5 100644
--- a/vcl/source/window/javachild.cxx
+++ b/vcl/source/window/javachild.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,3 +62,5 @@ sal_IntPtr JavaChildWindow::getParentWindowHandleForJava()
{
return SystemChildWindow::GetParentWindowHandle( sal_True );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx
index 44c0a8b79d0b..466ebbb41ebf 100644
--- a/vcl/source/window/keycod.cxx
+++ b/vcl/source/window/keycod.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -151,3 +152,5 @@ KeyFuncType KeyCode::GetFunction() const
return KEYFUNC_DONTKNOW;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/keyevent.cxx b/vcl/source/window/keyevent.cxx
index 9d6854430611..db8144c3d648 100644
--- a/vcl/source/window/keyevent.cxx
+++ b/vcl/source/window/keyevent.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -114,3 +115,4 @@ const Point& HelpEvent::GetMousePosPixel() const
return maPos;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 72715139f699..af79642516f4 100755..100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1,3 +1,5 @@
+
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +30,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include "tools/list.hxx"
#include "tools/debug.hxx"
#include "tools/diagnose_ex.h"
#include "tools/rc.h"
@@ -561,7 +562,6 @@ public:
Size getMinSize();
Image maImage;
- Image maImageHC;
};
DecoToolBox::DecoToolBox( Window* pParent, WinBits nStyle ) :
@@ -639,8 +639,7 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
Color aEraseColor( 255, 255, 255, 255 );
BitmapEx aBmpExDst( maImage.GetBitmapEx() );
- BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetHighContrastMode() ?
- maImageHC.GetBitmapEx() : aBmpExDst );
+ BitmapEx aBmpExSrc( aBmpExDst );
aEraseColor.SetTransparency( 255 );
aBmpExDst.Erase( aEraseColor );
@@ -965,7 +964,7 @@ void Menu::ImplInit()
{
mnHighlightedItemPos = ITEMPOS_INVALID;
mpSalMenu = NULL;
- nMenuFlags = MENU_FLAG_SHOWCHECKIMAGES;
+ nMenuFlags = 0;
nDefaultItem = 0;
//bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!!
nSelectedId = 0;
@@ -1102,9 +1101,6 @@ void Menu::Deactivate()
if( !aDelData.isDeleted() )
{
bInCallback = sal_False;
-
- if ( this == pStartMenu )
- GetpApp()->HideHelpStatusText();
}
}
@@ -1118,9 +1114,6 @@ void Menu::Highlight()
if ( pStartMenu && ( pStartMenu != this ) )
pStartMenu->aHighlightHdl.Call( this );
}
-
- if ( !aDelData.isDeleted() && GetCurItemId() )
- GetpApp()->ShowHelpStatusText( GetHelpText( GetCurItemId() ) );
}
void Menu::ImplSelect()
@@ -1190,7 +1183,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent );
}
- if ( !aDelData.isDeleted() && !maEventListeners.empty() )
+ if ( !aDelData.isDeleted() )
maEventListeners.Call( &aEvent );
if( !aDelData.isDeleted() )
@@ -1198,8 +1191,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
Menu* pMenu = this;
while ( pMenu )
{
- if ( !maChildEventListeners.empty() )
- maChildEventListeners.Call( &aEvent );
+ maChildEventListeners.Call( &aEvent );
if( aDelData.isDeleted() )
break;
@@ -1211,12 +1203,12 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
void Menu::AddEventListener( const Link& rEventListener )
{
- maEventListeners.push_back( rEventListener );
+ maEventListeners.addListener( rEventListener );
}
void Menu::RemoveEventListener( const Link& rEventListener )
{
- maEventListeners.remove( rEventListener );
+ maEventListeners.removeListener( rEventListener );
}
// -----------------------------------------------------------------------
@@ -2369,6 +2361,10 @@ Size Menu::ImplCalcSize( Window* pWin )
if( nMax > nMinMenuItemHeight )
nMinMenuItemHeight = nMax;
+ // When no native rendering of the checkbox & no image in the menu, we
+ // have to add some extra space even in the MENU_FLAG_SHOWCHECKIMAGES case
+ bool bSpaceForCheckbox = ( nMax == 0 );
+
const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
if ( rSettings.GetUseImagesInMenus() )
{
@@ -2378,6 +2374,9 @@ Size Menu::ImplCalcSize( Window* pWin )
MenuItemData* pData = pItemList->GetDataFromPos( --i );
if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE )))
{
+ // we have an icon, don't add the extra space
+ bSpaceForCheckbox = false;
+
Size aImgSz = pData->aImage.GetSizePixel();
if ( aImgSz.Height() > aMaxImgSz.Height() )
aMaxImgSz.Height() = aImgSz.Height();
@@ -2424,7 +2423,7 @@ Size Menu::ImplCalcSize( Window* pWin )
if ( !bIsMenuBar && pData->HasCheck() )
{
nCheckWidth = nMaxCheckWidth;
- if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
+ if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
{
// checks / images take the same place
if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
@@ -2498,7 +2497,7 @@ Size Menu::ImplCalcSize( Window* pWin )
sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
nCheckPos = (sal_uInt16)nExtra;
- if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
+ if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
{
long nImgOrChkWidth = 0;
nImagePos = nCheckPos;
@@ -5220,18 +5219,14 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) :
if( pResMgr )
{
BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- BitmapEx aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, *pResMgr ) );
-
aCloser.maImage = Image( aBitmap );
- aCloser.maImageHC = Image( aBitmapHC );
aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT );
aCloser.SetBackground();
aCloser.SetPaintTransparent( sal_True );
aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP );
- aCloser.InsertItem( IID_DOCUMENTCLOSE,
- GetSettings().GetStyleSettings().GetHighContrastMode() ? aCloser.maImageHC : aCloser.maImage, 0 );
+ aCloser.InsertItem( IID_DOCUMENTCLOSE, aCloser.maImage, 0 );
aCloser.SetSelectHdl( LINK( this, MenuBarWindow, CloserHdl ) );
aCloser.AddEventListener( LINK( this, MenuBarWindow, ToolboxEventHdl ) );
aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr ) ) );
@@ -6160,3 +6155,5 @@ ImplMenuDelData::~ImplMenuDelData()
if( mpMenu )
const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index c6d6afa4a2d2..ca8bcf3c2917 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -417,3 +418,5 @@ String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr )
return aStr;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/mnemonicengine.cxx b/vcl/source/window/mnemonicengine.cxx
index f277ee0c1265..1ca9f2c22d57 100644
--- a/vcl/source/window/mnemonicengine.cxx
+++ b/vcl/source/window/mnemonicengine.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -128,3 +129,5 @@ namespace vcl
//........................................................................
} // namespace vcl
//........................................................................
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/mouseevent.cxx b/vcl/source/window/mouseevent.cxx
index afb0b5f68a07..2e76750e1cf5 100644
--- a/vcl/source/window/mouseevent.cxx
+++ b/vcl/source/window/mouseevent.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,3 +91,5 @@ void MouseEvent::InitMouseEvent( ::com::sun::star::awt::MouseEvent& rEvent ) con
rEvent.ClickCount = GetClicks();
rEvent.PopupTrigger = sal_False;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 9f36b9ed5109..3f8c5683458f 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -55,14 +56,11 @@ static void ImplInitMsgBoxImageList()
{
ResMgr* pResMgr = ImplGetResMgr();
pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
- pSVData->maWinData.mpMsgBoxHCImgList = new ImageList(4);
if( pResMgr )
{
Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask );
- pSVData->maWinData.mpMsgBoxHCImgList->InsertFromHorizontalBitmap
- ( ResId( SV_RESID_BITMAP_MSGBOX_HC, *pResMgr ), 4, &aNonAlphaMask );
}
}
}
@@ -209,7 +207,7 @@ MessBox::MessBox( Window* pParent, const ResId& rResId ) :
void MessBox::ImplLoadRes( const ResId& )
{
- SetText( ReadStringRes() );
+ SetText( ReadStringRes() );
SetMessText( ReadStringRes() );
SetHelpText( ReadStringRes() );
}
@@ -312,9 +310,6 @@ void MessBox::ImplPosControls()
IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
aImageSize );
mpFixedImage->SetImage( maImage );
- // forward the HC image
- if( !!maImageHC )
- mpFixedImage->SetModeImage( maImageHC, BMP_COLOR_HIGHCONTRAST );
mpFixedImage->Show();
nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
}
@@ -467,37 +462,41 @@ void MessBox::SetDefaultCheckBoxText()
// -----------------------------------------------------------------------
-sal_Bool MessBox::SetModeImage( const Image& rImage, BmpColorMode eMode )
+sal_Bool MessBox::SetModeImage( const Image& rImage )
{
- if( eMode == BMP_COLOR_NORMAL )
- SetImage( rImage );
- else if( eMode == BMP_COLOR_HIGHCONTRAST )
- maImageHC = rImage;
- else
- return sal_False;
+ SetImage( rImage );
return sal_True;
}
// -----------------------------------------------------------------------
-const Image& MessBox::GetModeImage( BmpColorMode eMode ) const
+const Image& MessBox::GetModeImage( ) const
{
- if( eMode == BMP_COLOR_HIGHCONTRAST )
- return maImageHC;
- else
- return maImage;
+ return maImage;
}
// -----------------------------------------------------------------------
+Size MessBox::GetOptimalSize(WindowSizeType eType) const
+{
+ switch( eType ) {
+ case WINDOWSIZE_MINIMUM:
+ // FIXME: base me on the font size ?
+ return Size( 250, 100 );
+ default:
+ return Window::GetOptimalSize( eType );
+ }
+}
+
+// ============================================================================
+
void InfoBox::ImplInitInfoBoxData()
{
// Default Text is the display title from the application
if ( !GetText().Len() )
SetText( Application::GetDisplayName() );
- SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
- InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() );
+ SetImage( InfoBox::GetStandardImage() );
mnSoundType = ((sal_uInt16)SOUND_INFO)+1;
}
@@ -525,15 +524,7 @@ Image InfoBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
}
-// -----------------------------------------------------------------------
-
-Image InfoBox::GetStandardImageHC()
-{
- ImplInitMsgBoxImageList();
- return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 4 );
-}
-
-// -----------------------------------------------------------------------
+// ============================================================================
void WarningBox::ImplInitWarningBoxData()
{
@@ -579,7 +570,7 @@ Image WarningBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
}
-// -----------------------------------------------------------------------
+// ============================================================================
void ErrorBox::ImplInitErrorBoxData()
{
@@ -587,8 +578,7 @@ void ErrorBox::ImplInitErrorBoxData()
if ( !GetText().Len() )
SetText( Application::GetDisplayName() );
- SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
- ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() );
+ SetImage( ErrorBox::GetStandardImage() );
mnSoundType = ((sal_uInt16)SOUND_ERROR)+1;
}
@@ -617,15 +607,7 @@ Image ErrorBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
}
-// -----------------------------------------------------------------------
-
-Image ErrorBox::GetStandardImageHC()
-{
- ImplInitMsgBoxImageList();
- return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 1 );
-}
-
-// -----------------------------------------------------------------------
+// ============================================================================
void QueryBox::ImplInitQueryBoxData()
{
@@ -633,8 +615,7 @@ void QueryBox::ImplInitQueryBoxData()
if ( !GetText().Len() )
SetText( Application::GetDisplayName() );
- SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
- QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
+ SetImage( QueryBox::GetStandardImage() );
mnSoundType = ((sal_uInt16)SOUND_QUERY)+1;
}
@@ -671,23 +652,4 @@ Image QueryBox::GetStandardImage()
return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
}
-// -----------------------------------------------------------------------
-
-Image QueryBox::GetStandardImageHC()
-{
- ImplInitMsgBoxImageList();
- return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 2 );
-}
-
-// -----------------------------------------------------------------------
-
-Size MessBox::GetOptimalSize(WindowSizeType eType) const
-{
- switch( eType ) {
- case WINDOWSIZE_MINIMUM:
- // FIXME: base me on the font size ?
- return Size( 250, 100 );
- default:
- return Window::GetOptimalSize( eType );
- }
-}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/popupmenuwindow.cxx b/vcl/source/window/popupmenuwindow.cxx
index 78ef0bcf1068..46fc51d8176d 100644
--- a/vcl/source/window/popupmenuwindow.cxx
+++ b/vcl/source/window/popupmenuwindow.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -77,3 +78,4 @@ bool PopupMenuFloatingWindow::IsPopupMenu() const
return mpImplData->mnMenuStackLevel != ::std::numeric_limits<sal_uInt16>::max();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 094567c7f15c..a0160f78f287 100755..100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -72,10 +73,7 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re
{
SetPaintTransparent( sal_True );
SetBackground();
- if( useHCColorReplacement() )
- maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
- else
- maPageVDev.SetBackground( Color( COL_WHITE ) );
+ maPageVDev.SetBackground( Color( COL_WHITE ) );
maHorzDim.Show();
maVertDim.Show();
@@ -87,79 +85,12 @@ PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
{
}
-bool PrintDialog::PrintPreviewWindow::useHCColorReplacement() const
-{
- bool bRet = false;
- if( GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- try
- {
- // get service provider
- Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
- // create configuration hierachical access name
- if( xSMgr.is() )
- {
- try
- {
- Reference< XMultiServiceFactory > xConfigProvider(
- Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY )
- );
- if( xConfigProvider.is() )
- {
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Accessibility" ) );
- aArgs.getArray()[0] <<= aVal;
- Reference< XNameAccess > xConfigAccess(
- Reference< XNameAccess >(
- xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY )
- );
- if( xConfigAccess.is() )
- {
- try
- {
- sal_Bool bValue = sal_False;
- Any aAny = xConfigAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsForPagePreviews" ) ) );
- if( aAny >>= bValue )
- bRet = bool(bValue);
- }
- catch( NoSuchElementException& )
- {
- }
- catch( WrappedTargetException& )
- {
- }
- }
- }
- }
- catch( Exception& )
- {
- }
- }
- }
- catch( WrappedTargetException& )
- {
- }
- }
- return bRet;
-}
-
void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt )
{
// react on settings changed
if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
{
- if( useHCColorReplacement() )
- maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
- else
- maPageVDev.SetBackground( Color( COL_WHITE ) );
+ maPageVDev.SetBackground( Color( COL_WHITE ) );
}
Window::DataChanged( i_rDCEvt );
}
@@ -322,10 +253,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
aBuf.append( maToolTipString );
SetQuickHelpText( aBuf.makeStringAndClear() );
maMtf = i_rNewPreview;
- if( useHCColorReplacement() )
- {
- maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 );
- }
maOrigSize = i_rOrigSize;
maReplacementString = i_rReplacement;
@@ -623,13 +550,12 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId )
, maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) )
, maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) )
, maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) )
- , maCollateHCImg( VclResId( SV_PRINT_COLLATE_HC_IMG ) )
, maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) )
- , maNoCollateHCImg( VclResId( SV_PRINT_NOCOLLATE_HC_IMG ) )
, mnCollateUIMode( 0 )
{
FreeResource();
+
maCopySpacer.Show();
maStatusTxt.Show();
maCommentTxt.Show();
@@ -707,15 +633,6 @@ void PrintDialog::JobTabPage::readFromSettings()
SettingsConfigItem* pItem = SettingsConfigItem::get();
rtl::OUString aValue;
- #if 0
- // do not actually make copy count persistent
- // the assumption is that this would lead to a lot of unwanted copies
- aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
- sal_Int32 nVal = aValue.toInt32();
- maCopyCountField.SetValue( sal_Int64(nVal > 1 ? nVal : 1) );
- #endif
-
aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CollateBox" ) ) );
if( aValue.equalsIgnoreAsciiCaseAscii( "alwaysoff" ) )
@@ -742,7 +659,8 @@ void PrintDialog::JobTabPage::storeToSettings()
maCopyCountField.GetText() );
pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ),
- rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) );
+ maCollateBox.IsChecked() ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true")) :
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) );
}
PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId )
@@ -777,14 +695,6 @@ void PrintDialog::OutputOptPage::setupLayout()
void PrintDialog::OutputOptPage::readFromSettings()
{
- #if 0
- SettingsConfigItem* pItem = SettingsConfigItem::get();
- rtl::OUString aValue;
-
- aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ) );
- maToFileBox.Check( aValue.equalsIgnoreAsciiCaseAscii( "true" ) );
- #endif
}
void PrintDialog::OutputOptPage::storeToSettings()
@@ -792,7 +702,8 @@ void PrintDialog::OutputOptPage::storeToSettings()
SettingsConfigItem* pItem = SettingsConfigItem::get();
pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ),
- rtl::OUString::createFromAscii( maToFileBox.IsChecked() ? "true" : "false" ) );
+ maToFileBox.IsChecked() ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))
+ : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("false")) );
}
PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController )
@@ -842,6 +753,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
// init reverse print
maJobPage.maReverseOrderBox.Check( maPController->getReversePrint() );
+
// fill printer listbox
const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() );
for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin();
@@ -1146,7 +1058,7 @@ void PrintDialog::setupOptionalUI()
boost::shared_ptr< vcl::RowOrColumn > pCurColumn;
Window* pCurParent = 0, *pDynamicPageParent = 0;
- sal_uInt16 nOptPageId = 9, nCurSubGroup = 0;
+ sal_uInt16 nOptPageId = 9;
bool bOnStaticPage = false;
bool bSubgroupOnStaticPage = false;
@@ -1159,7 +1071,6 @@ void PrintDialog::setupOptionalUI()
rOptions[i].Value >>= aOptProp;
// extract ui element
- bool bEnabled = true;
rtl::OUString aCtrlType;
rtl::OUString aText;
rtl::OUString aPropertyName;
@@ -1177,59 +1088,58 @@ void PrintDialog::setupOptionalUI()
for( int n = 0; n < aOptProp.getLength(); n++ )
{
const beans::PropertyValue& rEntry( aOptProp[ n ] );
- if( rEntry.Name.equalsAscii( "Text" ) )
+ if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Text" ) ) )
{
rEntry.Value >>= aText;
}
- else if( rEntry.Name.equalsAscii( "ControlType" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ControlType" ) ) )
{
rEntry.Value >>= aCtrlType;
}
- else if( rEntry.Name.equalsAscii( "Choices" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Choices" ) ) )
{
rEntry.Value >>= aChoices;
}
- else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChoicesDisabled" ) ) )
{
rEntry.Value >>= aChoicesDisabled;
}
- else if( rEntry.Name.equalsAscii( "Property" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Property" ) ) )
{
PropertyValue aVal;
rEntry.Value >>= aVal;
aPropertyName = aVal.Name;
}
- else if( rEntry.Name.equalsAscii( "Enabled" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Enabled" ) ) )
{
sal_Bool bValue = sal_True;
rEntry.Value >>= bValue;
- bEnabled = bValue;
}
- else if( rEntry.Name.equalsAscii( "GroupingHint" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GroupingHint" ) ) )
{
rEntry.Value >>= aGroupingHint;
}
- else if( rEntry.Name.equalsAscii( "DependsOnName" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnName" ) ) )
{
rEntry.Value >>= aDependsOnName;
}
- else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DependsOnEntry" ) ) )
{
rEntry.Value >>= nDependsOnValue;
}
- else if( rEntry.Name.equalsAscii( "AttachToDependency" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "AttachToDependency" ) ) )
{
rEntry.Value >>= bUseDependencyRow;
}
- else if( rEntry.Name.equalsAscii( "MinValue" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MinValue" ) ) )
{
rEntry.Value >>= nMinValue;
}
- else if( rEntry.Name.equalsAscii( "MaxValue" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MaxValue" ) ) )
{
rEntry.Value >>= nMaxValue;
}
- else if( rEntry.Name.equalsAscii( "HelpText" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HelpText" ) ) )
{
if( ! (rEntry.Value >>= aHelpTexts) )
{
@@ -1241,7 +1151,7 @@ void PrintDialog::setupOptionalUI()
}
}
}
- else if( rEntry.Name.equalsAscii( "HelpId" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HelpId" ) ) )
{
if( ! (rEntry.Value >>= aHelpIds ) )
{
@@ -1253,7 +1163,7 @@ void PrintDialog::setupOptionalUI()
}
}
}
- else if( rEntry.Name.equalsAscii( "HintNoLayoutPage" ) )
+ else if( rEntry.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HintNoLayoutPage" ) ) )
{
sal_Bool bNoLayoutPage = sal_False;
rEntry.Value >>= bNoLayoutPage;
@@ -1268,7 +1178,7 @@ void PrintDialog::setupOptionalUI()
bool bSwitchPage = false;
if( aGroupingHint.getLength() )
bSwitchPage = true;
- else if( aCtrlType.equalsAscii( "Subgroup" ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) )
bSwitchPage = true;
if( bSwitchPage )
{
@@ -1281,25 +1191,25 @@ void PrintDialog::setupOptionalUI()
bOnStaticPage = false;
bSubgroupOnStaticPage = false;
- if( aGroupingHint.equalsAscii( "PrintRange" ) )
+ if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) )
{
pCurColumn = maJobPage.mxPrintRange;
pCurParent = &maJobPage; // set job page as current parent
bOnStaticPage = true;
}
- else if( aGroupingHint.equalsAscii( "OptionsPage" ) )
+ else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPage" ) ) )
{
pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maOptionsPage.getLayout());
pCurParent = &maOptionsPage; // set options page as current parent
bOnStaticPage = true;
}
- else if( aGroupingHint.equalsAscii( "OptionsPageOptGroup" ) )
+ else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OptionsPageOptGroup" ) ) )
{
pCurColumn = maOptionsPage.mxOptGroup;
pCurParent = &maOptionsPage; // set options page as current parent
bOnStaticPage = true;
}
- else if( aGroupingHint.equalsAscii( "LayoutPage" ) )
+ else if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LayoutPage" ) ) )
{
pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maNUpPage.getLayout());
pCurParent = &maNUpPage; // set layout page as current parent
@@ -1313,7 +1223,7 @@ void PrintDialog::setupOptionalUI()
}
}
- if( aCtrlType.equalsAscii( "Group" ) ||
+ if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Group" ) ) ||
( ! pCurParent && ! (bOnStaticPage || aGroupingHint.getLength() ) ) )
{
// add new tab page
@@ -1329,25 +1239,22 @@ void PrintDialog::setupOptionalUI()
// set help text
setHelpText( pNewGroup, aHelpTexts, 0 );
- // reset subgroup counter
- nCurSubGroup = 0;
-
aDynamicColumns.push_back( boost::dynamic_pointer_cast<vcl::RowOrColumn>(pNewGroup->getLayout()) );
pCurColumn = aDynamicColumns.back();
pCurColumn->setParentWindow( pNewGroup );
bSubgroupOnStaticPage = false;
bOnStaticPage = false;
}
- else if( aCtrlType.equalsAscii( "Subgroup" ) && (pCurParent || aGroupingHint.getLength() ) )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Subgroup" ) ) && (pCurParent || aGroupingHint.getLength() ) )
{
bSubgroupOnStaticPage = (aGroupingHint.getLength() != 0);
// create group FixedLine
- if( ! aGroupingHint.equalsAscii( "PrintRange" ) ||
+ if( ! aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) ||
! pCurColumn->countElements() == 0
)
{
Window* pNewSub = NULL;
- if( aGroupingHint.equalsAscii( "PrintRange" ) )
+ if( aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintRange" ) ) )
pNewSub = new FixedText( pCurParent, WB_VCENTER );
else
pNewSub = new FixedLine( pCurParent );
@@ -1371,9 +1278,9 @@ void PrintDialog::setupOptionalUI()
pIndent->setChild( pCurColumn );
}
// EVIL
- else if( aCtrlType.equalsAscii( "Bool" ) &&
- aGroupingHint.equalsAscii( "LayoutPage" ) &&
- aPropertyName.equalsAscii( "PrintProspect" )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) &&
+ aGroupingHint.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LayoutPage" ) ) &&
+ aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintProspect" ) )
)
{
maNUpPage.maBrochureBtn.SetText( aText );
@@ -1417,7 +1324,7 @@ void PrintDialog::setupOptionalUI()
}
}
}
- if( aCtrlType.equalsAscii( "Bool" ) && pCurParent )
+ if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Bool" ) ) && pCurParent )
{
// add a check box
CheckBox* pNewBox = new CheckBox( pCurParent );
@@ -1447,7 +1354,7 @@ void PrintDialog::setupOptionalUI()
// add checkbox to current column
pDependencyRow->addWindow( pNewBox );
}
- else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Radio" ) ) && pCurParent )
{
boost::shared_ptr<vcl::RowOrColumn> pRadioColumn( pCurColumn );
if( aText.getLength() )
@@ -1506,9 +1413,9 @@ void PrintDialog::setupOptionalUI()
pLabel->setLabel( pBtn );
}
}
- else if( ( aCtrlType.equalsAscii( "List" ) ||
- aCtrlType.equalsAscii( "Range" ) ||
- aCtrlType.equalsAscii( "Edit" )
+ else if( ( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) ||
+ aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) ||
+ aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) )
) && pCurParent )
{
// create a row in the current column
@@ -1525,13 +1432,14 @@ void PrintDialog::setupOptionalUI()
pHeading->SetText( aText );
pHeading->Show();
+
// add to row
pLabel = new vcl::LabeledElement( pFieldColumn.get(), 2 );
pFieldColumn->addChild( pLabel );
pLabel->setLabel( pHeading );
}
- if( aCtrlType.equalsAscii( "List" ) )
+ if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "List" ) ) )
{
ListBox* pList = new ListBox( pCurParent, WB_DROPDOWN | WB_BORDER );
maControls.push_front( pList );
@@ -1564,7 +1472,7 @@ void PrintDialog::setupOptionalUI()
else
pFieldColumn->addWindow( pList );
}
- else if( aCtrlType.equalsAscii( "Range" ) )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Range" ) ) )
{
NumericField* pField = new NumericField( pCurParent, WB_BORDER | WB_SPIN );
maControls.push_front( pField );
@@ -1597,7 +1505,7 @@ void PrintDialog::setupOptionalUI()
else
pFieldColumn->addWindow( pField );
}
- else if( aCtrlType.equalsAscii( "Edit" ) )
+ else if( aCtrlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Edit" ) ) )
{
Edit* pField = new Edit( pCurParent, WB_BORDER );
maControls.push_front( pField );
@@ -1627,7 +1535,7 @@ void PrintDialog::setupOptionalUI()
}
else
{
- DBG_ERROR( "Unsupported UI option" );
+ OSL_FAIL( "Unsupported UI option" );
}
pCurColumn = pSaveCurColumn;
@@ -1720,6 +1628,7 @@ void PrintDialog::setupOptionalUI()
}
Size aSz = getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED );
+
SetOutputSizePixel( aSz );
}
@@ -1739,21 +1648,12 @@ void PrintDialog::checkControlDependencies()
maJobPage.maCollateBox.Enable( sal_False );
Image aImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateImg : maJobPage.maNoCollateImg );
- Image aHCImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateHCImg : maJobPage.maNoCollateHCImg );
- bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
Size aImgSize( aImg.GetSizePixel() );
- Size aHCImgSize( aHCImg.GetSizePixel() );
-
- if( aHCImgSize.Width() > aImgSize.Width() )
- aImgSize.Width() = aHCImgSize.Width();
- if( aHCImgSize.Height() > aImgSize.Height() )
- aImgSize.Height() = aHCImgSize.Height();
// adjust size of image
maJobPage.maCollateImage.SetSizePixel( aImgSize );
- maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg );
- maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST );
+ maJobPage.maCollateImage.SetImage( aImg );
maJobPage.getLayout()->resize();
// enable setup button only for printers that can be setup
@@ -2283,7 +2183,7 @@ PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const
}
else
{
- DBG_ERROR( "changed control not in property map" );
+ OSL_FAIL( "changed control not in property map" );
}
return pVal;
}
@@ -2307,7 +2207,7 @@ void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty )
{
pBox->Check( bVal );
}
- else if( i_rProperty.equalsAscii( "PrintProspect" ) )
+ else if( i_rProperty.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintProspect" ) ) )
{
// EVIL special case
if( bVal )
@@ -2611,3 +2511,4 @@ void PrintProgressDialog::Paint( const Rectangle& )
}
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 178692ff45c2..5882ef3999ba 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-// #include <math.h>
#include <limits.h>
#include <tools/time.hxx>
#include <tools/debug.hxx>
@@ -400,7 +400,7 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG )
pWindow->Command( aCEvt );
if( aDel.IsDead() )
return 0;
- mnRepaintTime = Max( Time::GetSystemTicks() - nTime, 1UL );
+ mnRepaintTime = Max( Time::GetSystemTicks() - nTime, (sal_uLong)1 );
ImplRecalcScrollValues();
}
}
@@ -411,3 +411,5 @@ IMPL_LINK( ImplWheelWindow, ImplScrollHdl, Timer*, EMPTYARG )
return 0L;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/scrwnd.hxx b/vcl/source/window/scrwnd.hxx
index 1b9011aa7859..ccc38c778c99 100644
--- a/vcl/source/window/scrwnd.hxx
+++ b/vcl/source/window/scrwnd.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -90,3 +91,5 @@ public:
void ImplSetWheelMode( sal_uLong nWheelMode );
sal_uLong ImplGetWheelMode() const { return mnWheelMode; }
};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index c92d9dd4130a..0c323c37f0f6 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -49,14 +50,12 @@ inline sal_Bool SelectionEngine::ShouldDeselect( sal_Bool bModifierKey1 ) const
|*
|* SelectionEngine::SelectionEngine()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
-SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) :
- pWin( pWindow )
+SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet,
+ sal_uLong nAutoRepeatInterval ) :
+ pWin( pWindow ),
+ nUpdateInterval( nAutoRepeatInterval )
{
eSelMode = SINGLE_SELECTION;
pFunctionSet = pFuncSet;
@@ -64,17 +63,13 @@ SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) :
nLockedMods = 0;
aWTimer.SetTimeoutHdl( LINK( this, SelectionEngine, ImpWatchDog ) );
- aWTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
+ aWTimer.SetTimeout( nUpdateInterval );
}
/*************************************************************************
|*
|* SelectionEngine::~SelectionEngine()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
SelectionEngine::~SelectionEngine()
@@ -86,10 +81,6 @@ SelectionEngine::~SelectionEngine()
|*
|* SelectionEngine::ImpWatchDog()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
IMPL_LINK( SelectionEngine, ImpWatchDog, Timer*, EMPTYARG )
@@ -103,10 +94,6 @@ IMPL_LINK( SelectionEngine, ImpWatchDog, Timer*, EMPTYARG )
|*
|* SelectionEngine::SetSelectionMode()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
void SelectionEngine::SetSelectionMode( SelectionMode eMode )
@@ -118,10 +105,6 @@ void SelectionEngine::SetSelectionMode( SelectionMode eMode )
|*
|* SelectionEngine::ActivateDragMode()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
void SelectionEngine::ActivateDragMode()
@@ -133,10 +116,6 @@ void SelectionEngine::ActivateDragMode()
|*
|* SelectionEngine::CursorPosChanging()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung GT 2002-04-04
-|*
*************************************************************************/
void SelectionEngine::CursorPosChanging( sal_Bool bShift, sal_Bool bMod1 )
@@ -191,10 +170,6 @@ void SelectionEngine::CursorPosChanging( sal_Bool bShift, sal_Bool bMod1 )
|*
|* SelectionEngine::SelMouseButtonDown()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 07.06.95
-|*
*************************************************************************/
sal_Bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
@@ -324,10 +299,6 @@ sal_Bool SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
|*
|* SelectionEngine::SelMouseButtonUp()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
sal_Bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt )
@@ -378,10 +349,6 @@ sal_Bool SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt )
|*
|* SelectionEngine::SelMouseMove()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
@@ -400,7 +367,7 @@ sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
if( aWTimer.IsActive() && !aArea.IsInside( rMEvt.GetPosPixel() ))
return sal_True;
-
+ aWTimer.SetTimeout( nUpdateInterval );
aWTimer.Start();
if ( eSelMode != SINGLE_SELECTION )
{
@@ -422,10 +389,6 @@ sal_Bool SelectionEngine::SelMouseMove( const MouseEvent& rMEvt )
|*
|* SelectionEngine::SetWindow()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 10.10.94
-|* Letzte Aenderung OV 10.10.94
-|*
*************************************************************************/
void SelectionEngine::SetWindow( Window* pNewWin )
@@ -444,10 +407,6 @@ void SelectionEngine::SetWindow( Window* pNewWin )
|*
|* SelectionEngine::Reset()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 07.07.95
-|* Letzte Aenderung OV 07.07.95
-|*
*************************************************************************/
void SelectionEngine::Reset()
@@ -463,10 +422,6 @@ void SelectionEngine::Reset()
|*
|* SelectionEngine::Command()
|*
-|* Beschreibung SELENG.SDW
-|* Ersterstellung OV 07.07.95
-|* Letzte Aenderung OV 07.07.95
-|*
*************************************************************************/
void SelectionEngine::Command( const CommandEvent& rCEvt )
@@ -496,3 +451,29 @@ void SelectionEngine::Command( const CommandEvent& rCEvt )
nFlags &= ~SELENG_CMDEVT;
}
}
+
+void SelectionEngine::SetUpdateInterval( sal_uLong nInterval )
+{
+ if (nInterval < SELENG_AUTOREPEAT_INTERVAL_MIN)
+ // Set a lower threshold. On Windows, setting this value too low
+ // would cause selection to get updated indefinitely.
+ nInterval = SELENG_AUTOREPEAT_INTERVAL_MIN;
+
+ if (nUpdateInterval == nInterval)
+ // no update needed.
+ return;
+
+ if (aWTimer.IsActive())
+ {
+ // reset the timer right away on interval change.
+ aWTimer.Stop();
+ aWTimer.SetTimeout(nInterval);
+ aWTimer.Start();
+ }
+ else
+ aWTimer.SetTimeout(nInterval);
+
+ nUpdateInterval = nInterval;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx
index 976c56cfea56..683c114f48f7 100644
--- a/vcl/source/window/split.cxx
+++ b/vcl/source/window/split.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -805,3 +806,5 @@ void Splitter::Paint( const Rectangle& rPaintRect )
Window::Paint( rPaintRect );
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 1d701752389c..02be128cd8dd 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <string.h>
-#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <tools/rcid.h>
@@ -46,7 +46,6 @@
#include <svdata.hxx>
#include <svids.hrc>
-
// =======================================================================
// Attention: Must not contain non-PODs because array is enlarged/copied
@@ -123,10 +122,6 @@ namespace {
#define SPLIT_WINDOW ((sal_uInt16)0x0004)
#define SPLIT_NOSPLIT ((sal_uInt16)0x8000)
-// -----------------------------------------------------------------------
-
-DECLARE_LIST( ImplSplitList, SplitWindow* )
-
// =======================================================================
static void ImplCalcBorder( WindowAlign eAlign, sal_Bool bNoAlign,
@@ -189,42 +184,7 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
}
else
- {/*
- if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
- {
- pWin->SetLineColor( rStyleSettings.GetShadowColor() );
- pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
- pWin->SetLineColor( rStyleSettings.GetLightColor() );
- pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
- }
- else
- {
- pWin->SetLineColor( rStyleSettings.GetShadowColor() );
- pWin->DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
- pWin->SetLineColor( rStyleSettings.GetLightColor() );
- pWin->DrawLine( Point( 0, 1 ), Point( nDX-1, 1 ) );
- if ( (pWin->meAlign == WINDOWALIGN_LEFT) || (pWin->meAlign == WINDOWALIGN_RIGHT) )
- {
- if ( pWin->meAlign == WINDOWALIGN_LEFT )
- {
- pWin->SetLineColor( rStyleSettings.GetShadowColor() );
- pWin->DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
- pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
- pWin->SetLineColor( rStyleSettings.GetLightColor() );
- pWin->DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
- pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
- }
- else
- {
- pWin->SetLineColor( rStyleSettings.GetShadowColor() );
- pWin->DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
- pWin->DrawLine( Point( 0, nDY-2 ), Point( nDX-2, nDY-2 ) );
- pWin->SetLineColor( rStyleSettings.GetLightColor() );
- pWin->DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
- pWin->DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
- }
- }
- }*/
+ {
if ( pWin->meAlign == WINDOWALIGN_BOTTOM )
{
pWin->SetLineColor( rStyleSettings.GetShadowColor() );
@@ -3938,3 +3898,5 @@ Rectangle SplitWindow::GetFadeOutRect() const
ImplGetFadeOutRect( aRect, sal_True );
return aRect;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index ee673e87c4b5..60765be7af5d 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
@@ -96,8 +96,6 @@ struct ImplStatusItem
XubString maCommand;
};
-DECLARE_LIST( ImplStatusItemList, ImplStatusItem* )
-
// =======================================================================
inline long ImplCalcProgessWidth( sal_uInt16 nMax, long nSize )
@@ -197,18 +195,13 @@ StatusBar::StatusBar( Window* pParent, const ResId& rResId ) :
StatusBar::~StatusBar()
{
// Alle Items loeschen
- ImplStatusItem* pItem = mpItemList->First();
- while ( pItem )
- {
- delete pItem;
- pItem = mpItemList->Next();
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ delete (*mpItemList)[ i ];
}
-
delete mpItemList;
// VirtualDevice loeschen
delete mpImplData->mpVirDev;
-
delete mpImplData;
}
@@ -280,19 +273,17 @@ void StatusBar::ImplFormat()
// Breiten zusammenrechnen
mnItemsWidth = STATUSBAR_OFFSET_X;
long nOffset = 0;
- pItem = mpItemList->First();
- while ( pItem )
- {
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ pItem = (*mpItemList)[ i ];
if ( pItem->mbVisible )
{
- if ( pItem->mnBits & SIB_AUTOSIZE )
+ if ( pItem->mnBits & SIB_AUTOSIZE ) {
nAutoSizeItems++;
+ }
mnItemsWidth += pItem->mnWidth + nOffset;
nOffset = pItem->mnOffset;
}
-
- pItem = mpItemList->Next();
}
if ( GetStyle() & WB_RIGHT )
@@ -324,28 +315,22 @@ void StatusBar::ImplFormat()
nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
}
- pItem = mpItemList->First();
- while ( pItem )
- {
- if ( pItem->mbVisible )
- {
- if ( pItem->mnBits & SIB_AUTOSIZE )
- {
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ pItem = (*mpItemList)[ i ];
+ if ( pItem->mbVisible ) {
+ if ( pItem->mnBits & SIB_AUTOSIZE ) {
pItem->mnExtraWidth = nExtraWidth;
- if ( nExtraWidth2 )
- {
+ if ( nExtraWidth2 ) {
pItem->mnExtraWidth++;
nExtraWidth2--;
}
- }
- else
+ } else {
pItem->mnExtraWidth = 0;
+ }
pItem->mnX = nX;
nX += pItem->mnWidth + pItem->mnExtraWidth + pItem->mnOffset;
}
-
- pItem = mpItemList->Next();
}
mbFormat = sal_False;
@@ -357,7 +342,7 @@ Rectangle StatusBar::ImplGetItemRectPos( sal_uInt16 nPos ) const
{
Rectangle aRect;
ImplStatusItem* pItem;
- pItem = mpItemList->GetObject( nPos );
+ pItem = ( nPos < mpItemList->size() ) ? (*mpItemList)[ nPos ] : NULL;
if ( pItem )
{
if ( pItem->mbVisible )
@@ -380,13 +365,13 @@ sal_uInt16 StatusBar::ImplGetFirstVisiblePos() const
{
ImplStatusItem* pItem;
- for( sal_uInt16 nPos = 0; nPos < mpItemList->Count(); nPos++ )
+ for( size_t nPos = 0; nPos < mpItemList->size(); nPos++ )
{
- pItem = mpItemList->GetObject( nPos );
+ pItem = (*mpItemList)[ nPos ];
if ( pItem )
{
if ( pItem->mbVisible )
- return nPos;
+ return sal_uInt16(nPos);
}
}
@@ -440,7 +425,7 @@ void StatusBar::ImplDrawItem( sal_Bool bOffScreen, sal_uInt16 nPos, sal_Bool bDr
return;
// Ausgabebereich berechnen
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
long nW = mpImplData->mnItemBorderWidth + 1;
Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW,
aRect.Right()-nW, aRect.Bottom()-nW );
@@ -743,14 +728,13 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
if ( mbVisibleItems )
{
Point aMousePos = rMEvt.GetPosPixel();
- sal_uInt16 i = 0;
// Item suchen, das geklickt wurde
- ImplStatusItem* pItem = mpItemList->First();
- while ( pItem )
+ for ( size_t i = 0; i < mpItemList->size(); ++i )
{
+ ImplStatusItem* pItem = (*mpItemList)[ i ];
// Ist es dieses Item
- if ( ImplGetItemRectPos( i ).IsInside( aMousePos ) )
+ if ( ImplGetItemRectPos( sal_uInt16(i) ).IsInside( aMousePos ) )
{
mnCurItemId = pItem->mnId;
if ( rMEvt.GetClicks() == 2 )
@@ -762,9 +746,6 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
// Item wurde gefunden
return;
}
-
- i++;
- pItem = mpItemList->Next();
}
}
@@ -783,7 +764,7 @@ void StatusBar::Paint( const Rectangle& )
if ( mbFormat )
ImplFormat();
- sal_uInt16 nItemCount = (sal_uInt16)mpItemList->Count();
+ sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() );
if ( mbProgressMode )
ImplDrawProgress( sal_True, 0, mnPercent );
@@ -962,22 +943,23 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
+ if ( (rDCEvt.GetType() == DATACHANGED_DISPLAY )
+ || (rDCEvt.GetType() == DATACHANGED_FONTS )
+ || (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION)
+ || ( (rDCEvt.GetType() == DATACHANGED_SETTINGS)
+ && (rDCEvt.GetFlags() & SETTINGS_STYLE )
+ )
+ )
{
mbFormat = sal_True;
ImplInitSettings( sal_True, sal_True, sal_True );
- ImplStatusItem* pItem = mpItemList->First();
long nFudge = GetTextHeight() / 4;
- while ( pItem )
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
{
+ ImplStatusItem* pItem = (*mpItemList)[ i ];
long nWidth = GetTextWidth( pItem->maText ) + nFudge;
if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
- pItem = mpItemList->Next();
}
Size aSize = GetSizePixel();
// do not disturb current width, since
@@ -1037,7 +1019,11 @@ void StatusBar::InsertItem( sal_uInt16 nItemId, sal_uLong nWidth,
pItem->mbVisible = sal_True;
// Item in die Liste einfuegen
- mpItemList->Insert( pItem, nPos );
+ if ( nPos < mpItemList->size() ) {
+ mpItemList->insert( mpItemList->begin() + nPos, pItem );
+ } else {
+ mpItemList->push_back( pItem );
+ }
mbFormat = sal_True;
if ( ImplIsItemUpdate() )
@@ -1053,8 +1039,8 @@ void StatusBar::RemoveItem( sal_uInt16 nItemId )
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->Remove( nPos );
- delete pItem;
+ delete (*mpItemList)[ nPos ];
+ mpItemList->erase( mpItemList->begin() + nPos );
mbFormat = sal_True;
if ( ImplIsItemUpdate() )
@@ -1072,7 +1058,7 @@ void StatusBar::ShowItem( sal_uInt16 nItemId )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( !pItem->mbVisible )
{
pItem->mbVisible = sal_True;
@@ -1094,7 +1080,7 @@ void StatusBar::HideItem( sal_uInt16 nItemId )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( pItem->mbVisible )
{
pItem->mbVisible = sal_False;
@@ -1115,7 +1101,7 @@ sal_Bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mbVisible;
+ return (*mpItemList)[ nPos ]->mbVisible;
else
return sal_False;
}
@@ -1153,24 +1139,14 @@ void StatusBar::HideItems()
void StatusBar::CopyItems( const StatusBar& rStatusBar )
{
// Alle Items entfernen
- ImplStatusItem* pItem = mpItemList->First();
- while ( pItem )
- {
- delete pItem;
- pItem = mpItemList->Next();
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ delete (*mpItemList)[ i ];
}
-
- // Items aus der Liste loeschen
- mpItemList->Clear();
+ mpItemList->clear();
// Items kopieren
- sal_uLong i = 0;
- pItem = rStatusBar.mpItemList->GetObject( i );
- while ( pItem )
- {
- mpItemList->Insert( new ImplStatusItem( *pItem ), LIST_APPEND );
- i++;
- pItem = rStatusBar.mpItemList->GetObject( i );
+ for ( size_t i = 0, n = rStatusBar.mpItemList->size(); i < n; ++i ) {
+ mpItemList->push_back( new ImplStatusItem( *(*rStatusBar.mpItemList)[ i ] ) );
}
mbFormat = sal_True;
@@ -1183,15 +1159,10 @@ void StatusBar::CopyItems( const StatusBar& rStatusBar )
void StatusBar::Clear()
{
// Alle Item loeschen
- ImplStatusItem* pItem = mpItemList->First();
- while ( pItem )
- {
- delete pItem;
- pItem = mpItemList->Next();
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ delete (*mpItemList)[ i ];
}
-
- // Items aus der Liste loeschen
- mpItemList->Clear();
+ mpItemList->clear();
mbFormat = sal_True;
if ( ImplIsItemUpdate() )
@@ -1204,31 +1175,26 @@ void StatusBar::Clear()
sal_uInt16 StatusBar::GetItemCount() const
{
- return (sal_uInt16)mpItemList->Count();
+ return (sal_uInt16)mpItemList->size();
}
// -----------------------------------------------------------------------
sal_uInt16 StatusBar::GetItemId( sal_uInt16 nPos ) const
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
- if ( pItem )
- return pItem->mnId;
- else
- return 0;
+ if ( nPos < mpItemList->size() )
+ return (*mpItemList)[ nPos ]->mnId;
+ return 0;
}
// -----------------------------------------------------------------------
sal_uInt16 StatusBar::GetItemPos( sal_uInt16 nItemId ) const
{
- ImplStatusItem* pItem = mpItemList->First();
- while ( pItem )
- {
- if ( pItem->mnId == nItemId )
- return (sal_uInt16)mpItemList->GetCurPos();
-
- pItem = mpItemList->Next();
+ for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
+ if ( (*mpItemList)[ i ]->mnId == nItemId ) {
+ return sal_uInt16( i );
+ }
}
return STATUSBAR_ITEM_NOTFOUND;
@@ -1247,7 +1213,7 @@ sal_uInt16 StatusBar::GetItemId( const Point& rPos ) const
// Rechteck holen
Rectangle aRect = ImplGetItemRectPos( nPos );
if ( aRect.IsInside( rPos ) )
- return mpItemList->GetObject( nPos )->mnId;
+ return (*mpItemList)[ nPos ]->mnId;
}
}
@@ -1289,7 +1255,7 @@ Point StatusBar::GetItemTextPos( sal_uInt16 nItemId ) const
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
// Rechteck holen
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
Rectangle aRect = ImplGetItemRectPos( nPos );
long nW = mpImplData->mnItemBorderWidth + 1;
Rectangle aTextRect( aRect.Left()+nW, aRect.Top()+nW,
@@ -1316,9 +1282,9 @@ sal_uLong StatusBar::GetItemWidth( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mnWidth;
- else
- return 0;
+ return (*mpItemList)[ nPos ]->mnWidth;
+
+ return 0;
}
// -----------------------------------------------------------------------
@@ -1328,9 +1294,9 @@ StatusBarItemBits StatusBar::GetItemBits( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mnBits;
- else
- return 0;
+ return (*mpItemList)[ nPos ]->mnBits;
+
+ return 0;
}
// -----------------------------------------------------------------------
@@ -1340,9 +1306,9 @@ long StatusBar::GetItemOffset( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mnOffset;
- else
- return 0;
+ return (*mpItemList)[ nPos ]->mnOffset;
+
+ return 0;
}
// -----------------------------------------------------------------------
@@ -1353,7 +1319,7 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const XubString& rText )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( pItem->maText != rText )
{
@@ -1389,9 +1355,9 @@ const XubString& StatusBar::GetItemText( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->maText;
- else
- return ImplGetSVEmptyStr();
+ return (*mpItemList)[ nPos ]->maText;
+
+ return ImplGetSVEmptyStr();
}
// -----------------------------------------------------------------------
@@ -1402,7 +1368,7 @@ void StatusBar::SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( pItem->maCommand != rCommand )
pItem->maCommand = rCommand;
@@ -1416,9 +1382,9 @@ const XubString& StatusBar::GetItemCommand( sal_uInt16 nItemId )
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->maCommand;
- else
- return ImplGetSVEmptyStr();
+ return (*mpItemList)[ nPos ]->maCommand;
+
+ return ImplGetSVEmptyStr();
}
// -----------------------------------------------------------------------
@@ -1429,7 +1395,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
pItem->mpUserData = pNewData;
// Wenn es ein User-Item ist, DrawItem-Aufrufen
@@ -1450,9 +1416,9 @@ void* StatusBar::GetItemData( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mpUserData;
- else
- return NULL;
+ return (*mpItemList)[ nPos ]->mpUserData;
+
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -1462,7 +1428,7 @@ void StatusBar::SetHelpText( sal_uInt16 nItemId, const XubString& rText )
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- mpItemList->GetObject( nPos )->maHelpText = rText;
+ (*mpItemList)[ nPos ]->maHelpText = rText;
}
// -----------------------------------------------------------------------
@@ -1473,7 +1439,7 @@ const XubString& StatusBar::GetHelpText( sal_uInt16 nItemId ) const
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommand.Len() ))
{
Help* pHelp = Application::GetHelp();
@@ -1499,7 +1465,7 @@ void StatusBar::SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText )
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- mpItemList->GetObject( nPos )->maQuickHelpText = rText;
+ (*mpItemList)[ nPos ]->maQuickHelpText = rText;
}
// -----------------------------------------------------------------------
@@ -1510,11 +1476,11 @@ const XubString& StatusBar::GetQuickHelpText( sal_uInt16 nItemId ) const
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
return pItem->maQuickHelpText;
}
- else
- return ImplGetSVEmptyStr();
+
+ return ImplGetSVEmptyStr();
}
// -----------------------------------------------------------------------
@@ -1524,7 +1490,7 @@ void StatusBar::SetHelpId( sal_uInt16 nItemId, const rtl::OString& rHelpId )
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- mpItemList->GetObject( nPos )->maHelpId = rHelpId;
+ (*mpItemList)[ nPos ]->maHelpId = rHelpId;
}
// -----------------------------------------------------------------------
@@ -1536,7 +1502,7 @@ rtl::OString StatusBar::GetHelpId( sal_uInt16 nItemId ) const
rtl::OString aRet;
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( pItem->maHelpId.getLength() )
aRet = pItem->maHelpId;
else
@@ -1709,15 +1675,15 @@ void StatusBar::SetText( const XubString& rText )
Size StatusBar::CalcWindowSizePixel() const
{
- sal_uLong i = 0;
- sal_uLong nCount = mpItemList->Count();
+ size_t i = 0;
+ size_t nCount = mpItemList->size();
long nOffset = 0;
long nCalcWidth = (STATUSBAR_OFFSET_X*2);
long nCalcHeight;
while ( i < nCount )
{
- ImplStatusItem* pItem = mpItemList->GetObject( i );
+ ImplStatusItem* pItem = (*mpItemList)[ i ];
nCalcWidth += pItem->mnWidth + nOffset;
nOffset = pItem->mnOffset;
i++;
@@ -1777,7 +1743,7 @@ void StatusBar::SetAccessibleName( sal_uInt16 nItemId, const XubString& rName )
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
- ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ ImplStatusItem* pItem = (*mpItemList)[ nPos ];
if ( pItem->maAccessibleName != rName )
{
@@ -1794,9 +1760,11 @@ const XubString& StatusBar::GetAccessibleName( sal_uInt16 nItemId ) const
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->maAccessibleName;
- else
- return ImplGetSVEmptyStr();
+ return (*mpItemList)[ nPos ]->maAccessibleName;
+
+ return ImplGetSVEmptyStr();
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index 25e693ae72a2..9bdbfd970ed7 100755
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -234,9 +235,17 @@ void SystemChildWindow::ImplTestJavaException( void* pEnv )
throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>());
}
+#else
+ (void)pEnv;
#endif // SOLAR_JAVA
}
+void SystemChildWindow::SetForwardKey( sal_Bool bEnable )
+{
+ if ( mpWindowImpl->mpSysObj )
+ mpWindowImpl->mpSysObj->SetForwardKey( bEnable );
+}
+
// -----------------------------------------------------------------------
sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
@@ -340,3 +349,5 @@ sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
return nRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 3313402dfef6..f6c7e422cc3b 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1076,7 +1077,14 @@ unsigned int SystemWindow::GetScreenNumber() const
// -----------------------------------------------------------------------
-void SystemWindow::SetScreenNumber( unsigned int nScreen)
+void SystemWindow::SetScreenNumber(unsigned int nScreen)
{
mpWindowImpl->mpFrame->SetScreenNumber( nScreen );
}
+
+void SystemWindow::SetApplicationID(const rtl::OUString &rApplicationID)
+{
+ mpWindowImpl->mpFrame->SetApplicationID(rApplicationID);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx
index 92c013218286..32e8a0dcec92 100644
--- a/vcl/source/window/tabdlg.cxx
+++ b/vcl/source/window/tabdlg.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,7 @@
#include <vcl/fixed.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
-#ifndef _SV_RC_H
#include <tools/rc.h>
-#endif
@@ -274,3 +273,4 @@ void TabDialog::AdjustLayout()
ImplPosControls();
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 459e07f97042..a834af10d37d 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -203,11 +204,4 @@ void TabPage::DeactivatePage()
{
}
-// -----------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > TabPage::CreateAccessible()
-{
- // TODO: remove this method (incompatible)
-
- return Window::CreateAccessible();
-}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index f4f40f6722bf..9f796269014f 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -110,26 +111,8 @@ TaskPaneList::~TaskPaneList()
void TaskPaneList::AddWindow( Window *pWindow )
{
-#if OSL_DEBUG_LEVEL > 0
- bool bDockingWindow=false;
- bool bToolbox=false;
- bool bDialog=false;
- bool bUnknown=false;
-#endif
-
if( pWindow )
{
-#if OSL_DEBUG_LEVEL > 0
- if( pWindow->GetType() == RSC_DOCKINGWINDOW )
- bDockingWindow = true;
- else if( pWindow->GetType() == RSC_TOOLBOX )
- bToolbox = true;
- else if( pWindow->IsDialog() )
- bDialog = true;
- else
- bUnknown = true;
-#endif
-
::std::vector< Window* >::iterator insertionPos = mTaskPanes.end();
for ( ::std::vector< Window* >::iterator p = mTaskPanes.begin();
p != mTaskPanes.end();
@@ -147,8 +130,6 @@ void TaskPaneList::AddWindow( Window *pWindow )
// beginning, until the first window is found which has the ChildPathFocus. Now
// if this would be the ancestor window of another pane window, this would fudge
// the result
- // 2004-09-27 - fs@openoffice.org, while fixing #i33573#, which included replacing
- // the original fix for #98916# with this one here.
if ( pWindow->IsWindowOrChild( *p ) )
{
insertionPos = p + 1;
@@ -399,3 +380,4 @@ Window* TaskPaneList::FindNextFloat( Window *pWindow, sal_Bool bForward )
// --------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 682c65e47a6f..50137643a2cc 100755
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,7 +31,6 @@
#include <rtl/logfile.hxx>
-#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
#include <tools/poly.hxx>
@@ -144,7 +144,7 @@ struct ImplToolSizeArray
// -----------------------------------------------------------------------
-DECLARE_LIST( ImplTBList, ToolBox* )
+typedef ::std::vector< ToolBox* > ImplTBList;
class ImplTBDragMgr
{
@@ -168,12 +168,19 @@ public:
ImplTBDragMgr();
~ImplTBDragMgr();
- void Insert( ToolBox* pBox )
- { mpBoxList->Insert( pBox ); }
- void Remove( ToolBox* pBox )
- { mpBoxList->Remove( pBox ); }
- sal_uLong Count() const
- { return mpBoxList->Count(); }
+ void push_back( ToolBox* pBox )
+ { mpBoxList->push_back( pBox ); }
+ void erase( ToolBox* pBox )
+ {
+ for ( ImplTBList::iterator it = mpBoxList->begin(); it < mpBoxList->end(); ++it ) {
+ if ( *it == pBox ) {
+ mpBoxList->erase( it );
+ break;
+ }
+ }
+ }
+ size_t size() const
+ { return mpBoxList->size(); }
ToolBox* FindToolBox( const Rectangle& rRect );
@@ -1122,7 +1129,7 @@ void ToolBox::ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRec
mbHorz = sal_True;
}
else {
- DBG_ERROR( "ImplLineSizing: Trailing else" );
+ OSL_FAIL( "ImplLineSizing: Trailing else" );
nCurSize = 0;
mbHorz = sal_False;
}
@@ -1253,7 +1260,7 @@ sal_uInt16 ToolBox::ImplFindItemPos( ToolBox* pBox, const Point& rPos )
ImplTBDragMgr::ImplTBDragMgr()
{
- mpBoxList = new ImplTBList( 4, 4 );
+ mpBoxList = new ImplTBList();
mnLineMode = 0;
mnStartLines = 0;
mbCustomizeMode = sal_False;
@@ -1277,9 +1284,9 @@ ImplTBDragMgr::~ImplTBDragMgr()
ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect )
{
- ToolBox* pBox = mpBoxList->First();
- while ( pBox )
+ for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i )
{
+ ToolBox* pBox = (*mpBoxList)[ i ];
/*
* FIXME: since we can have multiple frames now we cannot
* find the drag target by its position alone.
@@ -1287,8 +1294,9 @@ ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect )
* this works in one frame only anyway. If the dialogue
* changes to a system window, we need a new implementation here
*/
- if ( pBox->IsReallyVisible() && pBox->ImplGetWindowImpl()->mpFrame == mpDragBox->ImplGetWindowImpl()->mpFrame )
- {
+ if ( pBox->IsReallyVisible()
+ && pBox->ImplGetWindowImpl()->mpFrame == mpDragBox->ImplGetWindowImpl()->mpFrame
+ ) {
if ( !pBox->ImplIsFloatingMode() )
{
Point aPos = pBox->GetPosPixel();
@@ -1298,11 +1306,9 @@ ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect )
return pBox;
}
}
-
- pBox = mpBoxList->Next();
}
- return pBox;
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -1501,11 +1507,8 @@ void ImplTBDragMgr::StartCustomizeMode()
{
mbCustomizeMode = sal_True;
- ToolBox* pBox = mpBoxList->First();
- while ( pBox )
- {
- pBox->ImplStartCustomizeMode();
- pBox = mpBoxList->Next();
+ for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) {
+ (*mpBoxList)[ i ]->ImplStartCustomizeMode();
}
}
@@ -1515,11 +1518,8 @@ void ImplTBDragMgr::EndCustomizeMode()
{
mbCustomizeMode = sal_False;
- ToolBox* pBox = mpBoxList->First();
- while ( pBox )
- {
- pBox->ImplEndCustomizeMode();
- pBox = mpBoxList->Next();
+ for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i ) {
+ (*mpBoxList)[ i ]->ImplEndCustomizeMode();
}
}
@@ -1621,7 +1621,6 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
mbCustomize = sal_False;
mbCustomizeMode = sal_False;
mbDragging = sal_False;
- mbHideStatusText = sal_False;
mbMenuStrings = sal_False;
mbIsShift = sal_False;
mbIsKeyEvent = sal_False;
@@ -1840,9 +1839,9 @@ ToolBox::~ToolBox()
{
// Wenn im TBDrag-Manager, dann wieder rausnehmen
if ( mbCustomize )
- pSVData->maCtrlData.mpTBDragMgr->Remove( this );
+ pSVData->maCtrlData.mpTBDragMgr->erase( this );
- if ( !pSVData->maCtrlData.mpTBDragMgr->Count() )
+ if ( !pSVData->maCtrlData.mpTBDragMgr->size() )
{
delete pSVData->maCtrlData.mpTBDragMgr;
pSVData->maCtrlData.mpTBDragMgr = NULL;
@@ -3407,6 +3406,54 @@ void ToolBox::ImplDrawNext( sal_Bool bIn )
// -----------------------------------------------------------------------
+void ToolBox::ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect )
+{
+ bool bNativeOk = false;
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+
+ if( IsNativeControlSupported( CTRL_TOOLBAR, PART_SEPARATOR ) )
+ {
+ ImplControlValue aControlValue;
+ ControlState nState = 0;
+ bNativeOk = DrawNativeControl( CTRL_TOOLBAR, PART_SEPARATOR,
+ rRect, nState, aControlValue, rtl::OUString() );
+ }
+
+ /* Draw the widget only if it can't be drawn natively. */
+ if( !bNativeOk )
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1];
+
+ // no separator before or after windows or at breaks
+ if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 )
+ {
+ pTempItem = &mpData->m_aItems[nPos+1];
+ if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak )
+ {
+ long nCenterPos, nSlim;
+ SetLineColor( rStyleSettings.GetSeparatorColor() );
+ if ( IsHorizontal() )
+ {
+ nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
+ nCenterPos = pItem->maRect.Center().X();
+ DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ),
+ Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) );
+ }
+ else
+ {
+ nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
+ nCenterPos = pItem->maRect.Center().Y();
+ DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ),
+ Point( pItem->maRect.Right() - nSlim, nCenterPos ) );
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bEnabled, sal_Bool bIsWindow )
{
// draws toolbar button background either native or using a coloured selection
@@ -3468,6 +3515,33 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain
if( rStyleSettings.GetFaceColor() == Color( COL_WHITE ) )
bHighContrastWhite = sal_True;
+ // Compute buttons area.
+ Size aBtnSize = pItem->maRect.GetSize();
+ if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate )
+ {
+ // separate button not for dropdown only where the whole button is painted
+ if ( pItem->mnBits & TIB_DROPDOWN &&
+ ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) )
+ {
+ Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz );
+ if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side
+ aBtnSize.Width() -= aArrowRect.GetWidth();
+ else // dropdown arrow on bottom side
+ aBtnSize.Height() -= aArrowRect.GetHeight();
+ }
+ }
+
+ /* Compute the button/separator rectangle here, we'll need it for
+ * both the buttons and the separators. */
+ Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize );
+ long nOffX = SMALLBUTTON_OFF_NORMAL_X;
+ long nOffY = SMALLBUTTON_OFF_NORMAL_Y;
+ long nImageOffX = 0;
+ long nImageOffY = 0;
+ long nTextOffX = 0;
+ long nTextOffY = 0;
+ sal_uInt16 nStyle = 0;
+
// draw separators in flat style only
if ( !bLayout &&
(mnOutStyle & TOOLBOX_STYLE_FLAT) &&
@@ -3475,31 +3549,7 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain
nPos > 0
)
{
- // no separator before or after windows or at breaks
- ImplToolItem* pTempItem = &mpData->m_aItems[nPos-1];
- if ( pTempItem && !pTempItem->mbShowWindow && nPos < mpData->m_aItems.size()-1 )
- {
- pTempItem = &mpData->m_aItems[nPos+1];
- if ( !pTempItem->mbShowWindow && !pTempItem->mbBreak )
- {
- long nCenterPos, nSlim;
- SetLineColor( rStyleSettings.GetSeparatorColor() );
- if ( IsHorizontal() )
- {
- nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
- nCenterPos = pItem->maRect.Center().X();
- DrawLine( Point( nCenterPos, pItem->maRect.Top() + nSlim ),
- Point( nCenterPos, pItem->maRect.Bottom() - nSlim ) );
- }
- else
- {
- nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
- nCenterPos = pItem->maRect.Center().Y();
- DrawLine( Point( pItem->maRect.Left() + nSlim, nCenterPos ),
- Point( pItem->maRect.Right() - nSlim, nCenterPos ) );
- }
- }
- }
+ ImplDrawSeparator( nPos, aButtonRect );
}
// do nothing if item is no button or will be displayed as window
@@ -3563,30 +3613,6 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPain
return;
}
- // draw button
- Size aBtnSize = pItem->maRect.GetSize();
- if( ImplGetSVData()->maNWFData.mbToolboxDropDownSeparate )
- {
- // separate button not for dropdown only where the whole button is painted
- if ( pItem->mnBits & TIB_DROPDOWN &&
- ((pItem->mnBits & TIB_DROPDOWNONLY) != TIB_DROPDOWNONLY) )
- {
- Rectangle aArrowRect = pItem->GetDropDownRect( mbHorz );
- if( aArrowRect.Top() == pItem->maRect.Top() ) // dropdown arrow on right side
- aBtnSize.Width() -= aArrowRect.GetWidth();
- else // dropdown arrow on bottom side
- aBtnSize.Height() -= aArrowRect.GetHeight();
- }
- }
- Rectangle aButtonRect( pItem->maRect.TopLeft(), aBtnSize );
- long nOffX = SMALLBUTTON_OFF_NORMAL_X;
- long nOffY = SMALLBUTTON_OFF_NORMAL_Y;
- long nImageOffX=0;
- long nImageOffY=0;
- long nTextOffX=0;
- long nTextOffY=0;
- sal_uInt16 nStyle = 0;
-
if ( pItem->meState == STATE_CHECK )
{
nStyle |= BUTTON_DRAW_CHECKED;
@@ -5398,8 +5424,8 @@ sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis )
while ( it != ((ToolBox*)pThis)->mpData->m_aItems.end() )
{
if( it->meType == TOOLBOXITEM_BREAK )
- nLines++;
- it++;
+ ++nLines;
+ ++it;
}
return nLines;
}
@@ -5410,7 +5436,7 @@ Size ToolBox::CalcPopupWindowSizePixel() const
sal_uInt16 nLines = ImplCountLineBreaks( this );
if( nLines )
- nLines++; // add the first line
+ ++nLines; // add the first line
else
{
// no breaks found: use quadratic layout
@@ -5430,7 +5456,7 @@ Size ToolBox::CalcPopupWindowSizePixel() const
Size ToolBox::CalcFloatingWindowSizePixel() const
{
sal_uInt16 nLines = ImplCountLineBreaks( this );
- nLines++; // add the first line
+ ++nLines; // add the first line
return CalcFloatingWindowSizePixel( nLines );
}
@@ -5471,7 +5497,7 @@ Size ToolBox::CalcMinimumWindowSizePixel() const
pToolBox->CopyItem( *this, it->mnId );
if( (it->meType != TOOLBOXITEM_BUTTON) ||
!it->mbVisible || ImplIsFixedControl( &(*it) ) )
- it++;
+ ++it;
else
break;
}
@@ -5506,9 +5532,9 @@ void ToolBox::EnableCustomize( sal_Bool bEnable )
ImplTBDragMgr* pMgr = ImplGetTBDragMgr();
if ( bEnable )
- pMgr->Insert( this );
+ pMgr->push_back( this );
else
- pMgr->Remove( this );
+ pMgr->erase( this );
}
}
@@ -5914,7 +5940,7 @@ sal_uInt16 ToolBox::ImplGetItemLine( ImplToolItem* pCurrentItem )
while( it != mpData->m_aItems.end() )
{
if ( it->mbBreak )
- nLine++;
+ ++nLine;
if( &(*it) == pCurrentItem)
break;
++it;
@@ -5994,7 +6020,7 @@ sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vecto
if( pItem )
{
sal_uInt16 nPos;
- for( nPos = 0; nPos < rList.size(); nPos++ )
+ for( nPos = 0; nPos < rList.size(); ++nPos )
if( &rList[ nPos ] == pItem )
return nPos;
}
@@ -6333,3 +6359,5 @@ void ToolBox::ImplDisableFlatButtons()
mnOutStyle &= ~TOOLBOX_STYLE_FLAT;
#endif
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index fd6fb5dffb6b..08ffb453b06a 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <tools/list.hxx>
#include <tools/debug.hxx>
#include <tools/rc.h>
@@ -50,7 +50,8 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
using namespace vcl;
-using namespace rtl;
+
+using ::rtl::OUString;
// =======================================================================
@@ -504,12 +505,6 @@ void ToolBox::Deactivate()
mnActivateCount--;
ImplCallEventListeners( VCLEVENT_TOOLBOX_DEACTIVATE );
maDeactivateHdl.Call( this );
-
- if ( mbHideStatusText )
- {
- GetpApp()->HideHelpStatusText();
- mbHideStatusText = sal_False;
- }
}
// -----------------------------------------------------------------------
@@ -518,13 +513,6 @@ void ToolBox::Highlight()
{
ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHT );
maHighlightHdl.Call( this );
-
- XubString aStr = GetHelpText( mnCurItemId );
- if ( aStr.Len() || mbHideStatusText )
- {
- GetpApp()->ShowHelpStatusText( aStr );
- mbHideStatusText = sal_True;
- }
}
// -----------------------------------------------------------------------
@@ -2182,7 +2170,7 @@ sal_Bool ToolBox::ImplHasClippedItems()
{
if( it->IsClipped() )
return sal_True;
- it++;
+ ++it;
}
return sal_False;
}
@@ -2375,12 +2363,12 @@ sal_Bool ToolBox::AlwaysLocked()
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
vcl::unohelper::GetMultiServiceFactory(),
- OUString::createFromAscii( "/org.openoffice.Office.UI.GlobalSettings/Toolbars" ) ); // note: case sensisitive !
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars")) ); // note: case sensisitive !
if ( aNode.isValid() )
{
// feature enabled ?
sal_Bool bStatesEnabled = sal_Bool();
- ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "StatesEnabled" ) );
+ ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("StatesEnabled")) );
if( aValue >>= bStatesEnabled )
{
if( bStatesEnabled == sal_True )
@@ -2388,10 +2376,10 @@ sal_Bool ToolBox::AlwaysLocked()
// now read the locking state
utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
vcl::unohelper::GetMultiServiceFactory(),
- OUString::createFromAscii( "/org.openoffice.Office.UI.GlobalSettings/Toolbars/States" ) ); // note: case sensisitive !
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States")) ); // note: case sensisitive !
sal_Bool bLocked = sal_Bool();
- ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString::createFromAscii( "Locked" ) );
+ ::com::sun::star::uno::Any aValue2 = aNode2.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Locked")) );
if( aValue2 >>= bLocked )
nAlwaysLocked = (bLocked == sal_True) ? 1 : 0;
}
@@ -2416,11 +2404,9 @@ void ToolBox::ImplUpdateImageList()
{
if (mpData->mpImageListProvider != NULL)
{
- sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
try
{
- ImageListType eType = bHC ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO;
-
+ ImageListType eType = vcl::HIGHCONTRAST_NO;
if (eType != mpData->meImageListType)
{
vcl::IImageListProvider* pImageListProvider = mpData->mpImageListProvider;
@@ -2438,3 +2424,5 @@ void ToolBox::SetImageListProvider(vcl::IImageListProvider* _pProvider)
ImplUpdateImageList();
}
// -----------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index ac7101f079c0..832515e4c5ad 100755
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -95,10 +96,11 @@
#include "com/sun/star/accessibility/XAccessible.hpp"
#include "com/sun/star/accessibility/AccessibleRole.hpp"
+#include <sal/macros.h>
+
#include <set>
#include <typeinfo>
-using namespace rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::datatransfer::clipboard;
@@ -106,6 +108,8 @@ using namespace ::com::sun::star::datatransfer::dnd;
using namespace ::com::sun::star;
using namespace com::sun;
+using ::rtl::OUString;
+
using ::com::sun::star::awt::XTopWindow;
// =======================================================================
@@ -305,8 +309,6 @@ bool Window::ImplCheckUIFont( const Font& rFont )
void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl )
{
- // reset high contrast to false, so the system can either update it
- // or AutoDetectSystemHC can kick in (see below)
StyleSettings aTmpSt( rSettings.GetStyleSettings() );
aTmpSt.SetHighContrastMode( sal_False );
rSettings.SetStyleSettings( aTmpSt );
@@ -414,8 +416,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
};
static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet(
eBrokenSystemFontSizeLanguages,
- eBrokenSystemFontSizeLanguages +
- (sizeof(eBrokenSystemFontSizeLanguages)/sizeof(eBrokenSystemFontSizeLanguages[0]))
+ eBrokenSystemFontSizeLanguages + SAL_N_ELEMENTS(eBrokenSystemFontSizeLanguages)
);
LanguageType aLang = Application::GetSettings().GetUILanguage();
if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() )
@@ -493,7 +494,6 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
rSettings.SetStyleSettings( aStyleSettings );
-
// auto detect HC mode; if the system already set it to "yes"
// (see above) then accept that
if( !rSettings.GetStyleSettings().GetHighContrastMode() )
@@ -501,10 +501,10 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
sal_Bool bTmp = sal_False, bAutoHCMode = sal_True;
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
vcl::unohelper::GetMultiServiceFactory(),
- OUString::createFromAscii( "org.openoffice.Office.Common/Accessibility" ) ); // note: case sensisitive !
+ OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Accessibility")) ); // note: case sensisitive !
if ( aNode.isValid() )
{
- ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString::createFromAscii( "AutoDetectSystemHC" ) );
+ ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString(RTL_CONSTASCII_USTRINGPARAM("AutoDetectSystemHC")) );
if( aValue >>= bTmp )
bAutoHCMode = bTmp;
}
@@ -515,6 +515,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
{
aStyleSettings = rSettings.GetStyleSettings();
aStyleSettings.SetHighContrastMode( sal_True );
+ aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST );
rSettings.SetStyleSettings( aStyleSettings );
}
}
@@ -524,6 +525,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
if( pEnvHC && *pEnvHC )
{
aStyleSettings.SetHighContrastMode( sal_True );
+ aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST );
rSettings.SetStyleSettings( aStyleSettings );
}
@@ -654,10 +656,10 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mbDockWin = sal_False; // sal_True: DockingWindow is the base class
mpWindowImpl->mbFloatWin = sal_False; // sal_True: FloatingWindow is the base class
mpWindowImpl->mbPushButton = sal_False; // sal_True: PushButton is the base class
- mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class
+ mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class
mpWindowImpl->mbMenuFloatingWindow= sal_False; // sal_True: MenuFloatingWindow is the base class
mpWindowImpl->mbToolbarFloatingWindow= sal_False; // sal_True: ImplPopupFloatWin is the base class, used for subtoolbars
- mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class
+ mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class
mpWindowImpl->mbVisible = sal_False; // sal_True: Show( sal_True ) called
mpWindowImpl->mbOverlapVisible = sal_False; // sal_True: Hide called for visible window from ImplHideAllOverlapWindow()
mpWindowImpl->mbDisabled = sal_False; // sal_True: Enable( sal_False ) called
@@ -1306,7 +1308,10 @@ void Window::ImplLoadRes( const ResId& rResId )
if ( nObjMask & WINDOW_QUICKTEXT )
SetQuickHelpText( ReadStringRes() );
if ( nObjMask & WINDOW_EXTRALONG )
- SetData( (void*)ReadLongRes() );
+ {
+ sal_uIntPtr nRes = ReadLongRes();
+ SetData( (void*)nRes );
+ }
if ( nObjMask & WINDOW_UNIQUEID )
SetUniqueId( ReadByteStringRes() );
@@ -1563,7 +1568,6 @@ void Window::ImplResetReallyVisible()
// the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
// For this, the data member of the event must not be NULL.
// Previously, we did this in Window::Show, but there some events got lost in certain situations.
- // #104887# - 2004-08-10 - fs@openoffice.org
if( bBecameReallyInvisible && ImplIsAccessibleCandidate() )
ImplCallEventListeners( VCLEVENT_WINDOW_HIDE, this );
// TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_HIDE. Normally, we should
@@ -1606,7 +1610,6 @@ void Window::ImplSetReallyVisible()
// For this, the data member of the event must not be NULL.
// Previously, we did this in Window::Show, but there some events got lost in certain situations. Now
// we're doing it when the visibility really changes
- // #104887# - 2004-08-10 - fs@openoffice.org
if( bBecameReallyVisible && ImplIsAccessibleCandidate() )
ImplCallEventListeners( VCLEVENT_WINDOW_SHOW, this );
// TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_SHOW. Normally, we should
@@ -1775,7 +1778,7 @@ sal_Bool Window::ImplSysObjClip( const Region* pOldRegion )
if ( mpWindowImpl->mpSysObj )
{
- sal_Bool bVisibleState = mpWindowImpl->mbReallyVisible;
+ bool bVisibleState = mpWindowImpl->mbReallyVisible;
if ( bVisibleState )
{
@@ -3122,7 +3125,7 @@ void Window::ImplUpdateWindowPtr()
void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame )
{
sal_Bool bVisible = IsVisible();
- Show( sal_False );
+ Show( false );
ImplRemoveWindow( bNewFrame );
Window* pRealParent = mpWindowImpl->mpRealParent;
ImplInsertWindow( ImplGetParent() );
@@ -3143,7 +3146,7 @@ void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame )
}
if ( bVisible )
- Show( sal_True );
+ Show( true );
}
// -----------------------------------------------------------------------
@@ -3200,7 +3203,6 @@ void Window::ImplPosSizeWindow( long nX, long nY,
{
sal_Bool bNewPos = sal_False;
sal_Bool bNewSize = sal_False;
- sal_Bool bNewWidth = sal_False;
sal_Bool bCopyBits = sal_False;
long nOldOutOffX = mnOutOffX;
long nOldOutOffY = mnOutOffY;
@@ -3243,7 +3245,6 @@ void Window::ImplPosSizeWindow( long nX, long nY,
mnOutWidth = nWidth;
bNewSize = sal_True;
bCopyBits = sal_False;
- bNewWidth = sal_True;
}
}
if ( nFlags & WINDOW_POSSIZE_HEIGHT )
@@ -3770,7 +3771,7 @@ void Window::ImplShowAllOverlaps()
{
if ( pOverlapWindow->mpWindowImpl->mbOverlapVisible )
{
- pOverlapWindow->Show( sal_True, SHOW_NOACTIVATE );
+ pOverlapWindow->Show( true, SHOW_NOACTIVATE );
pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_False;
}
@@ -3788,7 +3789,7 @@ void Window::ImplHideAllOverlaps()
if ( pOverlapWindow->IsVisible() )
{
pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_True;
- pOverlapWindow->Show( sal_False );
+ pOverlapWindow->Show( false );
}
pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
@@ -4098,110 +4099,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags )
pNewRealWindow->Activate();
}
}
-/*
- // call Deactivate and Activate
- Window* pDeactivateParent;
- Window* pActivateParent;
- Window* pParent;
- Window* pLastParent;
- pDeactivateParent = pOldFocusWindow;
- while ( pDeactivateParent )
- {
- pParent = pDeactivateParent;
- if ( pParent->ImplIsChild( this ) )
- break;
-
- if ( pDeactivateParent->ImplIsOverlapWindow() )
- {
- if ( !pDeactivateParent->mpWindowImpl->mbParentActive )
- break;
- }
-
- pDeactivateParent = pDeactivateParent->ImplGetParent();
- }
- if ( pOldFocusWindow )
- {
- pActivateParent = this;
- while ( pActivateParent )
- {
- pParent = pActivateParent;
- if ( pParent->ImplIsChild( pOldFocusWindow ) )
- break;
-
- if ( pActivateParent->ImplIsOverlapWindow() )
- {
- if ( !pActivateParent->mpWindowImpl->mbParentActive )
- break;
- }
-
- pActivateParent = pActivateParent->ImplGetParent();
- }
- }
- else
- {
- if ( ImplIsOverlapWindow() )
- pActivateParent = this;
- else
- pActivateParent = mpWindowImpl->mpOverlapWindow;
- while ( pActivateParent )
- {
- if ( pActivateParent->ImplIsOverlapWindow() )
- {
- if ( !pActivateParent->mpWindowImpl->mbParentActive )
- break;
- }
-
- pActivateParent = pActivateParent->ImplGetParent();
- }
- }
- if ( pDeactivateParent )
- {
- do
- {
- pLastParent = pOldFocusWindow;
- if ( pLastParent != pDeactivateParent )
- {
- pParent = pLastParent->ImplGetParent();
- while ( pParent )
- {
- if ( pParent == pDeactivateParent )
- break;
- pLastParent = pParent;
- pParent = pParent->ImplGetParent();
- }
- }
- else
- pParent = pLastParent;
- pParent->mpWindowImpl->mbActive = sal_False;
- pParent->Deactivate();
- pDeactivateParent = pLastParent;
- }
- while ( pDeactivateParent != pOldFocusWindow );
- }
- do
- {
- pLastParent = this;
- if ( pLastParent != pActivateParent )
- {
- pParent = pLastParent->ImplGetParent();
- while ( pParent )
- {
- if ( pParent == pActivateParent )
- break;
- pLastParent = pParent;
- pParent = pParent->ImplGetParent();
- }
- }
- else
- pParent = pLastParent;
-
- pParent->mpWindowImpl->mbActive = sal_True;
- pParent->Activate();
- pActivateParent = pLastParent;
- }
- while ( pActivateParent != this );
-*/
// call Get- and LoseFocus
if ( pOldFocusWindow && ! aOldFocusDel.IsDelete() )
{
@@ -4505,7 +4403,7 @@ Window::~Window()
aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
aTempStr += ") with living SystemWindow(s) destroyed: ";
aTempStr += aErrorStr;
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
}
@@ -4526,7 +4424,7 @@ Window::~Window()
aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
aTempStr += ") with living SystemWindow(s) destroyed: ";
aTempStr += aErrorStr;
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
}
@@ -4541,7 +4439,7 @@ Window::~Window()
lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
}
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
}
@@ -4556,7 +4454,7 @@ Window::~Window()
lcl_appendWindowInfo( aTempStr, *pTempWin );
pTempWin = pTempWin->mpWindowImpl->mpNext;
}
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
}
@@ -4574,7 +4472,7 @@ Window::~Window()
ByteString aTempStr( "Window (" );
aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
aTempStr += ") still in TaskPanelList!";
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
}
}
@@ -4600,7 +4498,7 @@ Window::~Window()
ByteString aTempStr( "Window (" );
aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
aTempStr += ") not found in TaskPanelList!";
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
}
}
@@ -4631,7 +4529,7 @@ Window::~Window()
ByteString aTempStr( "Window (" );
aTempStr += ByteString( GetText(), RTL_TEXTENCODING_UTF8 );
aTempStr += ") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !";
- DBG_ERROR( aTempStr.GetBuffer() );
+ OSL_FAIL( aTempStr.GetBuffer() );
GetpApp()->Abort( String( aTempStr, RTL_TEXTENCODING_UTF8 ) ); // abort in non-pro version, this must be fixed!
#endif
}
@@ -4796,12 +4694,22 @@ void Window::doLazyDelete()
DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this);
if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) )
{
- Show( sal_False );
+ Show( false );
SetParent( ImplGetDefaultWindow() );
}
vcl::LazyDeletor<Window>::Delete( this );
}
+sal_uInt16 Window::GetIndicatorState() const
+{
+ return mpWindowImpl->mpFrame->GetIndicatorState().mnState;
+}
+
+void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
+{
+ mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode);
+}
+
// -----------------------------------------------------------------------
void Window::InterceptChildWindowKeyDown( sal_Bool bIntercept )
{
@@ -5210,48 +5118,6 @@ long Window::PreNotify( NotifyEvent& rNEvt )
// #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )!
// see also ImplHandleMouseEvent(), ImplHandleKey()
- /*
- else if( rNEvt.GetType() == EVENT_MOUSEMOVE )
- {
- if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
- {
- if ( rNEvt.GetWindow() == this )
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() );
- else
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
- }
- }
- else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP )
- {
- if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
- {
- if ( rNEvt.GetWindow() == this )
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() );
- else
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
- }
- }
- else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
- {
- if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
- {
- if ( rNEvt.GetWindow() == this )
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() );
- else
- ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this ) );
- }
- }
- else if( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
- ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() );
- }
- else if( rNEvt.GetType() == EVENT_KEYUP )
- {
- if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
- ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() );
- }
- */
}
return bDone;
@@ -5397,8 +5263,7 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
if ( aDelData.IsDelete() )
return;
- if ( !mpWindowImpl->maEventListeners.empty() )
- mpWindowImpl->maEventListeners.Call( &aEvent );
+ mpWindowImpl->maEventListeners.Call( &aEvent );
if ( aDelData.IsDelete() )
return;
@@ -5410,8 +5275,7 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
{
pWindow->ImplAddDel( &aDelData );
- if ( !pWindow->mpWindowImpl->maChildEventListeners.empty() )
- pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
+ pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
if ( aDelData.IsDelete() )
return;
@@ -5431,28 +5295,28 @@ void Window::FireVclEvent( VclSimpleEvent* pEvent )
void Window::AddEventListener( const Link& rEventListener )
{
- mpWindowImpl->maEventListeners.push_back( rEventListener );
+ mpWindowImpl->maEventListeners.addListener( rEventListener );
}
// -----------------------------------------------------------------------
void Window::RemoveEventListener( const Link& rEventListener )
{
- mpWindowImpl->maEventListeners.remove( rEventListener );
+ mpWindowImpl->maEventListeners.removeListener( rEventListener );
}
// -----------------------------------------------------------------------
void Window::AddChildEventListener( const Link& rEventListener )
{
- mpWindowImpl->maChildEventListeners.push_back( rEventListener );
+ mpWindowImpl->maChildEventListeners.addListener( rEventListener );
}
// -----------------------------------------------------------------------
void Window::RemoveChildEventListener( const Link& rEventListener )
{
- mpWindowImpl->maChildEventListeners.remove( rEventListener );
+ mpWindowImpl->maChildEventListeners.removeListener( rEventListener );
}
// -----------------------------------------------------------------------
@@ -5985,17 +5849,6 @@ Font Window::GetPointFont() const
// -----------------------------------------------------------------------
-// TODO: remove in next incompatible build
-void Window::GetFontResolution( sal_Int32& nDPIX, sal_Int32& nDPIY ) const
-{
- DBG_CHKTHIS( Window, ImplDbgCheckWindow );
-
- nDPIX = mpWindowImpl->mpFrameData->mnDPIX;
- nDPIY = mpWindowImpl->mpFrameData->mnDPIY;
-}
-
-// -----------------------------------------------------------------------
-
void Window::SetParentClipMode( sal_uInt16 nMode )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -6105,8 +5958,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion )
}
else
{
- sal_Bool bInvalidate = sal_False;
-
if ( rRegion.GetType() == REGION_NULL )
{
if ( mpWindowImpl->mbWinRegion )
@@ -6114,7 +5965,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion )
mpWindowImpl->maWinRegion = Region( REGION_NULL );
mpWindowImpl->mbWinRegion = sal_False;
ImplSetClipFlag();
- bInvalidate = sal_True;
}
}
else
@@ -6122,7 +5972,6 @@ void Window::SetWindowRegionPixel( const Region& rRegion )
mpWindowImpl->maWinRegion = rRegion;
mpWindowImpl->mbWinRegion = sal_True;
ImplSetClipFlag();
- bInvalidate = sal_True;
}
if ( IsReallyVisible() )
@@ -6307,7 +6156,7 @@ void Window::SetParent( Window* pNewParent )
mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame );
sal_Bool bVisible = IsVisible();
- Show( sal_False, SHOW_NOFOCUSCHANGE );
+ Show( false, SHOW_NOFOCUSCHANGE );
// Testen, ob sich das Overlap-Window aendert
Window* pOldOverlapWindow;
@@ -6423,7 +6272,7 @@ void Window::SetParent( Window* pNewParent )
ImplGetOwnerDrawList().push_back( this );
if ( bVisible )
- Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
+ Show( true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
}
// -----------------------------------------------------------------------
@@ -6448,10 +6297,10 @@ void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags )
if ( mpWindowImpl->mpBorderWindow )
{
- sal_Bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate;
+ bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate;
if ( mpWindowImpl->mbNoParentUpdate )
mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = sal_True;
- mpWindowImpl->mpBorderWindow->Show( sal_False, nFlags );
+ mpWindowImpl->mpBorderWindow->Show( false, nFlags );
mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate;
}
else if ( mpWindowImpl->mbFrame )
@@ -6589,13 +6438,22 @@ void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags )
}
if ( mpWindowImpl->mpBorderWindow )
- mpWindowImpl->mpBorderWindow->Show( sal_True, nFlags );
+ mpWindowImpl->mpBorderWindow->Show( true, nFlags );
else if ( mpWindowImpl->mbFrame )
{
- ImplSVData* pSVData = ImplGetSVData();
// #106431#, hide SplashScreen
- if( pSVData->mpIntroWindow && !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( !pSVData->mpIntroWindow )
+ {
+ // The right way would be just to call this (not even in the 'if')
+ GetpApp()->InitFinished();
+ }
+ else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
+ {
+ // ... but the VCL splash is broken, and it needs this
+ // (for ./soffice slot:5500)
pSVData->mpIntroWindow->Hide();
+ }
//DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated");
mpWindowImpl->mbSuppressAccessibilityEvents = sal_False;
@@ -8561,22 +8419,22 @@ uno::Reference< XDragSource > Window::GetDragSource()
Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 );
OUString aDragSourceSN, aDropTargetSN;
#if defined WNT
- aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" );
- aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" );
+ aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource"));
+ aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget"));
aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd );
aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd );
#elif defined QUARTZ
/* FIXME: Mac OS X specific dnd interface does not exist! *
* Using Windows based dnd as a temporary solution */
- aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDragSource" );
- aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.OleDropTarget" );
+ aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDragSource"));
+ aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.OleDropTarget"));
aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
#elif defined UNX
aDropTargetAL.realloc( 3 );
aDragSourceAL.realloc( 3 );
- aDragSourceSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DragSource" );
- aDropTargetSN = OUString::createFromAscii( "com.sun.star.datatransfer.dnd.X11DropTarget" );
+ aDragSourceSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DragSource"));
+ aDropTargetSN = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.dnd.X11DropTarget"));
aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() );
aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() );
@@ -8649,10 +8507,10 @@ uno::Reference< XClipboard > Window::GetClipboard()
if( xFactory.is() )
{
- mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboardExt" ) ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboardExt")) ), UNO_QUERY );
if( !mpWindowImpl->mpFrameData->mxClipboard.is() )
- mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), UNO_QUERY );
+ mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")) ), UNO_QUERY );
#if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized
if( mpWindowImpl->mpFrameData->mxClipboard.is() )
@@ -8663,7 +8521,7 @@ uno::Reference< XClipboard > Window::GetClipboard()
{
Sequence< Any > aArgumentList( 3 );
aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() );
- aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "CLIPBOARD" ) );
+ aArgumentList[ 1 ] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("CLIPBOARD")) );
aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
xInit->initialize( aArgumentList );
@@ -8706,22 +8564,22 @@ uno::Reference< XClipboard > Window::GetPrimarySelection()
#if defined(UNX) && !defined(QUARTZ)
Sequence< Any > aArgumentList( 3 );
aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() );
- aArgumentList[ 1 ] = makeAny( OUString::createFromAscii( "PRIMARY" ) );
+ aArgumentList[ 1 ] = makeAny( OUString(RTL_CONSTASCII_USTRINGPARAM("PRIMARY")) );
aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments(
- OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ), aArgumentList ), UNO_QUERY );
-# else
+ OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.SystemClipboard")), aArgumentList ), UNO_QUERY );
+# else
static uno::Reference< XClipboard > s_xSelection;
if ( !s_xSelection.is() )
- s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboardExt" ) ), UNO_QUERY );
+ s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboardExt")) ), UNO_QUERY );
if ( !s_xSelection.is() )
- s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.GenericClipboard" ) ), UNO_QUERY );
+ s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.datatransfer.clipboard.GenericClipboard")) ), UNO_QUERY );
mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
-# endif
+# endif
}
}
@@ -9960,9 +9818,6 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /
DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" );
DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" );
-
- Point aPos = pDev->LogicToPixel( rPos );
-
Window* pRealParent = NULL;
if( ! mpWindowImpl->mbVisible )
{
@@ -10000,3 +9855,4 @@ Selection Window::GetSurroundingTextSelection() const
return Selection( 0, 0 );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 2513170a4d25..bf81d2665f48 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,7 +30,6 @@
#include "precompiled_vcl.hxx"
#include <limits.h>
-
#include <tools/debug.hxx>
#include <tools/poly.hxx>
@@ -342,14 +342,6 @@ Bitmap Window::SnapShot( sal_Bool bBorder ) const
// -----------------------------------------------------------------------
-Bitmap Window::SnapShot() const
-{
- // Should be merged in the next top level build !!!
- return SnapShot( sal_True );
-}
-
-// -----------------------------------------------------------------------
-
void Window::ShowFocus( const Rectangle& rRect )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -1306,110 +1298,6 @@ void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
}
}
-// support for docking
-// this is currently handled in ImplDockingWindowWrapper
-/*
-void Window::ImplSetFloatingMode( sal_Bool bFloatMode )
-{
- // if the window is docked, put it into a flaoting window
- // if it is floating put it back in the old frame
-
- ImplDockingWindowWrapper *pWrapper = pDockingMgr->GetDockingWindowWrapper( this );
- if( !pDockingData )
- return;
-
- if ( pWrapper->IsFloatingMode() != bFloatMode )
- {
- if ( pWrapper->PrepareToggleFloatingMode() )
- {
- sal_Bool bVisible = IsVisible();
-
- if ( bFloatMode )
- {
- Show( sal_False, SHOW_NOFOCUSCHANGE );
-
- pWrapper->maDockPos = GetPosPixel();
-
- Window* pRealParent = mpWindowImpl->mpRealParent;
- pWrapper->mpOldBorderWin = mpWindowImpl->mpBorderWindow;
-
- ImplDockFloatWin* pWin =
- new ImplDockFloatWin2(
- mpWindowImpl->mpParent,
- mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
- pWrapper );
- pWrapper->mpFloatWin = pWin;
- mpWindowImpl->mpBorderWindow = NULL;
- mpWindowImpl->mnLeftBorder = 0;
- mpWindowImpl->mnTopBorder = 0;
- mpWindowImpl->mnRightBorder = 0;
- mpWindowImpl->mnBottomBorder = 0;
- // Falls Parent zerstoert wird, muessen wir auch vom
- // BorderWindow den Parent umsetzen
- if ( pWrapper->mpOldBorderWin )
- pWrapper->mpOldBorderWin->SetParent( pWin );
- SetParent( pWin );
- pWin->SetPosPixel( Point() );
- mpWindowImpl->mpBorderWindow = pWin;
- pWin->mpWindowImpl->mpClientWindow = this;
- mpWindowImpl->mpRealParent = pRealParent;
- pWin->SetText( GetText() );
- pWin->SetOutputSizePixel( GetSizePixel() );
- pWin->SetPosPixel( pWrapper->maFloatPos );
- // DockingDaten ans FloatingWindow weiterreichen
- pWin->ShowTitleButton( TITLE_BUTTON_DOCKING, pWrapper->mbDockBtn );
- pWin->ShowTitleButton( TITLE_BUTTON_HIDE, pWrapper->mbHideBtn );
- pWin->SetPin( pWrapper->mbPined );
- if ( pWrapper->mbRollUp )
- pWin->RollUp();
- else
- pWin->RollDown();
- pWin->SetRollUpOutputSizePixel( pWrapper->maRollUpOutSize );
- pWin->SetMinOutputSizePixel( pWrapper->maMinOutSize );
-
- pWrapper->ToggleFloatingMode();
-
- if ( bVisible )
- Show();
- }
- else
- {
- Show( sal_False, SHOW_NOFOCUSCHANGE );
-
- // FloatingDaten wird im FloatingWindow speichern
- pWrapper->maFloatPos = mpFloatWin->GetPosPixel();
- pWrapper->mbDockBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_DOCKING );
- pWrapper->mbHideBtn = mpFloatWin->IsTitleButtonVisible( TITLE_BUTTON_HIDE );
- pWrapper->mbPined = mpFloatWin->IsPined();
- pWrapper->mbRollUp = mpFloatWin->IsRollUp();
- pWrapper->maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
- pWrapper->maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
-
- Window* pRealParent = mpWindowImpl->mpRealParent;
- mpWindowImpl->mpBorderWindow = NULL;
- if ( pWrapper->mpOldBorderWin )
- {
- SetParent( pWrapper->mpOldBorderWin );
- ((ImplBorderWindow*)pWrapper->mpOldBorderWin)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
- pWrapper->mpOldBorderWin->Resize();
- }
- mpWindowImpl->mpBorderWindow = pWrapper->mpOldBorderWin;
- SetParent( pRealParent );
- mpWindowImpl->mpRealParent = pRealParent;
- delete static_cast<ImplDockFloatWin*>(mpFloatWin);
- pWrapper->mpFloatWin = NULL;
- SetPosPixel( maDockPos );
-
- pWrapper->ToggleFloatingMode();
-
- if ( bVisible )
- Show();
- }
- }
- }
-}
-*/
-
DockingManager* Window::GetDockingManager()
{
return ImplGetDockingManager();
@@ -1976,3 +1864,4 @@ void Window::SetOutputSizePixel( const Size& rNewSize )
rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder ) );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx
index 65019ba2a4af..f35e85e89464 100644
--- a/vcl/source/window/window3.cxx
+++ b/vcl/source/window/window3.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -80,3 +81,5 @@ void Window::ImplAdjustNWFSizes()
break;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 6522856bb05d..81acb8ebd4b7 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -2611,10 +2612,12 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/,
break;
#ifdef DBG_UTIL
default:
- DBG_ERROR1( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent );
+ OSL_TRACE( "ImplWindowFrameProc(): unknown event (%lu)", (sal_uLong)nEvent );
break;
#endif
}
return nRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 0e667de73067..24ca3c9120d5 100755
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -36,6 +37,8 @@
// declare system types in sysdata.hxx
#include <svsys.h>
#include <vcl/sysdata.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
#include <svdata.hxx>
#include <salframe.hxx>
@@ -190,6 +193,18 @@ void WorkWindow::ShowFullScreenMode( sal_Bool bFullScreenMode, sal_Int32 nDispla
mbFullScreenMode = bFullScreenMode != 0;
if ( !mbSysChild )
{
+ // Dispose of the canvas implementation, which might rely on
+ // screen-specific system data.
+ com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+ if( xCanvas.is() )
+ {
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent >
+ xCanvasComponent( xCanvas,
+ com::sun::star::uno::UNO_QUERY );
+ if( xCanvasComponent.is() )
+ xCanvasComponent->dispose();
+ }
+
mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = sal_True;
ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplay );
}
@@ -319,3 +334,5 @@ sal_Bool WorkWindow::IsMaximized() const
}
return bRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */