summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-12-09 10:13:55 +0100
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-12-09 10:13:55 +0100
commit9103c81b03961788743d6248099f6a7f35f735d9 (patch)
tree693b2ab70bacc925b9dbf01a2ed0db5e0911d7f8 /vcl
parent38440ad6b24f618923a48d722a861f78c1715be5 (diff)
parenta5509a421f2f3d43aad1ba5d32e6c7bf1c015b3b (diff)
mib19: rebase to DEV300m95
Diffstat (limited to 'vcl')
-rwxr-xr-xvcl/aqua/inc/salframeview.h1
-rw-r--r--vcl/aqua/inc/salgdi.h8
-rw-r--r--vcl/aqua/inc/salinst.h3
-rw-r--r--vcl/aqua/inc/salsys.h5
-rw-r--r--vcl/aqua/source/app/salinst.cxx35
-rw-r--r--vcl/aqua/source/app/salsys.cxx101
-rwxr-xr-xvcl/aqua/source/app/vclnsapp.mm6
-rw-r--r--vcl/aqua/source/dtrans/DataFlavorMapping.cxx10
-rw-r--r--vcl/aqua/source/dtrans/DragSource.cxx14
-rw-r--r--vcl/aqua/source/dtrans/DragSource.hxx2
-rw-r--r--vcl/aqua/source/dtrans/aqua_service.cxx22
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm678
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx26
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx2
-rw-r--r--vcl/aqua/source/window/salframe.cxx124
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm26
-rw-r--r--vcl/aqua/source/window/salmenu.cxx7
-rw-r--r--vcl/inc/cupsmgr.hxx4
-rw-r--r--vcl/inc/vcl/arrange.hxx77
-rw-r--r--vcl/inc/vcl/btndlg.hxx4
-rw-r--r--vcl/inc/vcl/button.hxx2
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/edit.hxx4
-rw-r--r--vcl/inc/vcl/glyphcache.hxx3
-rw-r--r--vcl/inc/vcl/graphite_adaptors.hxx4
-rw-r--r--vcl/inc/vcl/graphite_features.hxx4
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx4
-rw-r--r--vcl/inc/vcl/help.hxx11
-rw-r--r--vcl/inc/vcl/ilstbox.hxx16
-rw-r--r--vcl/inc/vcl/impfont.hxx8
-rw-r--r--vcl/inc/vcl/javachild.hxx2
-rw-r--r--vcl/inc/vcl/jobdata.hxx4
-rw-r--r--vcl/inc/vcl/menu.hxx4
-rw-r--r--vcl/inc/vcl/metric.hxx4
-rw-r--r--vcl/inc/vcl/mnemonicengine.hxx6
-rw-r--r--vcl/inc/vcl/outdev.hxx5
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx108
-rw-r--r--vcl/inc/vcl/print.hxx19
-rw-r--r--vcl/inc/vcl/printerinfomanager.hxx6
-rw-r--r--vcl/inc/vcl/prndlg.hxx12
-rw-r--r--vcl/inc/vcl/prntypes.hxx1
-rw-r--r--vcl/inc/vcl/quickselectionengine.hxx95
-rw-r--r--vcl/inc/vcl/saldatabasic.hxx10
-rw-r--r--vcl/inc/vcl/salgdi.hxx4
-rw-r--r--vcl/inc/vcl/salinst.hxx11
-rwxr-xr-xvcl/inc/vcl/smartid.hxx87
-rw-r--r--vcl/inc/vcl/splitwin.hxx12
-rw-r--r--vcl/inc/vcl/status.hxx10
-rw-r--r--vcl/inc/vcl/svdata.hxx42
-rw-r--r--vcl/inc/vcl/svids.hrc9
-rw-r--r--vcl/inc/vcl/syschild.hxx6
-rw-r--r--vcl/inc/vcl/tabctrl.hxx11
-rw-r--r--vcl/inc/vcl/toolbox.h2
-rw-r--r--vcl/inc/vcl/toolbox.hxx10
-rw-r--r--vcl/inc/vcl/window.h14
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/window.hxx85
-rw-r--r--vcl/inc/vcl/wpropset.hxx66
-rw-r--r--vcl/os2/inc/salgdi.h4
-rw-r--r--vcl/os2/inc/salinst.h5
-rw-r--r--vcl/os2/source/app/salinst.cxx12
-rw-r--r--vcl/os2/source/gdi/salgdi3.cxx10
-rw-r--r--vcl/os2/source/window/makefile.mk2
-rw-r--r--vcl/os2/source/window/salmenu.cxx132
-rw-r--r--vcl/prj/build.lst7
-rw-r--r--vcl/prj/d.lst7
-rw-r--r--vcl/qa/complex/memCheck/CheckMemoryUsage.java600
-rw-r--r--vcl/qa/complex/memCheck/FileHelper.java90
-rw-r--r--vcl/qa/complex/memCheck/TestDocument.java45
-rwxr-xr-xvcl/qa/complex/memCheck/makefile.mk138
-rwxr-xr-xvcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc (renamed from vcl/qa/testdocuments/CalcDoc.sxc)bin9547 -> 9547 bytes
-rwxr-xr-xvcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi (renamed from vcl/qa/testdocuments/ImpressDoc.sxi)bin35135 -> 35135 bytes
-rwxr-xr-xvcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw (renamed from vcl/qa/testdocuments/WriterDoc.sxw)bin5754 -> 5754 bytes
-rw-r--r--vcl/qa/complex/persistent_window_states/DocumentHandle.java11
-rw-r--r--vcl/qa/complex/persistent_window_states/PersistentWindowTest.java420
-rw-r--r--vcl/qa/complex/persistent_window_states/makefile.mk62
-rw-r--r--vcl/source/app/dbggui.cxx57
-rw-r--r--vcl/source/app/help.cxx13
-rw-r--r--vcl/source/app/salvtables.cxx23
-rw-r--r--[-rwxr-xr-x]vcl/source/app/settings.cxx7
-rw-r--r--vcl/source/app/svdata.cxx130
-rw-r--r--vcl/source/components/factory.cxx66
-rw-r--r--vcl/source/components/makefile.mk7
-rw-r--r--vcl/source/components/stringmirror.cxx123
-rw-r--r--vcl/source/control/button.cxx36
-rwxr-xr-x[-rw-r--r--]vcl/source/control/edit.cxx37
-rw-r--r--vcl/source/control/field.cxx89
-rw-r--r--vcl/source/control/fixed.cxx39
-rw-r--r--vcl/source/control/ilstbox.cxx161
-rw-r--r--vcl/source/control/makefile.mk3
-rw-r--r--vcl/source/control/quickselectionengine.cxx183
-rw-r--r--vcl/source/control/tabctrl.cxx47
-rw-r--r--vcl/source/gdi/bitmap3.cxx8
-rw-r--r--vcl/source/gdi/impimage.cxx4
-rw-r--r--vcl/source/gdi/impprn.cxx584
-rwxr-xr-xvcl/source/gdi/makefile.mk1
-rw-r--r--vcl/source/gdi/metric.cxx72
-rw-r--r--vcl/source/gdi/outdev3.cxx295
-rw-r--r--vcl/source/gdi/pdfwriter.cxx29
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx612
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx182
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx1540
-rw-r--r--vcl/source/gdi/print2.cxx30
-rwxr-xr-xvcl/source/gdi/print3.cxx59
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx60
-rw-r--r--vcl/source/glyphs/gcach_ftyp.hxx7
-rw-r--r--vcl/source/glyphs/glyphcache.cxx18
-rw-r--r--vcl/source/glyphs/graphite_cache.cxx4
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx19
-rw-r--r--vcl/source/glyphs/graphite_textsrc.hxx4
-rw-r--r--vcl/source/helper/makefile.mk1
-rwxr-xr-xvcl/source/helper/smartid.cxx264
-rw-r--r--vcl/source/helper/strhelper.cxx8
-rw-r--r--vcl/source/src/print.src37
-rw-r--r--vcl/source/src/stdtext.src5
-rw-r--r--vcl/source/window/arrange.cxx303
-rw-r--r--vcl/source/window/btndlg.cxx11
-rw-r--r--vcl/source/window/javachild.cxx154
-rw-r--r--vcl/source/window/makefile.mk2
-rw-r--r--vcl/source/window/menu.cxx94
-rw-r--r--vcl/source/window/msgbox.cxx7
-rw-r--r--vcl/source/window/printdlg.cxx309
-rw-r--r--vcl/source/window/splitwin.cxx73
-rw-r--r--vcl/source/window/status.cxx40
-rw-r--r--vcl/source/window/syschild.cxx164
-rw-r--r--vcl/source/window/taskpanelist.cxx2
-rw-r--r--vcl/source/window/toolbox.cxx16
-rw-r--r--vcl/source/window/toolbox2.cxx29
-rwxr-xr-x[-rw-r--r--]vcl/source/window/window.cxx108
-rw-r--r--vcl/source/window/window2.cxx104
-rw-r--r--vcl/source/window/window4.cxx224
-rw-r--r--vcl/source/window/wpropset.cxx346
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx5
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx39
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx27
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx74
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx14
-rw-r--r--vcl/unx/headless/svpgdi.hxx4
-rw-r--r--vcl/unx/headless/svpinst.cxx39
-rw-r--r--vcl/unx/headless/svpinst.hxx13
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx11
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx4
-rw-r--r--vcl/unx/headless/svptext.cxx17
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkdata.hxx4
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx4
-rw-r--r--vcl/unx/inc/pspgraphics.h4
-rw-r--r--vcl/unx/inc/saldata.hxx2
-rw-r--r--vcl/unx/inc/saldisp.hxx3
-rw-r--r--vcl/unx/inc/salframe.h4
-rw-r--r--vcl/unx/inc/salgdi.h4
-rw-r--r--vcl/unx/inc/salinst.h11
-rw-r--r--vcl/unx/inc/salprn.h6
-rw-r--r--vcl/unx/inc/wmadaptor.hxx6
-rw-r--r--vcl/unx/source/app/i18n_im.cxx30
-rw-r--r--vcl/unx/source/app/saldata.cxx6
-rw-r--r--vcl/unx/source/app/saldisp.cxx7
-rw-r--r--vcl/unx/source/app/salinst.cxx26
-rw-r--r--vcl/unx/source/app/salsys.cxx2
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx58
-rw-r--r--vcl/unx/source/fontmanager/fontcache.cxx4
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx74
-rw-r--r--vcl/unx/source/gdi/pspgraphics.cxx11
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx17
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx26
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx320
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx5
-rw-r--r--vcl/unx/source/printer/cupsmgr.cxx42
-rw-r--r--vcl/unx/source/printer/jobdata.cxx41
-rw-r--r--vcl/unx/source/printer/ppdparser.cxx62
-rw-r--r--vcl/unx/source/printer/printerinfomanager.cxx52
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx9
-rw-r--r--vcl/unx/source/window/makefile.mk2
-rw-r--r--vcl/unx/source/window/salframe.cxx126
-rw-r--r--vcl/unx/source/window/salmenu.cxx132
-rw-r--r--vcl/util/makefile.mk18
-rw-r--r--vcl/util/makefile2.pmk2
-rw-r--r--vcl/util/vcl.component49
-rw-r--r--vcl/util/vcl.macosx.component49
-rw-r--r--vcl/util/vcl.windows.component40
-rwxr-xr-xvcl/win/inc/salgdi.h27
-rw-r--r--vcl/win/inc/salinst.h4
-rw-r--r--vcl/win/source/app/salinst.cxx12
-rw-r--r--vcl/win/source/gdi/salbmp.cxx4
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx40
-rw-r--r--[-rwxr-xr-x]vcl/win/source/gdi/winlayout.cxx27
-rwxr-xr-x[-rw-r--r--]vcl/win/source/window/salframe.cxx57
-rw-r--r--vcl/win/source/window/salmenu.cxx2
-rw-r--r--vcl/workben/makefile.mk24
-rw-r--r--vcl/workben/svdem.cxx2
-rw-r--r--vcl/workben/svptest.cxx2
-rw-r--r--vcl/workben/vcldemo.cxx2
189 files changed, 7781 insertions, 4178 deletions
diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h
index d812523c472d..e7d9a14b52aa 100755
--- a/vcl/aqua/inc/salframeview.h
+++ b/vcl/aqua/inc/salframeview.h
@@ -37,6 +37,7 @@
}
-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
-(MacOSBOOL)canBecomeKeyWindow;
+-(void)displayIfNeeded;
-(void)windowDidBecomeKey: (NSNotification*)pNotification;
-(void)windowDidResignKey: (NSNotification*)pNotification;
-(void)windowDidChangeScreen: (NSNotification*)pNotification;
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index 8867d1d26078..17c4aa7acd44 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -59,7 +59,7 @@ public:
virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const;
virtual sal_IntPtr GetFontId() const;
- ImplFontCharMap* GetImplFontCharMap() const;
+ const ImplFontCharMap* GetImplFontCharMap() const;
bool HasChar( sal_uInt32 cChar ) const;
void ReadOs2Table() const;
@@ -68,7 +68,7 @@ public:
private:
const ATSUFontID mnFontId;
- mutable ImplFontCharMap* mpCharMap;
+ mutable const ImplFontCharMap* mpCharMap;
mutable bool mbOs2Read; // true if OS2-table related info is valid
mutable bool mbHasOs2Table;
mutable bool mbCmapEncodingRead; // true if cmap encoding of Mac font is read
@@ -276,12 +276,12 @@ public:
// set the font
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
// get the current font's etrics
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
// get kernign pairs of the current font
// return only PairCount if (pKernPairs == NULL)
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
// get the repertoire of the current font
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
// graphics must fill supplied font list
virtual void GetDevFontList( ImplDevFontList* );
// graphics should call ImplAddDevFontSubstitute on supplied
diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h
index 0bceb99d1d0e..4b0385844eed 100644
--- a/vcl/aqua/inc/salinst.h
+++ b/vcl/aqua/inc/salinst.h
@@ -134,9 +134,10 @@ public:
virtual vos::IMutex* GetYieldMutex();
virtual ULONG ReleaseYieldMutex();
virtual void AcquireYieldMutex( ULONG nCount );
+ virtual bool CheckYieldMutex();
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual bool AnyInput( USHORT nType );
- virtual SalMenu* CreateMenu( BOOL bMenuBar );
+ virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pVCLMenu );
virtual void DestroyMenu( SalMenu* );
virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
virtual void DestroyMenuItem( SalMenuItem* );
diff --git a/vcl/aqua/inc/salsys.h b/vcl/aqua/inc/salsys.h
index 6f5c45880e68..ae20706a1756 100644
--- a/vcl/aqua/inc/salsys.h
+++ b/vcl/aqua/inc/salsys.h
@@ -55,11 +55,6 @@ public:
virtual Rectangle GetDisplayWorkAreaPosSizePixel( unsigned int nScreen );
virtual rtl::OUString GetScreenName( unsigned int nScreen );
- // overload pure virtual methods
- virtual int ShowNativeDialog( const String& rTitle,
- const String& rMessage,
- const std::list< String >& rButtons,
- int nDefButton );
virtual int ShowNativeMessageBox( const String& rTitle,
const String& rMessage,
int nButtonCombination,
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index b8a2261ed9db..5d2fc3f00741 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -371,13 +371,13 @@ SalYieldMutex::SalYieldMutex()
void SalYieldMutex::acquire()
{
OMutex::acquire();
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
}
void SalYieldMutex::release()
{
- if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ if ( mnThreadId == vos::OThread::getCurrentIdentifier() )
{
if ( mnCount == 1 )
mnThreadId = 0;
@@ -390,7 +390,7 @@ sal_Bool SalYieldMutex::tryToAcquire()
{
if ( OMutex::tryToAcquire() )
{
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
return sal_True;
}
@@ -449,7 +449,7 @@ SalInstance* CreateSalInstance()
ImplGetSVData()->maNWFData.mbCenteredTabs = true;
ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true;
- ImplGetSVData()->maGDIData.mbPrinterPullModel = true;
+ ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10;
ImplGetSVData()->maGDIData.mbNoXORClipping = true;
ImplGetSVData()->maWinData.mbNoSaveBackground = true;
@@ -536,7 +536,7 @@ ULONG AquaSalInstance::ReleaseYieldMutex()
{
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
if ( pYieldMutex->GetThreadId() ==
- NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ vos::OThread::getCurrentIdentifier() )
{
ULONG nCount = pYieldMutex->GetAcquireCount();
ULONG n = nCount;
@@ -566,6 +566,22 @@ void AquaSalInstance::AcquireYieldMutex( ULONG nCount )
// -----------------------------------------------------------------------
+bool AquaSalInstance::CheckYieldMutex()
+{
+ bool bRet = true;
+
+ SalYieldMutex* pYieldMutex = mpSalYieldMutex;
+ if ( pYieldMutex->GetThreadId() !=
+ vos::OThread::getCurrentIdentifier() )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
bool AquaSalInstance::isNSAppThread() const
{
return vos::OThread::getCurrentIdentifier() == maMainThread;
@@ -975,6 +991,9 @@ void AquaSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
XubString AquaSalInstance::GetDefaultPrinter()
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( ! maDefaultPrinter.getLength() )
{
NSPrintInfo* pPI = [NSPrintInfo sharedPrintInfo];
@@ -999,6 +1018,9 @@ XubString AquaSalInstance::GetDefaultPrinter()
SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pSetupData )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
SalInfoPrinter* pNewInfoPrinter = NULL;
if( pQueueInfo )
{
@@ -1014,6 +1036,9 @@ SalInfoPrinter* AquaSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueI
void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
delete pPrinter;
}
diff --git a/vcl/aqua/source/app/salsys.cxx b/vcl/aqua/source/app/salsys.cxx
index 3b548099feef..cf5cf00b7fe4 100644
--- a/vcl/aqua/source/app/salsys.cxx
+++ b/vcl/aqua/source/app/salsys.cxx
@@ -30,9 +30,11 @@
#include "tools/rc.hxx"
#include "vcl/svids.hrc"
+#include "vcl/button.hxx"
#include "salsys.h"
#include "saldata.hxx"
+#include "salinst.h"
#include "rtl/ustrbuf.hxx"
using namespace rtl;
@@ -114,12 +116,22 @@ rtl::OUString AquaSalSystem::GetScreenName( unsigned int nScreen )
return aRet;
}
-int AquaSalSystem::ShowNativeDialog( const String& rTitle,
- const String& rMessage,
- const std::list< String >& rButtons,
- int nDefButton )
+static NSString* getStandardString( int nButtonId )
{
- return 0;
+ rtl::OUString aText( Button::GetStandardText( nButtonId ) );
+ if( ! aText.getLength() ) // this is for bad cases, we might be missing the vcl resource
+ {
+ switch( nButtonId )
+ {
+ case BUTTON_OK: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OK" ) );break;
+ case BUTTON_ABORT: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Abort" ) );break;
+ case BUTTON_CANCEL: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cancel" ) );break;
+ case BUTTON_RETRY: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Retry" ) );break;
+ case BUTTON_YES: aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Yes" ) );break;
+ case BUTTON_NO : aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No" ) );break;
+ }
+ }
+ return aText.getLength() ? CreateNSString( aText) : nil;
}
int AquaSalSystem::ShowNativeMessageBox( const String& rTitle,
@@ -127,5 +139,82 @@ int AquaSalSystem::ShowNativeMessageBox( const String& rTitle,
int nButtonCombination,
int nDefaultButton)
{
- return 0;
+ NSString* pTitle = CreateNSString( rTitle );
+ NSString* pMessage = CreateNSString( rMessage );
+
+ struct id_entry
+ {
+ int nCombination;
+ int nDefaultButton;
+ int nTextIds[3];
+ } aButtonIds[] =
+ {
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, -1, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK, { BUTTON_OK, BUTTON_CANCEL, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_OK, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT, { BUTTON_ABORT, BUTTON_IGNORE, BUTTON_RETRY } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_IGNORE, BUTTON_ABORT } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE, { BUTTON_IGNORE, BUTTON_IGNORE, BUTTON_ABORT } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, BUTTON_CANCEL } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, BUTTON_CANCEL } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_YES, BUTTON_NO } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES, { BUTTON_YES, BUTTON_NO, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO, { BUTTON_NO, BUTTON_YES, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY, { BUTTON_RETRY, BUTTON_CANCEL, -1 } },
+ { SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL, SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL, { BUTTON_CANCEL, BUTTON_RETRY, -1 } }
+ };
+
+ NSString* pDefText = nil;
+ NSString* pAltText = nil;
+ NSString* pOthText = nil;
+
+ unsigned int nC;
+ for( nC = 0; nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]); nC++ )
+ {
+ if( aButtonIds[nC].nCombination == nButtonCombination )
+ {
+ if( aButtonIds[nC].nDefaultButton == nDefaultButton )
+ {
+ if( aButtonIds[nC].nTextIds[0] != -1 )
+ pDefText = getStandardString( aButtonIds[nC].nTextIds[0] );
+ if( aButtonIds[nC].nTextIds[1] != -1 )
+ pAltText = getStandardString( aButtonIds[nC].nTextIds[1] );
+ if( aButtonIds[nC].nTextIds[2] != -1 )
+ pOthText = getStandardString( aButtonIds[nC].nTextIds[2] );
+ break;
+ }
+ }
+ }
+
+
+ int nResult = NSRunAlertPanel( pTitle, pMessage, pDefText, pAltText, pOthText );
+
+ if( pTitle )
+ [pTitle release];
+ if( pMessage )
+ [pMessage release];
+ if( pDefText )
+ [pDefText release];
+ if( pAltText )
+ [pAltText release];
+ if( pOthText )
+ [pOthText release];
+
+ int nRet = 0;
+ if( nC < sizeof(aButtonIds)/sizeof(aButtonIds[0]) && nResult >= 1 && nResult <= 3 )
+ {
+ int nPressed = aButtonIds[nC].nTextIds[nResult-1];
+ switch( nPressed )
+ {
+ case BUTTON_NO: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; break;
+ case BUTTON_YES: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; break;
+ case BUTTON_OK: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; break;
+ case BUTTON_CANCEL: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; break;
+ case BUTTON_ABORT: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; break;
+ case BUTTON_RETRY: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; break;
+ case BUTTON_IGNORE: nRet = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; break;
+ }
+ }
+
+ return nRet;
}
diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm
index 4264f8802126..06af0358c52b 100755
--- a/vcl/aqua/source/app/vclnsapp.mm
+++ b/vcl/aqua/source/app/vclnsapp.mm
@@ -360,6 +360,8 @@
-(NSApplicationTerminateReply)applicationShouldTerminate: (NSApplication *) app
{
+ YIELD_GUARD;
+
SalData* pSalData = GetSalData();
#if 1 // currently do some really bad hack
if( ! pSalData->maFrames.empty() )
@@ -424,6 +426,8 @@
-(void)systemColorsChanged: (NSNotification*) pNotification
{
+ YIELD_GUARD;
+
const SalData* pSalData = GetSalData();
if( !pSalData->maFrames.empty() )
pSalData->maFrames.front()->CallCallback( SALEVENT_SETTINGSCHANGED, NULL );
@@ -431,6 +435,8 @@
-(void)screenParametersChanged: (NSNotification*) pNotification
{
+ YIELD_GUARD;
+
SalData* pSalData = GetSalData();
std::list< AquaSalFrame* >::iterator it;
for( it = pSalData->maFrames.begin(); it != pSalData->maFrames.end(); ++it )
diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
index e0a95a532bf8..01f989cbc1c1 100644
--- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
+++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
@@ -575,11 +575,19 @@ DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor, Refe
if (isByteSequenceType(data.getValueType()))
{
+ /*
+ the HTMLFormatDataProvider prepends segment information to HTML
+ this is useful for exchange with MS Word (which brings this stuff from Windows)
+ but annoying for other applications. Since this extension is not a standard datatype
+ on the Mac, let us not provide but provide normal HTML
+
if ([systemFlavor caseInsensitiveCompare: NSHTMLPboardType] == NSOrderedSame)
{
dp = DataProviderPtr_t(new HTMLFormatDataProvider(data));
}
- else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame)
+ else
+ */
+ if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] == NSOrderedSame)
{
dp = DataProviderPtr_t(new BMPDataProvider(data, PICTImageFileType));
}
diff --git a/vcl/aqua/source/dtrans/DragSource.cxx b/vcl/aqua/source/dtrans/DragSource.cxx
index adb247d70711..1a8f950e50d4 100644
--- a/vcl/aqua/source/dtrans/DragSource.cxx
+++ b/vcl/aqua/source/dtrans/DragSource.cxx
@@ -38,6 +38,7 @@
#include "DragSourceContext.hxx"
#include "aqua_clipboard.hxx"
#include "DragActionConversion.hxx"
+#include "salframe.h"
#include <rtl/ustring.h>
#include <memory>
@@ -158,6 +159,7 @@ Sequence<OUString> dragSource_getSupportedServiceNames()
DragSource::DragSource():
WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>(m_aMutex),
mView(NULL),
+ mpFrame(NULL),
mLastMouseEventBeforeStartDrag(nil),
m_MouseButton(0)
{
@@ -166,8 +168,9 @@ DragSource::DragSource():
DragSource::~DragSource()
{
- [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper];
- [mDragSourceHelper release];
+ if( mpFrame && AquaSalFrame::isAlive( mpFrame ) )
+ [(id <MouseEventListener>)mView unregisterMouseEventListener: mDragSourceHelper];
+ [mDragSourceHelper release];
}
@@ -197,6 +200,13 @@ void SAL_CALL DragSource::initialize(const Sequence< Any >& aArguments)
throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view doesn't support mouse listener")),
static_cast<OWeakObject*>(this));
}
+ NSWindow* pWin = [mView window];
+ if( ! pWin || ![pWin respondsToSelector: @selector(getSalFrame)] )
+ {
+ throw Exception(OUString(RTL_CONSTASCII_USTRINGPARAM("DragSource::initialize: Provided view is not attached to a vcl frame")),
+ static_cast<OWeakObject*>(this));
+ }
+ mpFrame = (AquaSalFrame*)[pWin performSelector: @selector(getSalFrame)];
mDragSourceHelper = [[DragSourceHelper alloc] initWithDragSource: this];
diff --git a/vcl/aqua/source/dtrans/DragSource.hxx b/vcl/aqua/source/dtrans/DragSource.hxx
index 5d02b9874149..f8f55176a308 100644
--- a/vcl/aqua/source/dtrans/DragSource.hxx
+++ b/vcl/aqua/source/dtrans/DragSource.hxx
@@ -46,6 +46,7 @@
class DragSource;
+class AquaSalFrame;
/* The functions declared in this protocol are actually
declared in vcl/aqua/inc/salframe.h. Because we want
@@ -120,6 +121,7 @@ public:
com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDragSourceContext > mXCurrentContext;
id mView;
+ AquaSalFrame* mpFrame;
NSEvent* mLastMouseEventBeforeStartDrag;
DragSourceHelper* mDragSourceHelper;
com::sun::star::awt::MouseEvent mMouseEvent;
diff --git a/vcl/aqua/source/dtrans/aqua_service.cxx b/vcl/aqua/source/dtrans/aqua_service.cxx
index 571bea2e554f..57ef1f11175c 100644
--- a/vcl/aqua/source/dtrans/aqua_service.cxx
+++ b/vcl/aqua/source/dtrans/aqua_service.cxx
@@ -58,28 +58,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
-{
- sal_Bool bRetVal = sal_False;
-
- if ( pRegistryKey )
- {
- try
- {
- Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
- pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( AQUA_CLIPBOARD_REGKEY_NAME ) ) );
- bRetVal = sal_True;
- }
- catch( InvalidRegistryException& )
- {
- OSL_ENSURE(sal_False, "InvalidRegistryException caught");
- bRetVal = sal_False;
- }
- }
-
- return bRetVal;
-}
-
void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
{
void* pRet = 0;
diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
index d00fc9a6cd0e..d19290d8320a 100644
--- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
+++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm
@@ -112,7 +112,7 @@ class ControllerProperties
maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) )
{
mpState->bNeedRestart = false;
- DBG_ASSERT( maLocalizedStrings.Count() >= 4, "resources not found !" );
+ DBG_ASSERT( maLocalizedStrings.Count() >= 5, "resources not found !" );
}
rtl::OUString getMoreString()
@@ -122,6 +122,13 @@ class ControllerProperties
: rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "More" ) );
}
+ rtl::OUString getPrintSelectionString()
+ {
+ return maLocalizedStrings.Count() >= 5
+ ? rtl::OUString( maLocalizedStrings.GetString( 4 ) )
+ : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Print selection only" ) );
+ }
+
void updatePrintJob()
{
// TODO: refresh page count etc from mpController
@@ -246,7 +253,11 @@ class ControllerProperties
PropertyValue* pVal = mpController->getValue( name_it->second );
if( pVal )
{
- pVal->Value <<= i_bValue;
+ // ugly
+ if( name_it->second.equalsAscii( "PrintContent" ) )
+ pVal->Value <<= i_bValue ? sal_Int32(2) : sal_Int32(0);
+ else
+ pVal->Value <<= i_bValue;
updatePrintJob();
}
}
@@ -283,7 +294,7 @@ class ControllerProperties
-1;
std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag );
- if( name_it != maTagToPropertyName.end() )
+ if( name_it != maTagToPropertyName.end() && ! name_it->second.equalsAscii( "PrintContent" ) )
{
MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO;
if( pCtrl )
@@ -768,6 +779,319 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
}
}
+static void addSubgroup( NSView* pCurParent, long& rCurY, const rtl::OUString& rText )
+{
+ NSControl* pTextView = createLabel( rText );
+ [pCurParent addSubview: [pTextView autorelease]];
+ NSRect aTextRect = [pTextView frame];
+ // move to nCurY
+ aTextRect.origin.y = rCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } };
+ NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect];
+ [pBox setBoxType: NSBoxSeparator];
+ [pCurParent addSubview: [pBox autorelease]];
+
+ // update nCurY
+ rCurY = aTextRect.origin.y - 5;
+}
+
+static void addBool( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset,
+ const rtl::OUString& rText, sal_Bool bEnabled,
+ const rtl::OUString& rProperty, sal_Bool bValue,
+ std::vector<ColumnItem >& rRightColumn,
+ ControllerProperties* pControllerProperties,
+ ControlTarget* pCtrlTarget
+ )
+{
+ NSRect aCheckRect = { { rCurX + nAttachOffset, 0 }, { 0, 15 } };
+ NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect];
+ [pBtn setButtonType: NSSwitchButton];
+ [pBtn setState: bValue ? NSOnState : NSOffState];
+ if( ! bEnabled )
+ [pBtn setEnabled: NO];
+ linebreakCell( [pBtn cell], rText );
+ [pBtn sizeToFit];
+ [pCurParent addSubview: [pBtn autorelease]];
+
+ rRightColumn.push_back( ColumnItem( pBtn ) );
+
+ // connect target
+ [pBtn setTarget: pCtrlTarget];
+ [pBtn setAction: @selector(triggered:)];
+ int nTag = pControllerProperties->addNameTag( rProperty );
+ pControllerProperties->addObservedControl( pBtn );
+ [pBtn setTag: nTag];
+
+ aCheckRect = [pBtn frame];
+
+ // move to rCurY
+ aCheckRect.origin.y = rCurY - aCheckRect.size.height;
+ [pBtn setFrame: aCheckRect];
+
+ // update rCurY
+ rCurY = aCheckRect.origin.y - 5;
+}
+
+static void addRadio( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset,
+ const rtl::OUString& rText,
+ const rtl::OUString& rProperty, Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue,
+ std::vector<ColumnItem >& rLeftColumn,
+ std::vector<ColumnItem >& rRightColumn,
+ ControllerProperties* pControllerProperties,
+ ControlTarget* pCtrlTarget
+ )
+{
+ sal_Int32 nOff = 0;
+ if( rText.getLength() )
+ {
+ // add a label
+ NSControl* pTextView = createLabel( rText );
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = rCurX + nAttachOffset;
+ [pCurParent addSubview: [pTextView autorelease]];
+
+ rLeftColumn.push_back( ColumnItem( pTextView ) );
+
+ // move to nCurY
+ aTextRect.origin.y = rCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ // update nCurY
+ rCurY = aTextRect.origin.y - 5;
+
+ // indent the radio group relative to the text
+ // nOff = 20;
+ }
+
+ // setup radio matrix
+ NSButtonCell* pProto = [[NSButtonCell alloc] init];
+
+ NSRect aRadioRect = { { rCurX + nOff, 0 }, { 280 - rCurX, 5*rChoices.getLength() } };
+ [pProto setTitle: @"RadioButtonGroup"];
+ [pProto setButtonType: NSRadioButton];
+ NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect
+ mode: NSRadioModeMatrix
+ prototype: (NSCell*)pProto
+ numberOfRows: rChoices.getLength()
+ numberOfColumns: 1];
+ // set individual titles
+ NSArray* pCells = [pMatrix cells];
+ for( sal_Int32 m = 0; m < rChoices.getLength(); m++ )
+ {
+ NSCell* pCell = [pCells objectAtIndex: m];
+ filterAccelerator( rChoices[m] );
+ linebreakCell( pCell, rChoices[m] );
+ // connect target and action
+ [pCell setTarget: pCtrlTarget];
+ [pCell setAction: @selector(triggered:)];
+ int nTag = pControllerProperties->addNameAndValueTag( rProperty, m );
+ pControllerProperties->addObservedControl( pCell );
+ [pCell setTag: nTag];
+ // set current selection
+ if( nSelectValue == m )
+ [pMatrix selectCellAtRow: m column: 0];
+ }
+ [pMatrix sizeToFit];
+ aRadioRect = [pMatrix frame];
+
+ // move it down, so it comes to the correct position
+ aRadioRect.origin.y = rCurY - aRadioRect.size.height;
+ [pMatrix setFrame: aRadioRect];
+ [pCurParent addSubview: [pMatrix autorelease]];
+
+ rRightColumn.push_back( ColumnItem( pMatrix ) );
+
+ // update nCurY
+ rCurY = aRadioRect.origin.y - 5;
+
+ [pProto release];
+}
+
+static void addList( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset,
+ const rtl::OUString& rText,
+ const rtl::OUString& rProperty, const Sequence< rtl::OUString > rChoices, sal_Int32 nSelectValue,
+ std::vector<ColumnItem >& rLeftColumn,
+ std::vector<ColumnItem >& rRightColumn,
+ ControllerProperties* pControllerProperties,
+ ControlTarget* pCtrlTarget
+ )
+{
+ // don't indent attached lists, looks bad in the existing cases
+ NSControl* pTextView = createLabel( rText );
+ [pCurParent addSubview: [pTextView autorelease]];
+ rLeftColumn.push_back( ColumnItem( pTextView ) );
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = rCurX /* + nAttachOffset*/;
+
+ // don't indent attached lists, looks bad in the existing cases
+ NSRect aBtnRect = { { rCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } };
+ NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO];
+
+ // iterate options
+ for( sal_Int32 m = 0; m < rChoices.getLength(); m++ )
+ {
+ NSString* pItemText = CreateNSString( rChoices[m] );
+ [pBtn addItemWithTitle: pItemText];
+ NSMenuItem* pItem = [pBtn itemWithTitle: pItemText];
+ int nTag = pControllerProperties->addNameAndValueTag( rProperty, m );
+ [pItem setTag: nTag];
+ [pItemText release];
+ }
+
+ [pBtn selectItemAtIndex: nSelectValue];
+
+ // add the button to observed controls for enabled state changes
+ // also add a tag just for this purpose
+ pControllerProperties->addObservedControl( pBtn );
+ [pBtn setTag: pControllerProperties->addNameTag( rProperty )];
+
+ [pBtn sizeToFit];
+ [pCurParent addSubview: [pBtn autorelease]];
+
+ rRightColumn.push_back( ColumnItem( pBtn ) );
+
+ // connect target and action
+ [pBtn setTarget: pCtrlTarget];
+ [pBtn setAction: @selector(triggered:)];
+
+ // move to nCurY
+ aBtnRect = [pBtn frame];
+ aBtnRect.origin.y = rCurY - aBtnRect.size.height;
+ [pBtn setFrame: aBtnRect];
+
+ // align label
+ aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2;
+ [pTextView setFrame: aTextRect];
+
+ // update rCurY
+ rCurY = aBtnRect.origin.y - 5;
+}
+
+static void addEdit( NSView* pCurParent, long& rCurX, long& rCurY, long nAttachOffset,
+ const rtl::OUString rCtrlType,
+ const rtl::OUString& rText,
+ const rtl::OUString& rProperty, const PropertyValue* pValue,
+ sal_Int64 nMinValue, sal_Int64 nMaxValue,
+ std::vector<ColumnItem >& rLeftColumn,
+ std::vector<ColumnItem >& rRightColumn,
+ ControllerProperties* pControllerProperties,
+ ControlTarget* pCtrlTarget
+ )
+{
+ sal_Int32 nOff = 0;
+ if( rText.getLength() )
+ {
+ // add a label
+ NSControl* pTextView = createLabel( rText );
+ [pCurParent addSubview: [pTextView autorelease]];
+
+ rLeftColumn.push_back( ColumnItem( pTextView ) );
+
+ // move to nCurY
+ NSRect aTextRect = [pTextView frame];
+ aTextRect.origin.x = rCurX + nAttachOffset;
+ aTextRect.origin.y = rCurY - aTextRect.size.height;
+ [pTextView setFrame: aTextRect];
+
+ // update nCurY
+ rCurY = aTextRect.origin.y - 5;
+
+ // and set the offset for the real edit field
+ nOff = aTextRect.size.width + 5;
+ }
+
+ NSRect aFieldRect = { { rCurX + nOff + nAttachOffset, 0 }, { 100, 25 } };
+ NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect];
+ [pFieldView setEditable: YES];
+ [pFieldView setSelectable: YES];
+ [pFieldView setDrawsBackground: YES];
+ [pFieldView sizeToFit]; // FIXME: this does nothing
+ [pCurParent addSubview: [pFieldView autorelease]];
+
+ rRightColumn.push_back( ColumnItem( pFieldView ) );
+
+ // add the field to observed controls for enabled state changes
+ // also add a tag just for this purpose
+ pControllerProperties->addObservedControl( pFieldView );
+ int nTag = pControllerProperties->addNameTag( rProperty );
+ [pFieldView setTag: nTag];
+ // pControllerProperties->addNamedView( pFieldView, aPropertyName );
+
+ // move to nCurY
+ aFieldRect.origin.y = rCurY - aFieldRect.size.height;
+ [pFieldView setFrame: aFieldRect];
+
+ if( rCtrlType.equalsAscii( "Range" ) )
+ {
+ // add a stepper control
+ NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5,
+ aFieldRect.origin.y },
+ { 15, aFieldRect.size.height } };
+ NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame];
+ [pStep setIncrement: 1];
+ [pStep setValueWraps: NO];
+ [pStep setTag: nTag];
+ [pCurParent addSubview: [pStep autorelease]];
+
+ rRightColumn.back().pSubControl = pStep;
+
+ pControllerProperties->addObservedControl( pStep );
+ [pStep setTarget: pCtrlTarget];
+ [pStep setAction: @selector(triggered:)];
+
+ // constrain the text field to decimal numbers
+ NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init];
+ [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
+ [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
+ [pFormatter setAllowsFloats: NO];
+ [pFormatter setMaximumFractionDigits: 0];
+ if( nMinValue != nMaxValue )
+ {
+ [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]];
+ [pStep setMinValue: nMinValue];
+ [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]];
+ [pStep setMaxValue: nMaxValue];
+ }
+ [pFieldView setFormatter: pFormatter];
+
+ sal_Int64 nSelectVal = 0;
+ if( pValue && pValue->Value.hasValue() )
+ pValue->Value >>= nSelectVal;
+
+ [pFieldView setIntValue: nSelectVal];
+ [pStep setIntValue: nSelectVal];
+
+ pControllerProperties->addViewPair( pFieldView, pStep );
+ // connect target and action
+ [pFieldView setTarget: pCtrlTarget];
+ [pFieldView setAction: @selector(triggeredNumeric:)];
+ [pStep setTarget: pCtrlTarget];
+ [pStep setAction: @selector(triggeredNumeric:)];
+ }
+ else
+ {
+ // connect target and action
+ [pFieldView setTarget: pCtrlTarget];
+ [pFieldView setAction: @selector(triggered:)];
+
+ if( pValue && pValue->Value.hasValue() )
+ {
+ rtl::OUString aValue;
+ pValue->Value >>= aValue;
+ if( aValue.getLength() )
+ {
+ NSString* pText = CreateNSString( aValue );
+ [pFieldView setStringValue: pText];
+ [pText release];
+ }
+ }
+ }
+
+ // update nCurY
+ rCurY = aFieldRect.origin.y - 5;
+}
@implementation AquaPrintAccessoryView
+(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState;
@@ -792,6 +1116,54 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties];
std::vector< ColumnItem > aLeftColumn, aRightColumn;
+
+ // ugly:
+ // prepend a "selection" checkbox if the properties have such a selection in PrintContent
+ bool bAddSelectionCheckBox = false, bSelectionBoxEnabled = false, bSelectionBoxChecked = false;
+ for( int i = 0; i < rOptions.getLength(); i++ )
+ {
+ Sequence< beans::PropertyValue > aOptProp;
+ rOptions[i].Value >>= aOptProp;
+
+ rtl::OUString aCtrlType;
+ rtl::OUString aPropertyName;
+ Sequence< rtl::OUString > aChoices;
+ Sequence< sal_Bool > aChoicesDisabled;
+ sal_Int32 aSelectionChecked = 0;
+ for( int n = 0; n < aOptProp.getLength(); n++ )
+ {
+ const beans::PropertyValue& rEntry( aOptProp[ n ] );
+ if( rEntry.Name.equalsAscii( "ControlType" ) )
+ {
+ rEntry.Value >>= aCtrlType;
+ }
+ else if( rEntry.Name.equalsAscii( "Choices" ) )
+ {
+ rEntry.Value >>= aChoices;
+ }
+ else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) )
+ {
+ rEntry.Value >>= aChoicesDisabled;
+ }
+ else if( rEntry.Name.equalsAscii( "Property" ) )
+ {
+ PropertyValue aVal;
+ rEntry.Value >>= aVal;
+ aPropertyName = aVal.Name;
+ if( aPropertyName.equalsAscii( "PrintContent" ) )
+ aVal.Value >>= aSelectionChecked;
+ }
+ }
+ if( aCtrlType.equalsAscii( "Radio" ) &&
+ aPropertyName.equalsAscii( "PrintContent" ) &&
+ aChoices.getLength() > 2 )
+ {
+ bAddSelectionCheckBox = true;
+ bSelectionBoxEnabled = aChoicesDisabled.getLength() < 2 || ! aChoicesDisabled[2];
+ bSelectionBoxChecked = (aSelectionChecked==2);
+ break;
+ }
+ }
for( int i = 0; i < rOptions.getLength(); i++ )
{
@@ -803,6 +1175,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
rtl::OUString aCtrlType;
rtl::OUString aText;
rtl::OUString aPropertyName;
+ rtl::OUString aGroupHint;
Sequence< rtl::OUString > aChoices;
sal_Int64 nMinValue = 0, nMaxValue = 0;
long nAttachOffset = 0;
@@ -852,6 +1225,10 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
{
rEntry.Value >>= bIgnore;
}
+ else if( rEntry.Name.equalsAscii( "GroupingHint" ) )
+ {
+ rEntry.Value >>= aGroupHint;
+ }
}
if( aCtrlType.equalsAscii( "Group" ) ||
@@ -894,6 +1271,15 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
// clear columns
aLeftColumn.clear();
aRightColumn.clear();
+
+ if( bAddSelectionCheckBox )
+ {
+ addBool( pCurParent, nCurX, nCurY, 0,
+ pControllerProperties->getPrintSelectionString(), bSelectionBoxEnabled,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ), bSelectionBoxChecked,
+ aRightColumn, pControllerProperties, pCtrlTarget );
+ bAddSelectionCheckBox = false;
+ }
}
if( aCtrlType.equalsAscii( "Subgroup" ) && pCurParent )
@@ -902,302 +1288,56 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
if( bIgnore )
continue;
- NSControl* pTextView = createLabel( aText );
- [pCurParent addSubview: [pTextView autorelease]];
- NSRect aTextRect = [pTextView frame];
- // move to nCurY
- aTextRect.origin.y = nCurY - aTextRect.size.height;
- [pTextView setFrame: aTextRect];
-
- NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } };
- NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect];
- [pBox setBoxType: NSBoxSeparator];
- [pCurParent addSubview: [pBox autorelease]];
-
- // update nCurY
- nCurY = aTextRect.origin.y - 5;
+ addSubgroup( pCurParent, nCurY, aText );
}
else if( bIgnoreSubgroup || bIgnore )
+ {
continue;
+ }
else if( aCtrlType.equalsAscii( "Bool" ) && pCurParent )
{
- NSRect aCheckRect = { { nCurX + nAttachOffset, 0 }, { 0, 15 } };
- NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect];
- [pBtn setButtonType: NSSwitchButton];
sal_Bool bVal = sal_False;
PropertyValue* pVal = pController->getValue( aPropertyName );
if( pVal )
pVal->Value >>= bVal;
- [pBtn setState: bVal ? NSOnState : NSOffState];
- linebreakCell( [pBtn cell], aText );
- [pBtn sizeToFit];
- [pCurParent addSubview: [pBtn autorelease]];
-
- aRightColumn.push_back( ColumnItem( pBtn ) );
-
- // connect target
- [pBtn setTarget: pCtrlTarget];
- [pBtn setAction: @selector(triggered:)];
- int nTag = pControllerProperties->addNameTag( aPropertyName );
- pControllerProperties->addObservedControl( pBtn );
- [pBtn setTag: nTag];
-
- aCheckRect = [pBtn frame];
-
- // move to nCurY
- aCheckRect.origin.y = nCurY - aCheckRect.size.height;
- [pBtn setFrame: aCheckRect];
-
- // update nCurY
- nCurY = aCheckRect.origin.y - 5;
+ addBool( pCurParent, nCurX, nCurY, nAttachOffset,
+ aText, true, aPropertyName, bVal,
+ aRightColumn, pControllerProperties, pCtrlTarget );
}
else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent )
{
- sal_Int32 nOff = 0;
- if( aText.getLength() )
- {
- // add a label
- NSControl* pTextView = createLabel( aText );
- NSRect aTextRect = [pTextView frame];
- aTextRect.origin.x = nCurX + nAttachOffset;
- [pCurParent addSubview: [pTextView autorelease]];
-
- aLeftColumn.push_back( ColumnItem( pTextView ) );
-
- // move to nCurY
- aTextRect.origin.y = nCurY - aTextRect.size.height;
- [pTextView setFrame: aTextRect];
-
- // update nCurY
- nCurY = aTextRect.origin.y - 5;
-
- // indent the radio group relative to the text
- // nOff = 20;
- }
-
- // setup radio matrix
- NSButtonCell* pProto = [[NSButtonCell alloc] init];
-
- NSRect aRadioRect = { { nCurX + nOff, 0 }, { 280 - nCurX, 5*aChoices.getLength() } };
- [pProto setTitle: @"RadioButtonGroup"];
- [pProto setButtonType: NSRadioButton];
- NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect
- mode: NSRadioModeMatrix
- prototype: (NSCell*)pProto
- numberOfRows: aChoices.getLength()
- numberOfColumns: 1];
// get currently selected value
sal_Int32 nSelectVal = 0;
PropertyValue* pVal = pController->getValue( aPropertyName );
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= nSelectVal;
- // set individual titles
- NSArray* pCells = [pMatrix cells];
- for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
- {
- NSCell* pCell = [pCells objectAtIndex: m];
- filterAccelerator( aChoices[m] );
- linebreakCell( pCell, aChoices[m] );
- //NSString* pTitle = CreateNSString( aChoices[m] );
- //[pCell setTitle: pTitle];
- // connect target and action
- [pCell setTarget: pCtrlTarget];
- [pCell setAction: @selector(triggered:)];
- int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m );
- pControllerProperties->addObservedControl( pCell );
- [pCell setTag: nTag];
- //[pTitle release];
- // set current selection
- if( nSelectVal == m )
- [pMatrix selectCellAtRow: m column: 0];
- }
- [pMatrix sizeToFit];
- aRadioRect = [pMatrix frame];
- // move it down, so it comes to the correct position
- aRadioRect.origin.y = nCurY - aRadioRect.size.height;
- [pMatrix setFrame: aRadioRect];
- [pCurParent addSubview: [pMatrix autorelease]];
-
- aRightColumn.push_back( ColumnItem( pMatrix ) );
-
- // update nCurY
- nCurY = aRadioRect.origin.y - 5;
-
- [pProto release];
+ addRadio( pCurParent, nCurX, nCurY, nAttachOffset,
+ aText, aPropertyName, aChoices, nSelectVal,
+ aLeftColumn, aRightColumn,
+ pControllerProperties, pCtrlTarget );
}
else if( aCtrlType.equalsAscii( "List" ) && pCurParent )
{
- // don't indent attached lists, looks bad in the existing cases
- NSControl* pTextView = createLabel( aText );
- [pCurParent addSubview: [pTextView autorelease]];
- aLeftColumn.push_back( ColumnItem( pTextView ) );
- NSRect aTextRect = [pTextView frame];
- aTextRect.origin.x = nCurX /* + nAttachOffset*/;
-
- // don't indent attached lists, looks bad in the existing cases
- NSRect aBtnRect = { { nCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } };
- NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO];
-
- // iterate options
- for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
- {
- NSString* pItemText = CreateNSString( aChoices[m] );
- [pBtn addItemWithTitle: pItemText];
- NSMenuItem* pItem = [pBtn itemWithTitle: pItemText];
- int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m );
- [pItem setTag: nTag];
- [pItemText release];
- }
-
PropertyValue* pVal = pController->getValue( aPropertyName );
sal_Int32 aSelectVal = 0;
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= aSelectVal;
- [pBtn selectItemAtIndex: aSelectVal];
-
- // add the button to observed controls for enabled state changes
- // also add a tag just for this purpose
- pControllerProperties->addObservedControl( pBtn );
- [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )];
-
- [pBtn sizeToFit];
- [pCurParent addSubview: [pBtn autorelease]];
-
- aRightColumn.push_back( ColumnItem( pBtn ) );
-
- // connect target and action
- [pBtn setTarget: pCtrlTarget];
- [pBtn setAction: @selector(triggered:)];
-
- // move to nCurY
- aBtnRect = [pBtn frame];
- aBtnRect.origin.y = nCurY - aBtnRect.size.height;
- [pBtn setFrame: aBtnRect];
-
- // align label
- aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2;
- [pTextView setFrame: aTextRect];
- // update nCurY
- nCurY = aBtnRect.origin.y - 5;
+ addList( pCurParent, nCurX, nCurY, nAttachOffset,
+ aText, aPropertyName, aChoices, aSelectVal,
+ aLeftColumn, aRightColumn,
+ pControllerProperties, pCtrlTarget );
}
else if( (aCtrlType.equalsAscii( "Edit" ) || aCtrlType.equalsAscii( "Range" )) && pCurParent )
{
- sal_Int32 nOff = 0;
- if( aText.getLength() )
- {
- // add a label
- NSControl* pTextView = createLabel( aText );
- [pCurParent addSubview: [pTextView autorelease]];
-
- aLeftColumn.push_back( ColumnItem( pTextView ) );
-
- // move to nCurY
- NSRect aTextRect = [pTextView frame];
- aTextRect.origin.x = nCurX + nAttachOffset;
- aTextRect.origin.y = nCurY - aTextRect.size.height;
- [pTextView setFrame: aTextRect];
-
- // update nCurY
- nCurY = aTextRect.origin.y - 5;
-
- // and set the offset for the real edit field
- nOff = aTextRect.size.width + 5;
- }
-
- NSRect aFieldRect = { { nCurX + nOff + nAttachOffset, 0 }, { 100, 25 } };
- NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect];
- [pFieldView setEditable: YES];
- [pFieldView setSelectable: YES];
- [pFieldView setDrawsBackground: YES];
- [pFieldView sizeToFit]; // FIXME: this does nothing
- [pCurParent addSubview: [pFieldView autorelease]];
-
- aRightColumn.push_back( ColumnItem( pFieldView ) );
-
- // add the field to observed controls for enabled state changes
- // also add a tag just for this purpose
- pControllerProperties->addObservedControl( pFieldView );
- int nTag = pControllerProperties->addNameTag( aPropertyName );
- [pFieldView setTag: nTag];
- // pControllerProperties->addNamedView( pFieldView, aPropertyName );
-
- // move to nCurY
- aFieldRect.origin.y = nCurY - aFieldRect.size.height;
- [pFieldView setFrame: aFieldRect];
-
// current value
PropertyValue* pVal = pController->getValue( aPropertyName );
- if( aCtrlType.equalsAscii( "Range" ) )
- {
- // add a stepper control
- NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5,
- aFieldRect.origin.y },
- { 15, aFieldRect.size.height } };
- NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame];
- [pStep setIncrement: 1];
- [pStep setValueWraps: NO];
- [pStep setTag: nTag];
- [pCurParent addSubview: [pStep autorelease]];
-
- aRightColumn.back().pSubControl = pStep;
-
- pControllerProperties->addObservedControl( pStep );
- [pStep setTarget: pCtrlTarget];
- [pStep setAction: @selector(triggered:)];
-
- // constrain the text field to decimal numbers
- NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init];
- [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4];
- [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
- [pFormatter setAllowsFloats: NO];
- [pFormatter setMaximumFractionDigits: 0];
- if( nMinValue != nMaxValue )
- {
- [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]];
- [pStep setMinValue: nMinValue];
- [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]];
- [pStep setMaxValue: nMaxValue];
- }
- [pFieldView setFormatter: pFormatter];
-
- sal_Int64 nSelectVal = 0;
- if( pVal && pVal->Value.hasValue() )
- pVal->Value >>= nSelectVal;
-
- [pFieldView setIntValue: nSelectVal];
- [pStep setIntValue: nSelectVal];
-
- pControllerProperties->addViewPair( pFieldView, pStep );
- // connect target and action
- [pFieldView setTarget: pCtrlTarget];
- [pFieldView setAction: @selector(triggeredNumeric:)];
- [pStep setTarget: pCtrlTarget];
- [pStep setAction: @selector(triggeredNumeric:)];
- }
- else
- {
- // connect target and action
- [pFieldView setTarget: pCtrlTarget];
- [pFieldView setAction: @selector(triggered:)];
-
- if( pVal && pVal->Value.hasValue() )
- {
- rtl::OUString aValue;
- pVal->Value >>= aValue;
- if( aValue.getLength() )
- {
- NSString* pText = CreateNSString( aValue );
- [pFieldView setStringValue: pText];
- [pText release];
- }
- }
- }
-
- // update nCurY
- nCurY = aFieldRect.origin.y - 5;
-
+ addEdit( pCurParent, nCurX, nCurY, nAttachOffset,
+ aCtrlType, aText, aPropertyName, pVal,
+ nMinValue, nMaxValue,
+ aLeftColumn, aRightColumn,
+ pControllerProperties, pCtrlTarget );
}
}
else
@@ -1205,7 +1345,7 @@ static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText )
DBG_ERROR( "Unsupported UI option" );
}
}
-
+
pControllerProperties->updateEnableState();
adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn );
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index ca3fcc04769a..e1daf649f6da 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -116,17 +116,15 @@ inline FourCharCode GetTag(const char aTagName[5])
static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);}
static unsigned GetUInt( const unsigned char* p ) { return((p[0]<<24)+(p[1]<<16)+(p[2]<<8)+p[3]);}
-ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
+const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
{
+ // return the cached charmap
if( mpCharMap )
- {
- // return the cached charmap
- mpCharMap->AddReference();
return mpCharMap;
- }
// set the default charmap
mpCharMap = ImplFontCharMap::GetDefaultMap();
+ mpCharMap->AddReference();
// get the CMAP byte size
ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
@@ -149,10 +147,14 @@ ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
// parse the CMAP
CmapResult aCmapResult;
- if( !ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
- return mpCharMap;
+ if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
+ {
+ // create the matching charmap
+ mpCharMap->DeReference();
+ mpCharMap = new ImplFontCharMap( aCmapResult );
+ mpCharMap->AddReference();
+ }
- mpCharMap = new ImplFontCharMap( aCmapResult );
return mpCharMap;
}
@@ -1555,8 +1557,10 @@ void AquaSalGraphics::SetTextColor( SalColor nSalColor )
// -----------------------------------------------------------------------
-void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
{
+ (void)nFallbackLevel; // glyph-fallback on ATSU is done differently -> no fallback level
+
// get the ATSU font metrics (in point units)
// of the font that has eventually been size-limited
@@ -1990,7 +1994,7 @@ USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLeve
// -----------------------------------------------------------------------
-ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
{
if( !mpMacFontData )
return ImplFontCharMap::GetDefaultMap();
@@ -2365,6 +2369,8 @@ void AquaSalGraphics::GetGlyphWidths( const ImplFontData* pFontData, bool bVerti
if( nGlyph > 0 )
rUnicodeEnc[ nUcsChar ] = nGlyph;
}
+
+ pMap->DeReference(); // TODO: add and use RAII object instead
}
::CloseTTFont( pSftFont );
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index ff4edcbf83f9..c79add81d791 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -460,6 +460,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH
return getUseNativeDialog() ? 1 : 0;
case PRINTER_CAPABILITIES_PDF:
return 1;
+ case PRINTER_CAPABILITIES_USEPULLMODEL:
+ return 1;
default: break;
};
return 0;
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index b14354e1b4bd..4530778c5775 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -207,8 +207,6 @@ void AquaSalFrame::initWindowAndView()
UpdateFrameGeometry();
- // setContentView causes a display; in multithreaded use this can deadlock
- //YieldMutexReleaser aRel;
[mpWindow setContentView: mpView];
}
@@ -293,6 +291,9 @@ BOOL AquaSalFrame::PostEvent( void *pData )
// -----------------------------------------------------------------------
void AquaSalFrame::SetTitle(const XubString& rTitle)
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
NSString* pTitle = CreateNSString( rTitle );
[mpWindow setTitle: pTitle];
@@ -331,6 +332,9 @@ void AquaSalFrame::SetIcon( USHORT )
void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 )
{
rtl::OUString aSysPath;
@@ -356,12 +360,12 @@ void AquaSalFrame::initShow()
if( mpParent ) // center relative to parent
{
// center on parent
- long nNewX = mpParent->maGeometry.nX + (mpParent->maGeometry.nWidth - maGeometry.nWidth)/2;
+ long nNewX = mpParent->maGeometry.nX + ((long)mpParent->maGeometry.nWidth - (long)maGeometry.nWidth)/2;
if( nNewX < aScreenRect.Left() )
nNewX = aScreenRect.Left();
if( long(nNewX + maGeometry.nWidth) > aScreenRect.Right() )
nNewX = aScreenRect.Right() - maGeometry.nWidth-1;
- long nNewY = mpParent->maGeometry.nY + (mpParent->maGeometry.nHeight - maGeometry.nHeight)/2;
+ long nNewY = mpParent->maGeometry.nY + ((long)mpParent->maGeometry.nHeight - (long)maGeometry.nHeight)/2;
if( nNewY < aScreenRect.Top() )
nNewY = aScreenRect.Top();
if( nNewY > aScreenRect.Bottom() )
@@ -401,6 +405,9 @@ void AquaSalFrame::SendPaintEvent( const Rectangle* pRect )
void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate)
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
mbShown = bVisible;
if(bVisible)
{
@@ -411,8 +418,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate)
// trigger filling our backbuffer
SendPaintEvent();
- //YieldMutexReleaser aRel;
-
if( bNoActivate || [mpWindow canBecomeKeyWindow] == NO )
[mpWindow orderFront: NSApp];
else
@@ -443,8 +448,6 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate)
if( mpMenu && mpMenu->mbMenuBar && AquaSalMenu::pCurrentMenuBar == mpMenu )
AquaSalMenu::setDefaultMenu();
- //YieldMutexReleaser aRel;
-
// #i90440# #i94443# work around the focus going back to some other window
// if a child gets hidden for a parent window
if( mpParent && mpParent->mbShown && [mpWindow isKeyWindow] )
@@ -468,6 +471,9 @@ void AquaSalFrame::Enable( BOOL bEnable )
void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
mnMinWidth = nWidth;
mnMinHeight = nHeight;
@@ -490,6 +496,9 @@ void AquaSalFrame::SetMinClientSize( long nWidth, long nHeight )
void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
mnMaxWidth = nWidth;
mnMaxHeight = nHeight;
@@ -516,6 +525,9 @@ void AquaSalFrame::SetMaxClientSize( long nWidth, long nHeight )
void AquaSalFrame::SetClientSize( long nWidth, long nHeight )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( mpWindow )
{
NSSize aSize = { nWidth, nHeight };
@@ -548,6 +560,9 @@ void AquaSalFrame::GetClientSize( long& rWidth, long& rHeight )
void AquaSalFrame::SetWindowState( const SalFrameState* pState )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
// set normal state
NSRect aStateRect = [mpWindow frame];
aStateRect = [NSWindow contentRectForFrameRect: aStateRect styleMask: mnStyleMask];
@@ -563,13 +578,27 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
VCLToCocoa( aStateRect );
aStateRect = [NSWindow frameRectForContentRect: aStateRect styleMask: mnStyleMask];
- // relase and acquire mutex again since this call can block waiting for an internal lock
+ [mpWindow setFrame: aStateRect display: NO];
+ if( pState->mnState == SAL_FRAMESTATE_MINIMIZED )
+ [mpWindow miniaturize: NSApp];
+ else if( [mpWindow isMiniaturized] )
+ [mpWindow deminiaturize: NSApp];
+
+
+ /* ZOOMED is not really maximized (actually it toggles between a user set size and
+ the program specified one), but comes closest since the default behavior is
+ "maximized" if the user did not intervene
+ */
+ if( pState->mnState == SAL_FRAMESTATE_MAXIMIZED )
{
- //YieldMutexReleaser aRel;
- [mpWindow setFrame: aStateRect display: NO];
+ if(! [mpWindow isZoomed])
+ [mpWindow zoom: NSApp];
+ }
+ else
+ {
+ if( [mpWindow isZoomed] )
+ [mpWindow zoom: NSApp];
}
-
- // FIXME: HTH maximized state ?
// get new geometry
UpdateFrameGeometry();
@@ -596,8 +625,6 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
SendPaintEvent();
// tell the system the views need to be updated
- //YieldMutexReleaser aRel;
-
[mpWindow display];
}
}
@@ -606,6 +633,9 @@ void AquaSalFrame::SetWindowState( const SalFrameState* pState )
BOOL AquaSalFrame::GetWindowState( SalFrameState* pState )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
pState->mnMask = SAL_FRAMESTATE_MASK_X |
SAL_FRAMESTATE_MASK_Y |
SAL_FRAMESTATE_MASK_WIDTH |
@@ -626,8 +656,6 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState )
pState->mnWidth = long(aStateRect.size.width);
pState->mnHeight = long(aStateRect.size.height);
- // FIXME: HTH maximized state ?
-
if( [mpWindow isMiniaturized] )
pState->mnState = SAL_FRAMESTATE_MINIMIZED;
else if( ! [mpWindow isZoomed] )
@@ -642,6 +670,9 @@ BOOL AquaSalFrame::GetWindowState( SalFrameState* pState )
void AquaSalFrame::SetScreenNumber(unsigned int nScreen)
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
NSArray* pScreens = [NSScreen screens];
Rectangle aRet;
NSScreen* pScreen = nil;
@@ -673,6 +704,9 @@ void AquaSalFrame::SetScreenNumber(unsigned int nScreen)
void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( mbFullScreen == bFullScreen )
return;
@@ -731,7 +765,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay )
maFullScreenRect = [mpWindow frame];
{
- //YieldMutexReleaser aRel;
[mpWindow setFrame: [NSWindow frameRectForContentRect: aNewContentRect styleMask: mnStyleMask] display: mbShown ? YES : NO];
}
@@ -743,7 +776,6 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay )
else
{
{
- //YieldMutexReleaser aRel;
[mpWindow setFrame: maFullScreenRect display: mbShown ? YES : NO];
}
UpdateFrameGeometry();
@@ -782,6 +814,9 @@ public:
void AquaSalFrame::StartPresentation( BOOL bStart )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( bStart )
{
mpActivityTimer.reset( new PreventSleepTimer() );
@@ -806,6 +841,12 @@ void AquaSalFrame::SetAlwaysOnTop( BOOL bOnTop )
void AquaSalFrame::ToTop(USHORT nFlags)
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( ! (nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN) )
{
if( ! [mpWindow isVisible] || [mpWindow isMiniaturized] )
@@ -859,6 +900,9 @@ NSCursor* AquaSalFrame::getCurrentCursor() const
void AquaSalFrame::SetPointer( PointerStyle ePointerStyle )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( ePointerStyle >= POINTER_COUNT || ePointerStyle == mePointerStyle )
return;
mePointerStyle = ePointerStyle;
@@ -885,6 +929,10 @@ void AquaSalFrame::Flush( void )
if( !(mbGraphics && mpGraphics && mpView && mbShown) )
return;
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
+
[mpView setNeedsDisplay: YES];
// outside of the application's event loop (e.g. IntroWindow)
@@ -903,6 +951,9 @@ void AquaSalFrame::Flush( const Rectangle& rRect )
if( !(mbGraphics && mpGraphics && mpView && mbShown) )
return;
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
NSRect aNSRect = { {rRect.Left(), rRect.Top()}, { rRect.GetWidth(), rRect.GetHeight() } };
VCLToCocoa( aNSRect, false );
[mpView setNeedsDisplayInRect: aNSRect];
@@ -922,7 +973,8 @@ void AquaSalFrame::Sync()
{
if( mbGraphics && mpGraphics && mpView && mbShown )
{
- //YieldMutexReleaser aRel;
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
[mpView setNeedsDisplay: YES];
[mpView display];
@@ -1146,6 +1198,9 @@ void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY )
// doesn't make the anything cleaner for now
void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
[mpView lockFocus];
StyleSettings aStyleSettings = rSettings.GetStyleSettings();
@@ -1257,6 +1312,9 @@ void AquaSalFrame::Beep( SoundType eSoundType )
void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHORT nFlags)
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
USHORT nEvent = 0;
if( [mpWindow isMiniaturized] )
@@ -1321,7 +1379,6 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR
// do not display yet, we need to update our backbuffer
{
- //YieldMutexReleaser aRel;
[mpWindow setFrame: [NSWindow frameRectForContentRect: aContentRect styleMask: mnStyleMask] display: NO];
}
@@ -1336,13 +1393,15 @@ void AquaSalFrame::SetPosSize(long nX, long nY, long nWidth, long nHeight, USHOR
SendPaintEvent();
// now inform the system that the views need to be drawn
- //YieldMutexReleaser aRel;
[mpWindow display];
}
}
void AquaSalFrame::GetWorkArea( Rectangle& rRect )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
NSScreen* pScreen = [mpWindow screen];
if( pScreen == nil )
pScreen = [NSScreen mainScreen];
@@ -1356,6 +1415,9 @@ void AquaSalFrame::GetWorkArea( Rectangle& rRect )
SalPointerState AquaSalFrame::GetPointerState()
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
SalPointerState state;
state.mnState = 0;
@@ -1463,6 +1525,9 @@ void AquaSalFrame::DrawMenuBar()
void AquaSalFrame::SetMenu( SalMenu* pSalMenu )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
AquaSalMenu* pMenu = static_cast<AquaSalMenu*>(pSalMenu);
DBG_ASSERT( ! pMenu || pMenu->mbMenuBar, "setting non menubar on frame" );
mpMenu = pMenu;
@@ -1472,6 +1537,9 @@ void AquaSalFrame::SetMenu( SalMenu* pSalMenu )
void AquaSalFrame::SetExtendedFrameStyle( SalExtStyle nStyle )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( (mnExtStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) != (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) )
[mpWindow setDocumentEdited: (nStyle & SAL_FRAME_EXT_STYLE_DOCMODIFIED) ? YES : NO];
mnExtStyle = nStyle;
@@ -1576,6 +1644,9 @@ void AquaSalFrame::CaptureMouse( BOOL bCapture )
void AquaSalFrame::ResetClipRegion()
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
// release old path and indicate no clipping
CGPathRelease( mrClippingPath );
mrClippingPath = NULL;
@@ -1591,6 +1662,9 @@ void AquaSalFrame::ResetClipRegion()
void AquaSalFrame::BeginSetClipRegion( ULONG nRects )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
// release old path
if( mrClippingPath )
{
@@ -1609,6 +1683,9 @@ void AquaSalFrame::BeginSetClipRegion( ULONG nRects )
void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( nWidth && nHeight )
{
NSRect aRect = { { nX, nY }, { nWidth, nHeight } };
@@ -1619,6 +1696,9 @@ void AquaSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight
void AquaSalFrame::EndSetClipRegion()
{
+ // #i113170# may not be the main thread if called from UNO API
+ SalData::ensureThreadAutoreleasePool();
+
if( ! maClippingRects.empty() )
{
mrClippingPath = CGPathCreateMutable();
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 2f9959ab43f4..240a915e4e12 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -162,6 +162,20 @@ static AquaSalFrame* getMouseContainerFrame()
return mpFrame;
}
+-(void)displayIfNeeded
+{
+ if( GetSalData() && GetSalData()->mpFirstInstance )
+ {
+ vos::IMutex* pMutex = GetSalData()->mpFirstInstance->GetYieldMutex();
+ if( pMutex )
+ {
+ pMutex->acquire();
+ [super displayIfNeeded];
+ pMutex->release();
+ }
+ }
+}
+
-(MacOSBOOL)containsMouse
{
// is this event actually inside that NSWindow ?
@@ -573,8 +587,11 @@ private:
-(void)mouseEntered: (NSEvent*)pEvent
{
s_pMouseFrame = mpFrame;
-
- [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE];
+
+ // #i107215# the only mouse events we get when inactive are enter/exit
+ // actually we would like to have all of them, but better none than some
+ if( [NSApp isActive] )
+ [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSEMOVE];
}
-(void)mouseExited: (NSEvent*)pEvent
@@ -582,7 +599,10 @@ private:
if( s_pMouseFrame == mpFrame )
s_pMouseFrame = NULL;
- [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE];
+ // #i107215# the only mouse events we get when inactive are enter/exit
+ // actually we would like to have all of them, but better none than some
+ if( [NSApp isActive] )
+ [self sendMouseEventToFrame:pEvent button:s_nLastButton eventtype:SALEVENT_MOUSELEAVE];
}
-(void)rightMouseDown: (NSEvent*)pEvent
diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx
index ed3086d8506f..82102f2e7095 100644
--- a/vcl/aqua/source/window/salmenu.cxx
+++ b/vcl/aqua/source/window/salmenu.cxx
@@ -79,10 +79,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
-(void)showPreferences: (id) sender
{
+ YIELD_GUARD;
+
[self showDialog: SHOWDIALOG_ID_PREFERENCES];
}
-(void)showAbout: (id) sender
{
+ YIELD_GUARD;
+
[self showDialog: SHOWDIALOG_ID_ABOUT];
}
@end
@@ -203,11 +207,12 @@ static void initAppMenu()
// =======================================================================
-SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar )
+SalMenu* AquaSalInstance::CreateMenu( BOOL bMenuBar, Menu* pVCLMenu )
{
initAppMenu();
AquaSalMenu *pAquaSalMenu = new AquaSalMenu( bMenuBar );
+ pAquaSalMenu->mpVCLMenu = pVCLMenu;
return pAquaSalMenu;
}
diff --git a/vcl/inc/cupsmgr.hxx b/vcl/inc/cupsmgr.hxx
index b413184f477f..0250cece817e 100644
--- a/vcl/inc/cupsmgr.hxx
+++ b/vcl/inc/cupsmgr.hxx
@@ -70,7 +70,7 @@ class CUPSManager : public PrinterInfoManager
virtual void initialize();
- void getOptionsFromDocumentSetup( const JobData& rJob, int& rNumOptions, void** rOptions ) const;
+ void getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const;
void runDests();
public:
// public for stub
@@ -84,7 +84,7 @@ public:
const char* authenticateUser( const char* );
virtual FILE* startSpool( const rtl::OUString& rPrinterName, bool bQuickCommand );
- virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData );
+ virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner );
virtual void setupJobContextData( JobData& rData );
// changes the info about a named printer
diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx
index 8846d9bbe948..327494b216e4 100644
--- a/vcl/inc/vcl/arrange.hxx
+++ b/vcl/inc/vcl/arrange.hxx
@@ -48,7 +48,7 @@ namespace vcl
or a child WindowArranger (a node in the hierarchy), but never both
*/
- class WindowArranger
+ class VCL_DLLPUBLIC WindowArranger
{
protected:
struct Element
@@ -76,11 +76,13 @@ namespace vcl
Element( Window* i_pWin,
boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
- sal_Int32 i_nExpandPriority = 0
+ sal_Int32 i_nExpandPriority = 0,
+ const Size& i_rMinSize = Size()
)
: m_pElement( i_pWin )
, m_pChild( i_pChild )
, m_nExpandPriority( i_nExpandPriority )
+ , m_aMinSize( i_rMinSize )
, m_bHidden( false )
, m_nLeftBorder( 0 )
, m_nTopBorder( 0 )
@@ -101,12 +103,19 @@ namespace vcl
Rectangle m_aManagedArea;
long m_nOuterBorder;
+ rtl::OUString m_aIdentifier;
+
virtual Element* getElement( size_t i_nIndex ) = 0;
const Element* getConstElement( size_t i_nIndex ) const
{ return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); }
public:
+ static long getDefaultBorder();
+
+ static long getBorderValue( long nBorder )
+ { return nBorder >= 0 ? nBorder : -nBorder * getDefaultBorder(); }
+
WindowArranger( WindowArranger* i_pParent = NULL )
: m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL )
, m_pParentArranger( i_pParent )
@@ -141,6 +150,9 @@ namespace vcl
virtual bool isVisible() const; // true if any element is visible
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getProperties() const;
+ virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
+
sal_Int32 getExpandPriority( size_t i_nIndex ) const
{
const Element* pEle = getConstElement( i_nIndex );
@@ -173,6 +185,19 @@ namespace vcl
}
}
+ void getBorders( size_t i_nIndex, long* i_pLeft = NULL, long* i_pTop = NULL, long* i_pRight = NULL, long* i_pBottom = NULL ) const
+ {
+ const Element* pEle = getConstElement( i_nIndex );
+ if( pEle )
+ {
+ if( i_pLeft ) *i_pLeft = pEle->m_nLeftBorder;
+ if( i_pTop ) *i_pTop = pEle->m_nTopBorder;
+ if( i_pRight ) *i_pRight = pEle->m_nRightBorder;
+ if( i_pBottom ) *i_pBottom = pEle->m_nBottomBorder;
+ }
+ }
+
+
void show( bool i_bShow = true, bool i_bImmediateUpdate = true );
void setManagedArea( const Rectangle& i_rArea )
@@ -187,9 +212,15 @@ namespace vcl
m_nOuterBorder = i_nBorder;
resize();
}
+
+ const rtl::OUString getIdentifier() const
+ { return m_aIdentifier; }
+
+ void setIdentifier( const rtl::OUString& i_rId )
+ { m_aIdentifier = i_rId; }
};
- class RowOrColumn : public WindowArranger
+ class VCL_DLLPUBLIC RowOrColumn : public WindowArranger
{
long m_nBorderWidth;
bool m_bColumn;
@@ -204,7 +235,7 @@ namespace vcl
public:
RowOrColumn( WindowArranger* i_pParent = NULL,
- bool bColumn = true, long i_nBorderWidth = 5 )
+ bool bColumn = true, long i_nBorderWidth = -1 )
: WindowArranger( i_pParent )
, m_nBorderWidth( i_nBorderWidth )
, m_bColumn( bColumn )
@@ -218,7 +249,7 @@ namespace vcl
// add a managed window at the given index
// an index smaller than zero means add the window at the end
- size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
+ size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, const Size& i_rMinSize = Size(), size_t i_nIndex = ~0 );
void remove( Window* );
size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
@@ -230,7 +261,7 @@ namespace vcl
long getBorderWidth() const { return m_nBorderWidth; }
};
- class LabeledElement : public WindowArranger
+ class VCL_DLLPUBLIC LabeledElement : public WindowArranger
{
WindowArranger::Element m_aLabel;
WindowArranger::Element m_aElement;
@@ -248,7 +279,7 @@ namespace vcl
}
public:
- LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = 5 )
+ LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = -1 )
: WindowArranger( i_pParent )
, m_nDistance( i_nDistance )
, m_nLabelColumnWidth( 0 )
@@ -274,11 +305,11 @@ namespace vcl
{ return m_aElement.getOptimalSize( i_eType ); }
};
- class LabelColumn : public RowOrColumn
+ class VCL_DLLPUBLIC LabelColumn : public RowOrColumn
{
long getLabelWidth() const;
public:
- LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = 5 )
+ LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = -1 )
: RowOrColumn( i_pParent, true, i_nBorderWidth )
{}
virtual ~LabelColumn();
@@ -288,10 +319,10 @@ namespace vcl
// returns the index of the added label
size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 );
- size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 );
+ size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0, const Size& i_rElementMinSize = Size() );
};
- class Indenter : public WindowArranger
+ class VCL_DLLPUBLIC Indenter : public WindowArranger
{
long m_nIndent;
WindowArranger::Element m_aElement;
@@ -301,7 +332,7 @@ namespace vcl
{ return i_nIndex == 0 ? &m_aElement : NULL; }
public:
- Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 15 )
+ Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 3*getDefaultBorder() )
: WindowArranger( i_pParent )
, m_nIndent( i_nIndent )
{}
@@ -325,7 +356,7 @@ namespace vcl
{ setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); }
};
- class Spacer : public WindowArranger
+ class VCL_DLLPUBLIC Spacer : public WindowArranger
{
WindowArranger::Element m_aElement;
Size m_aSize;
@@ -351,7 +382,7 @@ namespace vcl
virtual bool isVisible() const { return true; }
};
- class MatrixArranger : public WindowArranger
+ class VCL_DLLPUBLIC MatrixArranger : public WindowArranger
{
long m_nBorderX;
long m_nBorderY;
@@ -370,9 +401,10 @@ namespace vcl
MatrixElement( Window* i_pWin,
sal_uInt32 i_nX, sal_uInt32 i_nY,
boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
- sal_Int32 i_nExpandPriority = 0
+ sal_Int32 i_nExpandPriority = 0,
+ const Size& i_rMinSize = Size()
)
- : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority )
+ : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority, i_rMinSize )
, m_nX( i_nX )
, m_nY( i_nY )
{
@@ -385,15 +417,20 @@ namespace vcl
sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY )
{ return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); }
- Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const;
+ static void distributeExtraSize( std::vector<long>& io_rSizes, const std::vector<sal_Int32>& i_rPrios, long i_nExtraWidth );
+
+ Size getOptimalSize( WindowSizeType,
+ std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights,
+ std::vector<sal_Int32>& o_rColumnPrio, std::vector<sal_Int32>& o_rRowPrio
+ ) const;
protected:
virtual Element* getElement( size_t i_nIndex )
{ return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
public:
MatrixArranger( WindowArranger* i_pParent = NULL,
- long i_nBorderX = 5,
- long i_nBorderY = 5 )
+ long i_nBorderX = -1,
+ long i_nBorderY = -1 )
: WindowArranger( i_pParent )
, m_nBorderX( i_nBorderX )
, m_nBorderY( i_nBorderY )
@@ -406,7 +443,7 @@ namespace vcl
virtual size_t countElements() const { return m_aElements.size(); }
// add a managed window at the given matrix position
- size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
+ size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0, const Size& i_rMinSize = Size() );
void remove( Window* );
size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
diff --git a/vcl/inc/vcl/btndlg.hxx b/vcl/inc/vcl/btndlg.hxx
index dbeb8350a0d4..3186ba5f6399 100644
--- a/vcl/inc/vcl/btndlg.hxx
+++ b/vcl/inc/vcl/btndlg.hxx
@@ -104,8 +104,8 @@ public:
XubString GetButtonText( USHORT nId ) const;
void SetButtonHelpText( USHORT nId, const XubString& rText );
XubString GetButtonHelpText( USHORT nId ) const;
- void SetButtonHelpId( USHORT nId, ULONG nHelpId );
- ULONG GetButtonHelpId( USHORT nId ) const;
+ void SetButtonHelpId( USHORT nId, const rtl::OString& rHelpId );
+ rtl::OString GetButtonHelpId( USHORT nId ) const;
void SetFocusButton( USHORT nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; }
USHORT GetFocusButton() const { return mnFocusButtonId; }
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index fa185c32dcda..ab92445b5e03 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -132,7 +132,7 @@ protected:
SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
SAL_DLLPRIVATE void ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags,
- const Rectangle& rRect, bool bLayout );
+ const Rectangle& rRect, bool bLayout, bool bMenuBtnSep );
SAL_DLLPRIVATE void ImplDrawPushButton( bool bLayout = false );
using Button::ImplGetTextStyle;
SAL_DLLPRIVATE USHORT ImplGetTextStyle( ULONG nDrawFlags ) const;
diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx
index a40de9503367..9dc427d83943 100644..100755
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -247,6 +247,10 @@ public:
virtual XubString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
+
+ // returns the minimum size a bordered Edit should have given the current
+ // global style settings (needed by sc's inputwin.cxx)
+ static Size GetMinimumEditSize();
};
inline ULONG Edit::IsUpdateDataEnabled() const
diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index a77c1626dc24..0e77d5dd6bc4 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -48,7 +48,6 @@ class ImplFontOptions;
namespace basegfx { class B2DPolyPolygon; }
class RawBitmap;
-class CmapResult;
#include <vcl/outfont.hxx>
#include <vcl/impfont.hxx>
@@ -190,7 +189,7 @@ public:
virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const = 0;
virtual ULONG GetKernPairs( ImplKernPairData** ) const { return 0; }
virtual int GetGlyphKernValue( int, int ) const { return 0; }
- virtual bool GetFontCodeRanges( CmapResult& ) const { return false; }
+ virtual const ImplFontCharMap* GetImplFontCharMap() const = 0;
Point TransformPoint( const Point& ) const;
GlyphData& GetGlyphData( int nGlyphIndex );
diff --git a/vcl/inc/vcl/graphite_adaptors.hxx b/vcl/inc/vcl/graphite_adaptors.hxx
index e58881c9f463..ae2ff2962adb 100644
--- a/vcl/inc/vcl/graphite_adaptors.hxx
+++ b/vcl/inc/vcl/graphite_adaptors.hxx
@@ -55,11 +55,11 @@
#include "vcl/dllapi.h"
// Libraries
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
// Module type definitions and forward declarations.
//
diff --git a/vcl/inc/vcl/graphite_features.hxx b/vcl/inc/vcl/graphite_features.hxx
index 47f4c3a01e7f..47b8f062e299 100644
--- a/vcl/inc/vcl/graphite_features.hxx
+++ b/vcl/inc/vcl/graphite_features.hxx
@@ -29,11 +29,11 @@
// Parse a string of features specified as ; separated pairs.
// e.g.
// 1001=1&2002=2&fav1=0
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrFeature.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
namespace grutils
{
diff --git a/vcl/inc/vcl/graphite_layout.hxx b/vcl/inc/vcl/graphite_layout.hxx
index 765a154a9898..cd22abdcdb26 100644
--- a/vcl/inc/vcl/graphite_layout.hxx
+++ b/vcl/inc/vcl/graphite_layout.hxx
@@ -40,13 +40,13 @@
#include <vector>
#include <utility>
// Libraries
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/GrConstants.h>
#include <graphite/GrAppData.h>
#include <graphite/SegmentAux.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
// Platform
#include <vcl/sallayout.hxx>
#include <vcl/dllapi.h>
diff --git a/vcl/inc/vcl/help.hxx b/vcl/inc/vcl/help.hxx
index 30308aa8a723..1f4ba36d8f43 100644
--- a/vcl/inc/vcl/help.hxx
+++ b/vcl/inc/vcl/help.hxx
@@ -52,8 +52,8 @@ class Window;
#define QUICKHELP_BIDI_RTL ((USHORT)0x8000)
// By changes you must also change: rsc/vclrsc.hxx
-#define OOO_HELP_INDEX ((ULONG)0xFFFFFFFF)
-#define OOO_HELP_HELPONHELP ((ULONG)0xFFFFFFFE)
+#define OOO_HELP_INDEX ".help:index"
+#define OOO_HELP_HELPONHELP ".help:helponhelp"
// --------
// - Help -
@@ -71,10 +71,9 @@ public:
void SetHelpFile( const String& rFileName ) { maHelpFile = rFileName; }
const String& GetHelpFile() const { return maHelpFile; }
- virtual BOOL Start( ULONG nHelpId, const Window* pWindow );
- virtual BOOL Start( const XubString& rKeyWord, const Window* pWindow );
- virtual void OpenHelpAgent( ULONG nHelpId );
- virtual XubString GetHelpText( ULONG nHelpId, const Window* pWindow );
+ virtual BOOL Start( const XubString& rHelpId, const Window* pWindow );
+ virtual BOOL SearchKeyword( const XubString& rKeyWord );
+ virtual void OpenHelpAgent( const rtl::OString& rHelpId );
virtual XubString GetHelpText( const String& aHelpURL, const Window* pWindow );
static void EnableContextHelp();
diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx
index ac278f76f65b..6580538f5d10 100644
--- a/vcl/inc/vcl/ilstbox.hxx
+++ b/vcl/inc/vcl/ilstbox.hxx
@@ -36,6 +36,7 @@
#include <vcl/lstbox.h>
#include <vcl/timer.hxx>
+#include "vcl/quickselectionengine.hxx"
class ScrollBar;
class ScrollBarBox;
@@ -193,13 +194,11 @@ public:
// - ImplListBoxWindow -
// ---------------------
-class ImplListBoxWindow : public Control
+class ImplListBoxWindow : public Control, public ::vcl::ISearchableStringList
{
private:
ImplEntryList* mpEntryList; // EntryListe
Rectangle maFocusRect;
- String maSearchStr;
- Timer maSearchTimeout;
Size maUserItemSize;
@@ -254,9 +253,10 @@ private:
Link maUserDrawHdl;
Link maMRUChangedHdl;
-protected:
- DECL_LINK( SearchStringTimeout, Timer* );
+ ::vcl::QuickSelectionEngine
+ maQuickSelectionEngine;
+protected:
virtual void KeyInput( const KeyEvent& rKEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
@@ -379,6 +379,12 @@ public:
// pb: #106948# explicit mirroring for calc
inline void EnableMirroring() { mbMirroring = TRUE; }
inline BOOL IsMirroring() const { return mbMirroring; }
+
+protected:
+ // ISearchableStringList
+ virtual ::vcl::StringEntryIdentifier CurrentEntry( String& _out_entryText ) const;
+ virtual ::vcl::StringEntryIdentifier NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const;
+ virtual void SelectEntry( ::vcl::StringEntryIdentifier _entry );
};
// ---------------
diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx
index a1104bbf4a86..e38e1dea78d4 100644
--- a/vcl/inc/vcl/impfont.hxx
+++ b/vcl/inc/vcl/impfont.hxx
@@ -196,8 +196,8 @@ public:
int GetIndexFromChar( sal_uInt32 ) const;
sal_uInt32 GetCharFromIndex( int ) const;
- void AddReference();
- void DeReference();
+ void AddReference() const;
+ void DeReference() const;
int GetGlyphIndex( sal_uInt32 ) const;
@@ -213,8 +213,8 @@ private:
const int* mpStartGlyphs; // range-specific mapper to glyphs
const USHORT* mpGlyphIds; // individual glyphid mappings
int mnRangeCount;
- int mnCharCount;
- int mnRefCount;
+ int mnCharCount; // covered codepoints
+ mutable int mnRefCount;
};
// CmapResult is a normalized version of the many CMAP formats
diff --git a/vcl/inc/vcl/javachild.hxx b/vcl/inc/vcl/javachild.hxx
index 62b447f26571..c5ec3c678900 100644
--- a/vcl/inc/vcl/javachild.hxx
+++ b/vcl/inc/vcl/javachild.hxx
@@ -47,8 +47,6 @@ public:
private:
- SAL_DLLPRIVATE void implTestJavaException( void* pEnv );
-
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE JavaChildWindow (const JavaChildWindow &);
SAL_DLLPRIVATE JavaChildWindow & operator= (const JavaChildWindow &);
diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx
index f576b816dab0..18330ae3508d 100644
--- a/vcl/inc/vcl/jobdata.hxx
+++ b/vcl/inc/vcl/jobdata.hxx
@@ -50,6 +50,7 @@ struct JobData
int m_nColorDepth;
int m_nPSLevel; // 0: no override, else languaglevel to use
int m_nColorDevice; // 0: no override, -1 grey scale, +1 color
+ int m_nPDFDevice; // 0: PostScript, 1: PDF
orientation::type m_eOrientation;
::rtl::OUString m_aPrinterName;
const PPDParser* m_pParser;
@@ -64,6 +65,7 @@ struct JobData
m_nColorDepth( 24 ),
m_nPSLevel( 0 ),
m_nColorDevice( 0 ),
+ m_nPDFDevice( 0 ),
m_eOrientation( orientation::Portrait ),
m_pParser( NULL ) {}
@@ -72,6 +74,8 @@ struct JobData
JobData( const JobData& rData ) { *this = rData; }
void setCollate( bool bCollate );
+ bool setPaper( int nWidth, int nHeight ); // dimensions in pt
+ bool setPaperBin( int nPaperBin ); // dimensions in pt
// creates a new buffer using new
// it is up to the user to delete it again
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index 908f3e30319c..d57fdeb7cfd3 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -304,8 +304,8 @@ public:
void SetHelpCommand( USHORT nItemId, const XubString& rString );
const XubString& GetHelpCommand( USHORT nItemId ) const;
- void SetHelpId( USHORT nItemId, ULONG nHelpId );
- ULONG GetHelpId( USHORT nItemId ) const;
+ void SetHelpId( USHORT nItemId, const rtl::OString& rHelpId );
+ rtl::OString GetHelpId( USHORT nItemId ) const;
void SetActivateHdl( const Link& rLink ) { aActivateHdl = rLink; }
const Link& GetActivateHdl() const { return aActivateHdl; }
diff --git a/vcl/inc/vcl/metric.hxx b/vcl/inc/vcl/metric.hxx
index eae6b38c5f9d..6328890c1749 100644
--- a/vcl/inc/vcl/metric.hxx
+++ b/vcl/inc/vcl/metric.hxx
@@ -95,7 +95,7 @@ public:
class VCL_DLLPUBLIC FontCharMap
{
private:
- ImplFontCharMap* mpImpl;
+ const ImplFontCharMap* mpImpl;
public:
FontCharMap();
@@ -118,7 +118,7 @@ public:
private:
friend class OutputDevice;
- void Reset( ImplFontCharMap* pNewMap = NULL );
+ void Reset( const ImplFontCharMap* pNewMap = NULL );
// prevent assignment and copy construction
FontCharMap( const FontCharMap& );
diff --git a/vcl/inc/vcl/mnemonicengine.hxx b/vcl/inc/vcl/mnemonicengine.hxx
index d12b3db2417e..fcd303510203 100644
--- a/vcl/inc/vcl/mnemonicengine.hxx
+++ b/vcl/inc/vcl/mnemonicengine.hxx
@@ -59,7 +59,7 @@ namespace vcl
If this value is <NULL/>, searching stops.
*/
- virtual const void* FirstSearchEntry( String& _rEntryText ) = 0;
+ virtual const void* FirstSearchEntry( String& _rEntryText ) const = 0;
/** returns the next list entry for the mnemonic search
@@ -74,7 +74,7 @@ namespace vcl
to <member>FirstSearchEntry</member> (i.e. you cycled
around), then searching stops, too.
*/
- virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) = 0;
+ virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, String& _rEntryText ) const = 0;
/** "selects" a given entry.
@@ -117,7 +117,7 @@ namespace vcl
the entry to select. This is the return value of a previous call
to <member>FirstSearchEntry</member> or <member>NextSearchEntry</member>.
*/
- virtual void ExecuteSearchEntry( const void* _pEntry ) = 0;
+ virtual void ExecuteSearchEntry( const void* _pEntry ) const = 0;
};
//====================================================================
diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index f787df3692ce..12c4202af144 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -185,6 +185,9 @@ struct KerningPair
#define TEXT_DRAW_MULTILINE ((USHORT)0x1000)
#define TEXT_DRAW_WORDBREAK ((USHORT)0x2000)
#define TEXT_DRAW_NEWSELLIPSIS ((USHORT)0x4000)
+// in the long run we should make text style flags longer
+// but at the moment we can get away with this 2 bit field for ellipsis style
+#define TEXT_DRAW_CENTERELLIPSIS (TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_PATHELLIPSIS)
#define TEXT_DRAW_WORDBREAK_HYPHENATION (((USHORT)0x8000) | TEXT_DRAW_WORDBREAK)
@@ -1114,7 +1117,7 @@ public:
/** Added return value to see if EPS could be painted directly.
Theoreticaly, handing over a matrix would be needed to handle
- painting rotated EPS files (e.g. contained mín Metafiles). This
+ painting rotated EPS files (e.g. contained in Metafiles). This
would then need to be supported for Mac and PS printers, but
that's too much for now, wrote #i107046# for this */
bool DrawEPS( const Point& rPt, const Size& rSz,
diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index 419814e5ce97..52e4b5014120 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -38,7 +38,8 @@
#include <vcl/font.hxx>
#include <vcl/graphictools.hxx>
-#include <com/sun/star/io/XOutputStream.hpp>
+#include "com/sun/star/io/XOutputStream.hpp"
+#include "com/sun/star/beans/XMaterialHolder.hpp"
#include <list>
#include <vector>
@@ -47,6 +48,7 @@
class Font;
class Point;
class OutputDevice;
+class GDIMetaFile;
class MapMode;
class Polygon;
class LineInfo;
@@ -61,15 +63,7 @@ class Wallpaper;
namespace vcl
{
-struct PDFDocInfo
-{
- String Title; // document title
- String Author; // document author
- String Subject; // subject
- String Keywords; // keywords
- String Creator; // application that created the original document
- String Producer; // OpenOffice
-};
+class PDFExtOutDevData;
struct PDFNote
{
@@ -468,7 +462,7 @@ public:
FitVisible,
ActionZoom
};
-// These emuns are treated as integer while reading/writing to configuration
+// These enums are treated as integer while reading/writing to configuration
enum PDFPageLayout
{
DefaultLayout,
@@ -489,20 +483,35 @@ public:
/*
The following structure describes the permissions used in PDF security
*/
- struct PDFSecPermissions
+ struct PDFEncryptionProperties
{
-//for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20.
- bool CanPrintTheDocument;
+
+ bool Security128bit; // true to select 128 bit encryption, false for 40 bit
+ //for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20.
+ bool CanPrintTheDocument;
bool CanModifyTheContent;
bool CanCopyOrExtract;
bool CanAddOrModify;
-//for revision 3 (bit 128 security) only
+ //for revision 3 (bit 128 security) only
bool CanFillInteractive;
bool CanExtractForAccessibility;
bool CanAssemble;
bool CanPrintFull;
-//permission default set for 128 bit, accessibility only
- PDFSecPermissions() :
+
+ // encryption will only happen if EncryptionKey is not empty
+ // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier
+ // if these do not match, behavior is undefined, most likely an invalid PDF will be produced
+ // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from
+ // PDFDocInfo, Owner password and User password used the InitEncryption method which
+ // implements the algorithms described in the PDF reference chapter 3.5: Encryption
+ std::vector<sal_uInt8> OValue;
+ std::vector<sal_uInt8> UValue;
+ std::vector<sal_uInt8> EncryptionKey;
+ std::vector<sal_uInt8> DocumentIdentifier;
+
+ //permission default set for 128 bit, accessibility only
+ PDFEncryptionProperties() :
+ Security128bit ( true ),
CanPrintTheDocument ( false ),
CanModifyTheContent ( false ),
CanCopyOrExtract ( false ),
@@ -512,6 +521,20 @@ The following structure describes the permissions used in PDF security
CanAssemble ( false ),
CanPrintFull ( false )
{}
+
+
+ bool Encrypt() const
+ { return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); }
+ };
+
+ struct PDFDocInfo
+ {
+ String Title; // document title
+ String Author; // document author
+ String Subject; // subject
+ String Keywords; // keywords
+ String Creator; // application that created the original document
+ String Producer; // OpenOffice
};
struct PDFWriterContext
@@ -570,14 +593,12 @@ The following structure describes the permissions used in PDF security
sal_Int32 InitialPage;
sal_Int32 OpenBookmarkLevels; // -1 means all levels
- struct PDFSecPermissions AccessPermissions;
-
- bool Encrypt; // main encryption flag, must be true to encript
- bool Security128bit; // true to select 128 bit encryption, false for 40 bit
- rtl::OUString OwnerPassword; // owner password for PDF, in clear text
- rtl::OUString UserPassword; // user password for PDF, in clear text
+ PDFWriter::PDFEncryptionProperties Encryption;
+ PDFWriter::PDFDocInfo DocumentInfo;
com::sun::star::lang::Locale DocumentLocale; // defines the document default language
+ sal_uInt32 DPIx, DPIy; // how to handle MapMode( MAP_PIXEL )
+ // 0 here specifies a default handling
PDFWriterContext() :
RelFsys( false ), //i56629, i49415?, i64585?
@@ -604,13 +625,13 @@ The following structure describes the permissions used in PDF security
FirstPageLeft( false ),
InitialPage( 1 ),
OpenBookmarkLevels( -1 ),
- AccessPermissions( ),
- Encrypt( false ),
- Security128bit( true )
+ Encryption(),
+ DPIx( 0 ),
+ DPIy( 0 )
{}
};
- PDFWriter( const PDFWriterContext& rContext );
+ PDFWriter( const PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
~PDFWriter();
/** Returns an OutputDevice for formatting
@@ -635,17 +656,24 @@ The following structure describes the permissions used in PDF security
returns the page id of the new page
*/
sal_Int32 NewPage( sal_Int32 nPageWidth = 0, sal_Int32 nPageHeight = 0, Orientation eOrientation = Inherit );
+ /** Play a metafile like an outputdevice would do
+ */
+ struct PlayMetafileContext
+ {
+ int m_nMaxImageResolution;
+ bool m_bOnlyLosslessCompression;
+ int m_nJPEGQuality;
+ bool m_bTransparenciesWereRemoved;
+
+ PlayMetafileContext()
+ : m_nMaxImageResolution( 0 )
+ , m_bOnlyLosslessCompression( false )
+ , m_nJPEGQuality( 90 )
+ , m_bTransparenciesWereRemoved( false )
+ {}
- /*
- * set document info; due to the use of document information in building the PDF document ID, must be called before
- * emitting anything.
- */
- void SetDocInfo( const PDFDocInfo& rInfo );
-
- /*
- * get currently set document info
- */
- const PDFDocInfo& GetDocInfo() const;
+ };
+ void PlayMetafile( const GDIMetaFile&, const PlayMetafileContext&, vcl::PDFExtOutDevData* pDevDat = NULL );
/* sets the document locale originally passed with the context to a new value
* only affects the output if used before calling <code>Emit/code>.
@@ -664,6 +692,12 @@ The following structure describes the permissions used in PDF security
PDFVersion GetVersion() const;
+ static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
+ InitEncryption( const rtl::OUString& i_rOwnerPassword,
+ const rtl::OUString& i_rUserPassword,
+ bool b128Bit
+ );
+
/* functions for graphics state */
/* flag values: see vcl/outdev.hxx */
void Push( USHORT nFlags = 0xffff );
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index 0cd56e32d83d..810fbd353f8c 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -400,7 +400,7 @@ protected:
PrinterController( const boost::shared_ptr<Printer>& );
public:
enum NupOrderType
- { LRTB, TBLR };
+ { LRTB, TBLR, TBRL, RLTB };
struct MultiPageSetup
{
// all metrics in 100th mm
@@ -478,6 +478,7 @@ public:
*/
void enableUIOption( const rtl::OUString& rPropName, bool bEnable );
bool isUIOptionEnabled( const rtl::OUString& rPropName ) const;
+ bool isUIChoiceEnabled( const rtl::OUString& rPropName, sal_Int32 nChoice ) const;
/* returns the property name rPropName depends on or an empty string
if no dependency exists.
*/
@@ -513,21 +514,24 @@ public:
bool isDirectPrint() const;
// implementation details, not usable outside vcl
- SAL_DLLPRIVATE int getFilteredPageCount();
+ // don't use outside vcl. Some of these ar exported for
+ // the benefit of vcl's plugins.
+ // Still: DO NOT USE OUTSIDE VCL
+ int getFilteredPageCount();
SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
- SAL_DLLPRIVATE PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
+ PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
SAL_DLLPRIVATE void printFilteredPage( int i_nPage );
SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& );
SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
- SAL_DLLPRIVATE void createProgressDialog();
- SAL_DLLPRIVATE bool isProgressCanceled() const;
+ void createProgressDialog();
+ bool isProgressCanceled() const;
SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const;
- SAL_DLLPRIVATE void setLastPage( sal_Bool i_bLastPage );
+ void setLastPage( sal_Bool i_bLastPage );
SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse );
SAL_DLLPRIVATE bool getReversePrint() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter();
- SAL_DLLPRIVATE void setJobState( com::sun::star::view::PrintableState );
+ void setJobState( com::sun::star::view::PrintableState );
SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent );
SAL_DLLPRIVATE int getPageCountProtected() const;
@@ -650,6 +654,7 @@ class VCL_DLLPUBLIC PrinterOptionsHelper
const com::sun::star::uno::Sequence< rtl::OUString >& i_rChoices,
sal_Int32 i_nValue,
const rtl::OUString& i_rType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ const com::sun::star::uno::Sequence< sal_Bool >& i_rDisabledChoices = com::sun::star::uno::Sequence< sal_Bool >(),
const UIControlOptions& i_rControlOptions = UIControlOptions()
);
diff --git a/vcl/inc/vcl/printerinfomanager.hxx b/vcl/inc/vcl/printerinfomanager.hxx
index f2e0aad538c8..5e94ed919a4e 100644
--- a/vcl/inc/vcl/printerinfomanager.hxx
+++ b/vcl/inc/vcl/printerinfomanager.hxx
@@ -157,6 +157,8 @@ public:
// there can only be one
static PrinterInfoManager& get();
+ // only called by SalData destructor, frees the global instance
+ static void release();
// get PrinterInfoManager type
Type getType() const { return m_eType; }
@@ -217,8 +219,10 @@ public:
// this may either be a regular file or the result of popen()
virtual FILE* startSpool( const rtl::OUString& rPrinterName, bool bQuickCommand );
// close the FILE* returned by startSpool and does the actual spooling
+ // set bBanner to "false" will attempt to suppress banner printing
+ // set bBanner to "true" will rely on the system default
// returns a numerical job id
- virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData );
+ virtual int endSpool( const rtl::OUString& rPrinterName, const rtl::OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner );
// for spadmin: whether adding or removing a printer is possible
virtual bool addOrRemovePossible() const;
diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx
index fdaf06c9854e..1d16a2241485 100644
--- a/vcl/inc/vcl/prndlg.hxx
+++ b/vcl/inc/vcl/prndlg.hxx
@@ -59,6 +59,8 @@ namespace vcl
VirtualDevice maPageVDev;
rtl::OUString maReplacementString;
rtl::OUString maToolTipString;
+ FixedLine maHorzDim;
+ FixedLine maVertDim;
bool useHCColorReplacement() const;
public:
@@ -126,7 +128,6 @@ namespace vcl
// border around each page
CheckBox maBorderCB;
- vcl::RowOrColumn maLayout;
boost::shared_ptr< vcl::RowOrColumn > mxBrochureDep;
boost::shared_ptr< vcl::LabeledElement >mxPagesBtnLabel;
@@ -142,7 +143,7 @@ namespace vcl
void showAdvancedControls( bool );
- virtual void Resize();
+ // virtual void Resize();
};
class JobTabPage : public TabPage
@@ -174,7 +175,6 @@ namespace vcl
long mnCollateUIMode;
- vcl::RowOrColumn maLayout;
boost::shared_ptr<vcl::RowOrColumn> mxPrintRange;
boost::shared_ptr<vcl::WindowArranger> mxDetails;
@@ -184,7 +184,7 @@ namespace vcl
void readFromSettings();
void storeToSettings();
- virtual void Resize();
+ // virtual void Resize();
void setupLayout();
};
@@ -197,7 +197,6 @@ namespace vcl
CheckBox maCollateSingleJobsBox;
CheckBox maReverseOrderBox;
- vcl::RowOrColumn maLayout;
boost::shared_ptr<vcl::RowOrColumn> mxOptGroup;
OutputOptPage( Window*, const ResId& );
@@ -206,7 +205,7 @@ namespace vcl
void readFromSettings();
void storeToSettings();
- virtual void Resize();
+ // virtual void Resize();
void setupLayout();
};
@@ -251,7 +250,6 @@ namespace vcl
rtl::OUString maPrintText;
rtl::OUString maDefPrtText;
- vcl::RowOrColumn maLayout;
boost::shared_ptr<vcl::RowOrColumn> mxPreviewCtrls;
Size maDetailsCollapsedSize;
diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx
index 6b2af991f2dd..244154360f3b 100644
--- a/vcl/inc/vcl/prntypes.hxx
+++ b/vcl/inc/vcl/prntypes.hxx
@@ -91,5 +91,6 @@ enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE };
#define PRINTER_CAPABILITIES_PDF ((USHORT)9)
#define PRINTER_CAPABILITIES_EXTERNALDIALOG ((USHORT)10)
#define PRINTER_CAPABILITIES_SETDUPLEX ((USHORT)11)
+#define PRINTER_CAPABILITIES_USEPULLMODEL ((USHORT)12)
#endif // _SV_PRNTYPES_HXX
diff --git a/vcl/inc/vcl/quickselectionengine.hxx b/vcl/inc/vcl/quickselectionengine.hxx
new file mode 100644
index 000000000000..f70736428010
--- /dev/null
+++ b/vcl/inc/vcl/quickselectionengine.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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.
+************************************************************************/
+
+#ifndef VCL_QUICKSELECTIONENGINE_HXX
+#define VCL_QUICKSELECTIONENGINE_HXX
+
+#include "dllapi.h"
+
+#include <tools/string.hxx>
+
+#include <memory>
+
+class KeyEvent;
+
+//........................................................................
+namespace vcl
+{
+//........................................................................
+
+ typedef const void* StringEntryIdentifier;
+
+ //====================================================================
+ //= ISearchableStringList
+ //====================================================================
+ // TODO: consolidate this with ::vcl::IMnemonicEntryList
+ class SAL_NO_VTABLE VCL_DLLPUBLIC ISearchableStringList
+ {
+ public:
+ /** returns the current entry in the list of searchable strings.
+
+ Search operations will start with this entry.
+ */
+ virtual StringEntryIdentifier CurrentEntry( String& _out_entryText ) const = 0;
+
+ /** returns the next entry in the list.
+
+ The implementation is expected to wrap around. That is, if the given entry denotes the last
+ entry in the list, then NextEntry should return the first entry.
+ */
+ virtual StringEntryIdentifier NextEntry( StringEntryIdentifier _currentEntry, String& _out_entryText ) const = 0;
+
+ /** selects a given entry
+ */
+ virtual void SelectEntry( StringEntryIdentifier _entry ) = 0;
+ };
+
+ //====================================================================
+ //= QuickSelectionEngine
+ //====================================================================
+ struct QuickSelectionEngine_Data;
+ class VCL_DLLPUBLIC QuickSelectionEngine
+ {
+ public:
+ QuickSelectionEngine( ISearchableStringList& _entryList );
+ ~QuickSelectionEngine();
+
+ bool HandleKeyEvent( const KeyEvent& _rKEvt );
+ void Reset();
+
+ private:
+ ::std::auto_ptr< QuickSelectionEngine_Data > m_pData;
+
+ private:
+ QuickSelectionEngine(); // never implemented
+ QuickSelectionEngine( const QuickSelectionEngine& ); // never implemented
+ QuickSelectionEngine& operator=( const QuickSelectionEngine& ); // never implemented
+ };
+
+//........................................................................
+} // namespace vcl
+//........................................................................
+
+#endif // VCL_QUICKSELECTIONENGINE_HXX
diff --git a/vcl/inc/vcl/saldatabasic.hxx b/vcl/inc/vcl/saldatabasic.hxx
index 1df2a701fd1a..a40cd045611c 100644
--- a/vcl/inc/vcl/saldatabasic.hxx
+++ b/vcl/inc/vcl/saldatabasic.hxx
@@ -32,11 +32,17 @@
#include <vcl/salinst.hxx>
#include <osl/module.h>
+namespace psp
+{
+ class PrinterInfoManager;
+}
+
class VCL_DLLPUBLIC SalData
{
public:
- SalInstance* m_pInstance; // pointer to instance
- oslModule m_pPlugin; // plugin library handle
+ SalInstance* m_pInstance; // pointer to instance
+ oslModule m_pPlugin; // plugin library handle
+ psp::PrinterInfoManager* m_pPIManager;
SalData();
virtual ~SalData();
diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx
index f75817071304..d8276406746e 100644
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -233,13 +233,13 @@ public:
// release the fonts
void ReleaseFonts() { SetFont( NULL, 0 ); }
// get the current font's metrics
- virtual void GetFontMetric( ImplFontMetricData* ) = 0;
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel = 0 ) = 0;
// get kernign pairs of the current font
// return only PairCount if (pKernPairs == NULL)
virtual ULONG GetKernPairs( ULONG nMaxPairCount, ImplKernPairData* ) = 0;
// get the repertoire of the current font
- virtual ImplFontCharMap* GetImplFontCharMap() const = 0;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const = 0;
// graphics must fill supplied font list
virtual void GetDevFontList( ImplDevFontList* ) = 0;
// graphics should call ImplAddDevFontSubstitute on supplied
diff --git a/vcl/inc/vcl/salinst.hxx b/vcl/inc/vcl/salinst.hxx
index 9b92bf95e3fe..71b820803473 100644
--- a/vcl/inc/vcl/salinst.hxx
+++ b/vcl/inc/vcl/salinst.hxx
@@ -60,6 +60,7 @@ struct SalItemParams;
class SalSession;
struct SystemGraphicsData;
struct SystemWindowData;
+class Menu;
namespace vos { class IMutex; }
@@ -133,6 +134,8 @@ public:
virtual vos::IMutex* GetYieldMutex() = 0;
virtual ULONG ReleaseYieldMutex() = 0;
virtual void AcquireYieldMutex( ULONG nCount ) = 0;
+ // return true, if yield mutex is owned by this thread, else false
+ virtual bool CheckYieldMutex() = 0;
// wait next event and dispatch
// must returned by UserEvent (SalFrame::PostEvent)
@@ -141,10 +144,10 @@ public:
virtual bool AnyInput( USHORT nType ) = 0;
// Menues
- virtual SalMenu* CreateMenu( BOOL bMenuBar ) = 0;
- virtual void DestroyMenu( SalMenu* pMenu) = 0;
- virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData ) = 0;
- virtual void DestroyMenuItem( SalMenuItem* pItem ) = 0;
+ virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* pMenu );
+ virtual void DestroyMenu( SalMenu* pMenu);
+ virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
+ virtual void DestroyMenuItem( SalMenuItem* pItem );
// may return NULL to disable session management
virtual SalSession* CreateSalSession() = 0;
diff --git a/vcl/inc/vcl/smartid.hxx b/vcl/inc/vcl/smartid.hxx
deleted file mode 100755
index 2cc5f347b2cb..000000000000
--- a/vcl/inc/vcl/smartid.hxx
+++ /dev/null
@@ -1,87 +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.
- *
- ************************************************************************/
-
-#ifndef _SMARTID_HXX_
-#define _SMARTID_HXX_
-
-#include <tools/string.hxx>
-#include <vcl/dllapi.h>
-
-/// SMART_SET_SMART only sets the Ids that are defined in the SmartId
-/// the other types set whatever is given. This can also be used to reset an Id
-enum SmartIdUpdateMode { SMART_SET_SMART, SMART_SET_NUM, SMART_SET_STR, SMART_SET_ALL };
-
-struct ImplSmartIdData;
-
-/*
-
-SmartId is a substitute for Numeric HelpIds. They can handle Numeric and String HelpIds and offer commonly needed operators.
-
-Matching Ids:
-if part of an Id is not set (HasNumeric HasString is False) then this part will never match to anything. Not even unset values
-
-*/
-class VCL_DLLPUBLIC SmartId
-{
-private:
- ImplSmartIdData* mpData;
- SAL_DLLPRIVATE ImplSmartIdData* GetSmartIdData();
-
-public:
- explicit SmartId( const String& rId );
- explicit SmartId( ULONG nId );
- SmartId( const String& rId, ULONG nId );
-
- SmartId();
-
- SmartId( const SmartId& rId );
- SmartId& operator = ( const SmartId& rId );
-
- ~SmartId();
-
- void UpdateId( const SmartId& rId, SmartIdUpdateMode aMode = SMART_SET_SMART );
-
- BOOL HasNumeric() const;
- BOOL HasString() const;
- BOOL HasAny() const;
- ULONG GetNum() const;
- String GetStr() const;
-
- String GetText() const; /// return String for UI usage
-
- BOOL Matches( const String &rId )const;
- BOOL Matches( const ULONG nId ) const;
-/// In case both Ids have both values set only the StringId is used for Matching
- BOOL Matches( const SmartId &rId ) const;
-
- BOOL Equals( const SmartId &rId ) const;
-
- BOOL operator == ( const SmartId& rRight ) const;
- BOOL operator < ( const SmartId& rRight ) const;
-};
-
-#endif
diff --git a/vcl/inc/vcl/splitwin.hxx b/vcl/inc/vcl/splitwin.hxx
index 4aa1ca16785c..f028c6969b16 100644
--- a/vcl/inc/vcl/splitwin.hxx
+++ b/vcl/inc/vcl/splitwin.hxx
@@ -201,6 +201,18 @@ public:
BOOL bPropGreat = FALSE );
void SetItemSize( USHORT nId, long nNewSize );
long GetItemSize( USHORT nId ) const;
+ /** Set a range that limits the (variable part of the) size with an
+ upper and a lower bound (both are valid values themselves.)
+ @param nId
+ Id of the item for which the size limits are set.
+ @param aRange
+ Values of -1 define missing bounds, thus setting a range (-1,-1)
+ (the default) removes the size limitiation.
+ */
+ void SetItemSizeRange (USHORT nId, const Range aRange);
+ /** Return the current size limits for the specified item.
+ */
+ Range GetItemSizeRange (USHORT nId) const;
long GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const;
void SetItemBits( USHORT nId, SplitWindowItemBits nNewBits );
SplitWindowItemBits GetItemBits( USHORT nId ) const;
diff --git a/vcl/inc/vcl/status.hxx b/vcl/inc/vcl/status.hxx
index 810ecf230960..907d08272cbb 100644
--- a/vcl/inc/vcl/status.hxx
+++ b/vcl/inc/vcl/status.hxx
@@ -183,8 +183,8 @@ public:
using Window::GetQuickHelpText;
const XubString& GetQuickHelpText( USHORT nItemId ) const;
- void SetHelpId( USHORT nItemId, ULONG nHelpId );
- ULONG GetHelpId( USHORT nItemId ) const;
+ void SetHelpId( USHORT nItemId, const rtl::OString& rHelpId );
+ rtl::OString GetHelpId( USHORT nItemId ) const;
void SetBottomBorder( BOOL bBottomBorder = TRUE );
BOOL IsBottomBorder() const { return mbBottomBorder; }
@@ -205,9 +205,9 @@ public:
const XubString& GetHelpText() const
{ return Window::GetHelpText(); }
- void SetHelpId( ULONG nId )
- { Window::SetHelpId( nId ); }
- ULONG GetHelpId() const
+ void SetHelpId( const rtl::OString& rId )
+ { Window::SetHelpId( rId ); }
+ const rtl::OString& GetHelpId() const
{ return Window::GetHelpId(); }
Size CalcWindowSizePixel() const;
diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx
index 9787b1f6e58c..67aa6806be49 100644
--- a/vcl/inc/vcl/svdata.hxx
+++ b/vcl/inc/vcl/svdata.hxx
@@ -28,20 +28,19 @@
#ifndef _SV_SVDATA_HXX
#define _SV_SVDATA_HXX
-#ifndef _VOS_THREAD_HXX
-#include <vos/thread.hxx>
-#endif
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-#include <tools/shl.hxx>
-#include <tools/link.hxx>
-#include <vcl/vclevent.hxx>
-#include <vcl/sv.h>
-#include <tools/color.hxx>
-#include <tools/debug.hxx>
-#include <vcl/dllapi.h>
-#include <com/sun/star/uno/Reference.hxx>
-#include <unotools/options.hxx>
+#include "vos/thread.hxx"
+#include "tools/string.hxx"
+#include "tools/gen.hxx"
+#include "tools/shl.hxx"
+#include "tools/link.hxx"
+#include "tools/fldunit.hxx"
+#include "vcl/vclevent.hxx"
+#include "vcl/sv.h"
+#include "tools/color.hxx"
+#include "tools/debug.hxx"
+#include "vcl/dllapi.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "unotools/options.hxx"
namespace com {
namespace sun {
@@ -168,6 +167,8 @@ struct ImplSVAppData
BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet
BOOL mbNoYield; // Application::Yield will not wait for events if the queue is empty
// essentially that makes it the same as Application::Reschedule
+ long mnDefaultLayoutBorder; // default value in pixel for layout distances used
+ // in window arrangers
/** Controls whether showing any IME status window is toggled on or off.
@@ -208,7 +209,6 @@ struct ImplSVGDIData
BOOL mbFontSubChanged; // TRUE: FontSubstitution wurde zwischen Begin/End geaendert
utl::DefaultFontConfiguration* mpDefaultFontConfiguration;
utl::FontSubstConfiguration* mpFontSubstConfiguration;
- bool mbPrinterPullModel; // true: use pull model instead of normal push model when printing
bool mbNativeFontConfig; // true: do not override UI font
bool mbNoXORClipping; // true: do not use XOR to achieve clipping effects
};
@@ -248,6 +248,8 @@ struct ImplSVWinData
// - ImplSVCtrlData -
// ------------------
+typedef std::vector< std::pair< String, FieldUnit > > FieldUnitStringList;
+
struct ImplSVCtrlData
{
ImageList* mpCheckImgList; // ImageList for CheckBoxes
@@ -271,6 +273,8 @@ struct ImplSVCtrlData
ULONG mnLastRadioFColor; // Letzte FaceColor fuer RadioImage
ULONG mnLastRadioWColor; // Letzte WindowColor fuer RadioImage
ULONG mnLastRadioLColor; // Letzte LightColor fuer RadioImage
+ FieldUnitStringList* mpFieldUnitStrings; // list with field units
+ FieldUnitStringList* mpCleanUnitStrings; // same list but with some "fluff" like spaces removed
};
@@ -318,10 +322,8 @@ struct ImplSVNWFData
// window background before drawing the native
// checkbox
bool mbScrollbarJumpPage; // true for "jump to here" behavior
+ int mnStatusBarLowerRightOffset; // amount in pixel to avoid in the lower righthand corner
bool mbCanDrawWidgetAnySize; // set to true currently on gtk
- // signals that widgets can be drawn in any size and
- // brdwin.cxx ImplSmallBorderWindowView::DrawWindow
- // should not do GetNativeControlRegion
};
@@ -395,6 +397,10 @@ inline ImplSVData* ImplGetAppSVData() { return ImplGetSVData(); }
bool ImplInitAccessBridge( BOOL bAllowCancel, BOOL &rCancelled );
+FieldUnitStringList* ImplGetFieldUnits();
+FieldUnitStringList* ImplGetCleanedFieldUnits();
+
+
// -----------------------------------------------------------------------
// -----------------
diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc
index 059ed1524b7c..e915644aa8ec 100644
--- a/vcl/inc/vcl/svids.hrc
+++ b/vcl/inc/vcl/svids.hrc
@@ -122,8 +122,10 @@
#define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1
#define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2
-#define SV_PRINT_PRT_NUP_ORDER_LRTD 0
-#define SV_PRINT_PRT_NUP_ORDER_TDLR 1
+#define SV_PRINT_PRT_NUP_ORDER_LRTB 0
+#define SV_PRINT_PRT_NUP_ORDER_TBLR 1
+#define SV_PRINT_PRT_NUP_ORDER_TBRL 2
+#define SV_PRINT_PRT_NUP_ORDER_RLTB 3
#define SV_PRINT_TAB_JOB 2
#define SV_PRINT_PRINTERS_FL 1
@@ -212,7 +214,8 @@
#define SV_ACCESSERROR_JAVA_NOT_CONFIGURED 10507
#define SV_ACCESSERROR_JAVA_DISABLED 10508
#define SV_ACCESSERROR_TURNAROUND_MSG 10509
-#define SV_ACCESSERROR_LAST SV_ACCESSERROR_TURNAROUND_MSG
+#define SV_ACCESSERROR_NO_FONTS 10510
+#define SV_ACCESSERROR_LAST SV_ACCESSERROR_NO_FONTS
#define SV_SHORTCUT_HELP 10600
#define SV_SHORTCUT_CONTEXTHELP 10601
diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx
index da4ffcd51a22..e914adbdffed 100644
--- a/vcl/inc/vcl/syschild.hxx
+++ b/vcl/inc/vcl/syschild.hxx
@@ -44,6 +44,7 @@ class VCL_DLLPUBLIC SystemChildWindow : public Window
private:
using Window::ImplInit;
SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = FALSE );
+ SAL_DLLPRIVATE void ImplTestJavaException( void* pEnv );
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE SystemChildWindow (const SystemChildWindow &);
@@ -62,6 +63,11 @@ public:
// however, this might not always be required
void EnableEraseBackground( BOOL bEnable = TRUE );
BOOL IsEraseBackgroundEnabled();
+
+ // return the platform specific handle/id of this window;
+ // in case the flag bUseJava is set, a java compatible overlay window
+ // is created on which other java windows can be created (plugin interface)
+ sal_IntPtr GetParentWindowHandle( sal_Bool bUseJava = sal_False );
};
#endif // _SV_SYSCHILD_HXX
diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 4c63b12f15fe..ad702ac4dc54 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -70,7 +70,6 @@ private:
BOOL mbRestoreUnqId;
BOOL mbSingleLine;
BOOL mbScroll;
- BOOL mbRestoreSmartId;
BOOL mbSmallInvalidate;
BOOL mbExtraSpace;
Link maActivateHdl;
@@ -177,8 +176,8 @@ public:
void SetHelpText( USHORT nPageId, const XubString& rText );
const XubString& GetHelpText( USHORT nPageId ) const;
- void SetHelpId( USHORT nPageId, ULONG nHelpId );
- ULONG GetHelpId( USHORT nPageId ) const;
+ void SetHelpId( USHORT nPageId, const rtl::OString& rHelpId );
+ rtl::OString GetHelpId( USHORT nPageId ) const;
void SetPageImage( USHORT nPageId, const Image& rImage );
const Image* GetPageImage( USHORT nPageId ) const;
@@ -188,9 +187,9 @@ public:
const XubString& GetHelpText() const
{ return Control::GetHelpText(); }
- void SetHelpId( ULONG nId )
- { Control::SetHelpId( nId ); }
- ULONG GetHelpId() const
+ void SetHelpId( const rtl::OString& rId )
+ { Control::SetHelpId( rId ); }
+ const rtl::OString& GetHelpId() const
{ return Control::GetHelpId(); }
void SetActivatePageHdl( const Link& rLink ) { maActivateHdl = rLink; }
diff --git a/vcl/inc/vcl/toolbox.h b/vcl/inc/vcl/toolbox.h
index 33e4e8d2e013..7cdeb0b17a5a 100644
--- a/vcl/inc/vcl/toolbox.h
+++ b/vcl/inc/vcl/toolbox.h
@@ -68,7 +68,7 @@ struct ImplToolItem
XubString maQuickHelpText;
XubString maHelpText;
String maCommandStr;
- ULONG mnHelpId;
+ rtl::OString maHelpId;
Rectangle maRect;
Rectangle maCalcRect;
// the overall horizontal item size, including one or more of [image size + textlength + dropdown arrow]
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 5cc102842dc3..aa7ddd886bbb 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -511,8 +511,8 @@ public:
void SetHelpText( USHORT nItemId, const XubString& rText );
const XubString& GetHelpText( USHORT nItemId ) const;
- void SetHelpId( USHORT nItemId, ULONG nHelpId );
- ULONG GetHelpId( USHORT nItemId ) const;
+ void SetHelpId( USHORT nItemId, const rtl::OString& rHelpId );
+ rtl::OString GetHelpId( USHORT nItemId ) const;
// window size according to current alignment, floating state and number of lines
Size CalcWindowSizePixel() const;
@@ -569,9 +569,9 @@ public:
const XubString& GetHelpText() const
{ return DockingWindow::GetHelpText(); }
- void SetHelpId( ULONG nId )
- { DockingWindow::SetHelpId( nId ); }
- ULONG GetHelpId() const
+ void SetHelpId( const rtl::OString& rId )
+ { DockingWindow::SetHelpId( rId ); }
+ const rtl::OString& GetHelpId() const
{ return DockingWindow::GetHelpId(); }
void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h
index c12dcd618d92..73b6f1078ca9 100644
--- a/vcl/inc/vcl/window.h
+++ b/vcl/inc/vcl/window.h
@@ -56,7 +56,7 @@ class VirtualDevice;
class Cursor;
class ImplDevFontList;
class ImplFontCache;
-class SmartId;
+class SalControlHandle;
class VCLXWindow;
class SalFrame;
class SalObject;
@@ -99,7 +99,10 @@ namespace dnd {
class XDropTarget;
} } } } }
-namespace vcl { struct ControlLayoutData; }
+namespace vcl {
+ struct ControlLayoutData;
+ struct ExtWindowImpl;
+}
@@ -120,8 +123,6 @@ struct ImplWinData
USHORT mnIsTopWindow;
BOOL mbMouseOver; // tracks mouse over for native widget paint effect
BOOL mbEnableNativeWidget; // toggle native widget rendering
- SmartId* mpSmartHelpId;
- SmartId* mpSmartUniqueId;
::std::list< Window* >
maTopWindowChildren;
};
@@ -239,6 +240,7 @@ public:
ImplDelData* mpFirstDel;
void* mpUserData;
+ vcl::ExtWindowImpl* mpExtImpl;
Cursor* mpCursor;
Pointer maPointer;
Fraction maZoom;
@@ -254,8 +256,8 @@ public:
long mnY;
long mnAbsScreenX;
Point maPos;
- ULONG mnHelpId;
- ULONG mnUniqId;
+ rtl::OString maHelpId;
+ rtl::OString maUniqId;
XubString maHelpText;
XubString maQuickHelpText;
InputContext maInputContext;
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index a7628da0b408..fa136f6d514d 100644..100755
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -50,7 +50,7 @@
#include <rtl/ustring.hxx>
#include <cppuhelper/weakref.hxx>
#include <com/sun/star/uno/Reference.hxx>
-#include <vcl/smartid.hxx>
+#include <boost/shared_ptr.hpp>
class VirtualDevice;
struct ImplDelData;
@@ -95,6 +95,13 @@ namespace accessibility {
namespace com {
namespace sun {
namespace star {
+namespace beans {
+ struct PropertyValue;
+}}}}
+
+namespace com {
+namespace sun {
+namespace star {
namespace rendering {
class XCanvas;
class XSpriteCanvas;
@@ -122,7 +129,11 @@ namespace dnd {
class XDropTarget;
} } } } }
-namespace vcl { struct ControlLayoutData; }
+namespace vcl {
+ struct ControlLayoutData;
+ class WindowArranger;
+ struct ExtWindowImpl;
+}
namespace svt { class PopupWindowControllerImpl; }
@@ -476,6 +487,10 @@ public:
SAL_DLLPRIVATE BOOL ImplUpdatePos();
SAL_DLLPRIVATE void ImplUpdateSysObjPos();
SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl; }
+ SAL_DLLPRIVATE void ImplFreeExtWindowImpl();
+ // creates ExtWindowImpl on demand, but may return NULL (e.g. if mbInDtor)
+ SAL_DLLPRIVATE vcl::ExtWindowImpl* ImplGetExtWindowImpl() const;
+ SAL_DLLPRIVATE void ImplDeleteOwnedChildren();
/** check whether a font is suitable for UI
The font to be tested will be checked whether it could display a
@@ -541,6 +556,7 @@ public:
SAL_DLLPRIVATE BOOL ImplRegisterAccessibleNativeFrame();
SAL_DLLPRIVATE void ImplRevokeAccessibleNativeFrame();
SAL_DLLPRIVATE void ImplCallResize();
+ SAL_DLLPRIVATE void ImplExtResize();
SAL_DLLPRIVATE void ImplCallMove();
SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const;
SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
@@ -599,6 +615,7 @@ public:
virtual void KeyUp( const KeyEvent& rKEvt );
virtual void PrePaint();
virtual void Paint( const Rectangle& rRect );
+ virtual void PostPaint();
virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, ULONG nFlags );
virtual void Move();
virtual void Resize();
@@ -953,16 +970,12 @@ public:
void SetQuickHelpText( const XubString& rHelpText );
const XubString& GetQuickHelpText() const;
- void SetHelpId( ULONG nHelpId ); /// deprecated
- ULONG GetHelpId() const; /// deprecated
- void SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode = SMART_SET_SMART );
- SmartId GetSmartHelpId() const;
+ void SetHelpId( const rtl::OString& );
+ const rtl::OString& GetHelpId() const;
- void SetUniqueId( ULONG nUniqueId ); /// deprecated
- ULONG GetUniqueId() const; /// deprecated
- void SetSmartUniqueId( const SmartId& aId, SmartIdUpdateMode aMode = SMART_SET_SMART );
- SmartId GetSmartUniqueId() const;
- SmartId GetSmartUniqueOrHelpId() const;
+ void SetUniqueId( const rtl::OString& );
+ const rtl::OString& GetUniqueId() const;
+ const rtl::OString& GetUniqueOrHelpId() const;
Window* FindWindow( const Point& rPos ) const;
@@ -1106,6 +1119,56 @@ public:
virtual XubString GetSurroundingText() const;
virtual Selection GetSurroundingTextSelection() const;
+
+ // ExtImpl
+
+ // layouting
+ boost::shared_ptr< vcl::WindowArranger > getLayout();
+
+ /* add a child Window
+ addWindow will do the following things
+ - insert the passed window into the child list (equivalent to i_pWin->SetParent( this ))
+ - mark the window as "owned", meaning that the added Window will be destroyed by
+ the parent's desctructor.
+ This means: do not pass in member windows or stack objects here. Do not cause
+ the destructor of the added window to be called in any way.
+
+ to avoid ownership pass i_bTakeOwnership as "false"
+ */
+ void addWindow( Window* i_pWin, bool i_bTakeOwnership = true );
+
+ /* remove a child Window
+ the remove window functions will
+ - reparent the searched window (equivalent to i_pWin->SetParent( i_pNewParent ))
+ - return a pointer to the removed window or NULL if i_pWin was not found
+ caution: ownership passes to the new parent or the caller, if the new parent was NULL
+ */
+ Window* removeWindow( Window* i_pWin, Window* i_pNewParent = NULL );
+
+ /* return the identifier of this window
+ */
+ const rtl::OUString& getIdentifier() const;
+ /* set an identifier
+ identifiers have only loosely defined rules per se
+ in context of Window they must be unique over the window
+ hierarchy you'd like to find them again using the findWindow method
+ */
+ void setIdentifier( const rtl::OUString& );
+
+ /* returns the first found descendant that matches
+ the passed identifier or NULL
+ */
+ Window* findWindow( const rtl::OUString& ) const;
+
+ /* get/set properties
+ this will contain window properties (like visible, enabled)
+ as well as properties of derived classes (e.g. text of Edit fields)
+ */
+ virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getProperties() const;
+ /*
+ */
+ virtual void setProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& );
+
};
diff --git a/vcl/inc/vcl/wpropset.hxx b/vcl/inc/vcl/wpropset.hxx
new file mode 100644
index 000000000000..409b629496e6
--- /dev/null
+++ b/vcl/inc/vcl/wpropset.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef VCL_WPROPSET_HXX
+#define VCL_WPROPSET_HXX
+
+#include "vcl/dllapi.h"
+
+#include "tools/link.hxx"
+#include "vcl/arrange.hxx"
+
+#include "com/sun/star/beans/XPropertySet.hpp"
+
+class VclWindowEvent;
+
+namespace vcl
+{
+ class WindowPropertySetData;
+ class WindowPropertySetListener;
+
+ class VCL_DLLPUBLIC WindowPropertySet
+ {
+ WindowPropertySetData* mpImpl;
+
+ void addWindowToSet( Window* );
+ void addLayoutToSet( const boost::shared_ptr<WindowArranger>& );
+ void setupProperties();
+
+ DECL_LINK( ChildEventListener, VclWindowEvent* );
+
+ void propertyChange( const com::sun::star::beans::PropertyChangeEvent& );
+ friend class vcl::WindowPropertySetListener;
+
+ public:
+ WindowPropertySet( Window* i_pTopWindow, bool i_bTakeOwnership );
+ ~WindowPropertySet();
+
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getPropertySet() const;
+ };
+}
+
+#endif
diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h
index cf05ff15d7e2..94b2b98b4183 100644
--- a/vcl/os2/inc/salgdi.h
+++ b/vcl/os2/inc/salgdi.h
@@ -74,7 +74,7 @@ public:
bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; }
bool AliasSymbolsLow() const { return mbAliasSymbolsLow; }
- ImplFontCharMap* GetImplFontCharMap() const;
+ const ImplFontCharMap* GetImplFontCharMap() const;
private:
sal_IntPtr mnId;
@@ -82,7 +82,7 @@ private:
mutable bool mbHasKoreanRange;
mutable bool mbHasCJKSupport;
- mutable ImplFontCharMap* mpUnicodeMap;
+ mutable const ImplFontCharMap* mpUnicodeMap;
// TODO: get rid of the members below needed to work with the Win9x non-unicode API
BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning)
diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h
index 0948f605c286..7826a62e1f9b 100644
--- a/vcl/os2/inc/salinst.h
+++ b/vcl/os2/inc/salinst.h
@@ -85,12 +85,9 @@ public:
virtual vos::IMutex* GetYieldMutex();
virtual ULONG ReleaseYieldMutex();
virtual void AcquireYieldMutex( ULONG nCount );
+ virtual bool CheckYieldMutex();
virtual void Yield( bool, bool );
virtual bool AnyInput( USHORT nType );
- virtual SalMenu* CreateMenu( BOOL bMenuBar );
- virtual void DestroyMenu( SalMenu* );
- virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
- virtual void DestroyMenuItem( SalMenuItem* );
virtual SalSession* CreateSalSession();
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx
index b08a9769ccf4..df564f36ee0a 100644
--- a/vcl/os2/source/app/salinst.cxx
+++ b/vcl/os2/source/app/salinst.cxx
@@ -298,10 +298,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount )
// -----------------------------------------------------------------------
-#ifdef DBG_UTIL
-
-void ImplDbgTestSolarMutex()
+bool Os2SalInstance::CheckYieldMutex()
{
+ bool bRet = true;
SalData* pSalData = GetSalData();
ULONG nCurThreadId = GetCurrentThreadId();
if ( pSalData->mnAppThreadId != nCurThreadId )
@@ -311,7 +310,7 @@ void ImplDbgTestSolarMutex()
SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex;
if ( pYieldMutex->mnThreadId != nCurThreadId )
{
- DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ bRet = false;
}
}
}
@@ -322,14 +321,13 @@ void ImplDbgTestSolarMutex()
SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex;
if ( pYieldMutex->mnThreadId != nCurThreadId )
{
- DBG_ERROR( "SolarMutex not locked in the main thread" );
+ bRet = false;
}
}
}
+ return bRet;
}
-#endif
-
// =======================================================================
void InitSalData()
diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx
index e25e68ee5a4c..0e4cb1d58b0f 100644
--- a/vcl/os2/source/gdi/salgdi3.cxx
+++ b/vcl/os2/source/gdi/salgdi3.cxx
@@ -434,9 +434,8 @@ bool ImplOs2FontData::IsGSUBstituted( sal_Ucs cChar ) const
// -----------------------------------------------------------------------
-ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const
+const ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const
{
- mpUnicodeMap->AddReference();
return mpUnicodeMap;
}
@@ -592,6 +591,7 @@ void ImplOs2FontData::ReadCmapTable( HPS hPS ) const
aResult.mpPairCodes, aResult.mpStartGlyphs );
else
mpUnicodeMap = ImplFontCharMap::GetDefaultMap();
+ mpUnicodeMap->AddReference();
}
// =======================================================================
@@ -999,10 +999,10 @@ ULONG Os2SalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs )
// -----------------------------------------------------------------------
-static ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL;
+static const ImplFontCharMap* pOs2DefaultImplFontCharMap = NULL;
static const sal_uInt32 pOs2DefaultRangeCodes[] = {0x0020,0x00FF};
-ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const
{
if( !mpOs2FontData[0] )
return ImplFontCharMap::GetDefaultMap();
@@ -1705,7 +1705,7 @@ void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont,
rUnicodeEnc.clear();
}
const ImplOs2FontData* pWinFont = static_cast<const ImplOs2FontData*>(pFont);
- ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap();
+ const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap();
DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" );
int nCharCount = pMap->GetCharCount();
diff --git a/vcl/os2/source/window/makefile.mk b/vcl/os2/source/window/makefile.mk
index f4a6ad0cb870..560d35880b21 100644
--- a/vcl/os2/source/window/makefile.mk
+++ b/vcl/os2/source/window/makefile.mk
@@ -40,7 +40,7 @@ CXXFILES__YD= salframe.cxx \
salobj.cxx
SLOFILES= $(SLO)$/salframe.obj \
- $(SLO)$/salobj.obj $(SLO)$/salmenu.obj
+ $(SLO)$/salobj.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/os2/source/window/salmenu.cxx b/vcl/os2/source/window/salmenu.cxx
deleted file mode 100644
index 339ab5dbfadb..000000000000
--- a/vcl/os2/source/window/salmenu.cxx
+++ /dev/null
@@ -1,132 +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.
- *
- ************************************************************************/
-
-#define INCL_DOS
-#define INCL_PM
-#define INCL_WIN
-#include <svpm.h>
-#include <saldata.hxx>
-#include <salinst.h>
-#include <salmenu.h>
-
-
-// =======================================================================
-
-// Os2SalInst factory methods
-
-SalMenu* Os2SalInstance::CreateMenu( BOOL bMenuBar )
-{
- return NULL; // no support for native menues
-}
-
-void Os2SalInstance::DestroyMenu( SalMenu* pSalMenu )
-{
- delete pSalMenu;
-}
-
-
-SalMenuItem* Os2SalInstance::CreateMenuItem( const SalItemParams* pItemData )
-{
- return NULL; // no support for native menues
-}
-
-void Os2SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem )
-{
- delete pSalMenuItem;
-}
-
-
-// =======================================================================
-
-
-/*
- * Os2SalMenu
- */
-
-
-Os2SalMenu::~Os2SalMenu()
-{
-}
-
-BOOL Os2SalMenu::VisibleMenuBar()
-{
- return FALSE;
-}
-
-void Os2SalMenu::SetFrame( const SalFrame *pFrame )
-{
-}
-
-void Os2SalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
-{
-}
-
-void Os2SalMenu::RemoveItem( unsigned nPos )
-{
-}
-
-void Os2SalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
-{
-}
-
-void Os2SalMenu::CheckItem( unsigned nPos, BOOL bCheck )
-{
-}
-
-void Os2SalMenu::EnableItem( unsigned nPos, BOOL bEnable )
-{
-}
-
-void Os2SalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage )
-{
-}
-
-void Os2SalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText )
-{
-}
-
-void Os2SalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName )
-{
-}
-
-void Os2SalMenu::GetSystemMenuData( SystemMenuData* pData )
-{
-}
-
-// =======================================================================
-
-/*
- * SalMenuItem
- */
-
-
-Os2SalMenuItem::~Os2SalMenuItem()
-{
-}
-
-// -------------------------------------------------------------------
-
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index e6f636522acb..0a6f6a95f605 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -48,3 +48,10 @@ vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL
vc vcl\util nmake - all vc_util vc__plug.u vc__desk.u vc__aquy.u vc__appa.u vc__dtra.u vc__appm.m vc__appu.u vc__dtru.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL
vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL
vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL
+
+# memCheck works only within unix
+# memCheck is not right yet
+# vc vcl\qa\complex\memCheck nmake - u vc_qa_complex vc_util NULL
+# GPF
+# vc vcl\qa\complex\persistent_window_states nmake - all vc_qa_complex vc_util NULL
+
diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst
index 38c025b5a5af..6d452e8ee43f 100644
--- a/vcl/prj/d.lst
+++ b/vcl/prj/d.lst
@@ -17,6 +17,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\alpha.hxx %_DEST%\inc%_EXT%\vcl\alpha.hxx
..\inc\vcl\animate.hxx %_DEST%\inc%_EXT%\vcl\animate.hxx
..\inc\vcl\apptypes.hxx %_DEST%\inc%_EXT%\vcl\apptypes.hxx
+..\inc\vcl\arrange.hxx %_DEST%\inc%_EXT%\vcl\arrange.hxx
..\inc\vcl\bitmap.hxx %_DEST%\inc%_EXT%\vcl\bitmap.hxx
..\inc\vcl\bitmapex.hxx %_DEST%\inc%_EXT%\vcl\bitmapex.hxx
..\inc\vcl\bmpacc.hxx %_DEST%\inc%_EXT%\vcl\bmpacc.hxx
@@ -77,6 +78,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\metric.hxx %_DEST%\inc%_EXT%\vcl\metric.hxx
..\inc\vcl\mnemonic.hxx %_DEST%\inc%_EXT%\vcl\mnemonic.hxx
..\inc\vcl\mnemonicengine.hxx %_DEST%\inc%_EXT%\vcl\mnemonicengine.hxx
+..\inc\vcl\quickselectionengine.hxx %_DEST%\inc%_EXT%\vcl\quickselectionengine.hxx
..\inc\vcl\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx
..\inc\vcl\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx
..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx
@@ -143,7 +145,6 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\pdfextoutdevdata.hxx %_DEST%\inc%_EXT%\vcl\pdfextoutdevdata.hxx
..\inc\vcl\pngread.hxx %_DEST%\inc%_EXT%\vcl\pngread.hxx
..\inc\vcl\pngwrite.hxx %_DEST%\inc%_EXT%\vcl\pngwrite.hxx
-..\inc\vcl\smartid.hxx %_DEST%\inc%_EXT%\vcl\smartid.hxx
..\inc\vcl\configsettings.hxx %_DEST%\inc%_EXT%\vcl\configsettings.hxx
..\inc\vcl\ImageListProvider.hxx %_DEST%\inc%_EXT%\vcl\ImageListProvider.hxx
..\inc\vcl\fontmanager.hxx %_DEST%\inc%_EXT%\vcl\fontmanager.hxx
@@ -153,3 +154,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\inc\vcl\helper.hxx %_DEST%\inc%_EXT%\vcl\helper.hxx
..\inc\vcl\strhelper.hxx %_DEST%\inc%_EXT%\vcl\strhelper.hxx
..\inc\vcl\lazydelete.hxx %_DEST%\inc%_EXT%\vcl\lazydelete.hxx
+..\inc\vcl\arrange.hxx %_DEST%\inc%_EXT%\vcl\arrange.hxx
+..\inc\vcl\wpropset.hxx %_DEST%\inc%_EXT%\vcl\wpropset.hxx
+..\%__SRC%\misc\vcl.component %_DEST%\xml%_EXT%\vcl.component
+
diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.java b/vcl/qa/complex/memCheck/CheckMemoryUsage.java
index 9f8272240403..a089a1c99f54 100644
--- a/vcl/qa/complex/memCheck/CheckMemoryUsage.java
+++ b/vcl/qa/complex/memCheck/CheckMemoryUsage.java
@@ -32,19 +32,27 @@ import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.XCloseable;
-import complexlib.ComplexTestCase;
+// import complexlib.ComplexTestCase;
import helper.ProcessHandler;
import java.io.File;
-import java.io.FilePermission;
+// import java.io.FilePermission;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;
+import lib.*;
import util.DesktopTools;
-import util.WriterTools;
-import util.utils;
+// import util.WriterTools;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
/**
* Documents are opened and exported with StarOffice. The memory usage of
@@ -66,95 +74,141 @@ import util.utils;
* All parameters are used for iteration over the test document path.
* </ul>
*/
-public class CheckMemoryUsage extends ComplexTestCase {
+class TempDir
+{
+
+ private String m_sTempDir;
+
+ public TempDir(String _sTempDir)
+ {
+ m_sTempDir = _sTempDir;
+ }
+
+ public String getOfficeTempDir()
+ {
+ return m_sTempDir;
+ }
+
+ public String getTempDir()
+ {
+ final String sTempDir = FileHelper.getJavaCompatibleFilename(m_sTempDir);
+ return sTempDir;
+ }
+}
+
+public class CheckMemoryUsage /* extends ComplexTestCase */
+
+{
+
private final String sWriterDoc = "sxw,writer_pdf_Export";
private final String sCalcDoc = "sxc,calc_pdf_Export";
private final String sImpressDoc = "sxi,impress_pdf_Export";
- private String sProcessId = "ps -ef | grep $USER | grep soffice | grep -v grep";
- private String sMemoryMonitor = "pmap <processID> | grep total";
- private String sChmod = "chmod 777 ";
- private String sProcessIdCommand = null;
- private String sOfficeMemoryCommand = null;
- private String sTempDir = null;
- private String sFS = null;
- private String sMemoryMap1 = null;
- private String sMemoryMap2 = null;
- private String bash = "#!/bin/bash";
- private String sDocumentPath = "";
+ // private String sProcessIdCommand = null;
+ TempDir m_aTempDir;
+ // private String sFS = null;
+ // private String sMemoryMap1 = null;
+ // private String sMemoryMap2 = null;
+ // private String sDocumentPath = "";
private String[][] sDocTypeExportFilter;
private String[][] sDocuments;
private int iAllowMemoryIncrease = 10;
private int iExportDocCount = 25;
+ /**
+ * The test parameters
+ */
+ private static TestParameters param = null;
/**
* Get all test methods
* @return The test methods.
- */
- public String[] getTestMethodNames() {
- return new String[] {"loadAndSaveDocuments"};
- }
-
+ // */
+// public String[] getTestMethodNames() {
+// return new String[] {"loadAndSaveDocuments"};
+// }
/**
* Collect all documnets to load and all filters used for export.
*/
- public void before() {
+ @Before
+ public void before()
+ {
+
+ final XMultiServiceFactory xMsf = getMSF();
+
+ // some Tests need the qadevOOo TestParameters, it is like a Hashmap for Properties.
+ param = new TestParameters();
+ param.put("ServiceFactory", xMsf); // some qadevOOo functions need the ServiceFactory
+
// test does definitely not run on Windows.
- if (param.get("OperatingSystem").equals("wntmsci")) {
- log.println("Test can only reasonably be executed with a tool that "
- + "displays the memory usage of StarOffice.");
- failed("Test does not run on Windows, only on Solaris or Linux.");
+ if (param.get("OperatingSystem").equals("wntmsci"))
+ {
+ System.out.println("Test can only reasonably be executed with a tool that "
+ + "displays the memory usage of StarOffice.");
+ System.out.println("Test does not run on Windows, only on Solaris or Linux.");
+ // in an automatic environment it is better to say, there is no error here.
+ // it is a limitation, but no error.
+ System.exit(0);
}
+
// how many times is every document exported.
int count = param.getInt("ExportDocCount");
if (count != 0)
+ {
iExportDocCount = count;
+ }
// get the temp dir for creating the command scripts.
- sTempDir = System.getProperty("java.io.tmpdir");
- sProcessIdCommand = sTempDir + "getPS";
- sOfficeMemoryCommand = sTempDir + "getPmap";
+ // sTempDir = System.getProperty("java.io.tmpdir");
+ m_aTempDir = new TempDir(util.utils.getOfficeTemp/*Dir*/(xMsf));
// get the file extension, export filter connection
Enumeration keys = param.keys();
- Vector v = new Vector();
- while(keys.hasMoreElements()) {
- String key = (String)keys.nextElement();
- if (key.startsWith("FileExportFilter")) {
- v.add(param.get(key));
+ Vector<String> v = new Vector<String>();
+ while (keys.hasMoreElements())
+ {
+ String key = (String) keys.nextElement();
+ if (key.startsWith("FileExportFilter"))
+ {
+ v.add((String) param.get(key));
}
}
// if no param given, set defaults.
- if (v.size() == 0){
+ if (v.size() == 0)
+ {
v.add(sWriterDoc);
v.add(sCalcDoc);
v.add(sImpressDoc);
}
// store a file extension
sDocTypeExportFilter = new String[v.size()][2];
- for (int i=0; i<v.size(); i++) {
+ for (int i = 0; i < v.size(); i++)
+ {
// 2do: error routine for wrong given params
- StringTokenizer t = new StringTokenizer((String)v.get(i), ",");
- sDocTypeExportFilter[i][0] = t.nextToken();
- sDocTypeExportFilter[i][1] = t.nextToken();
+ final String sVContent = v.get(i);
+ StringTokenizer t = new StringTokenizer(sVContent, ",");
+ final String sExt = t.nextToken();
+ final String sName = t.nextToken();
+ sDocTypeExportFilter[i][0] = sExt;
+ sDocTypeExportFilter[i][1] = sName;
}
// get files to load and export
- sDocumentPath = (String)param.get("TestDocumentPath");
- File f = new File(sDocumentPath);
- sDocumentPath = f.getAbsolutePath();
- String sFS = System.getProperty("file.separator");
+// sDocumentPath = (String) param.get("TestDocumentPath");
+ String sDocumentPath = TestDocument.getUrl();
+ File f = new File(FileHelper.getJavaCompatibleFilename(sDocumentPath));
+ // sDocumentPath = f.getAbsolutePath();
+ // String sFS = System.getProperty("file.separator");
sDocuments = new String[sDocTypeExportFilter.length][];
- for (int j=0; j<sDocTypeExportFilter.length; j++) {
+ for (int j = 0; j < sDocTypeExportFilter.length; j++)
+ {
FileFilter filter = new FileFilter(sDocTypeExportFilter[j][0]);
String[] doc = f.list(filter);
sDocuments[j] = new String[doc.length];
- for (int i=0; i<doc.length; i++) {
- if (sDocumentPath.endsWith(sFS))
- sDocuments[j][i] = sDocumentPath + doc[i];
- else
- sDocuments[j][i] = sDocumentPath + sFS + doc[i];
- sDocuments[j][i] = utils.getFullURL(sDocuments[j][i]);
+ for (int i = 0; i < doc.length; i++)
+ {
+ // final String sDocument = FileHelper.appendPath(sDocumentPath, doc[i]);
+ // sDocuments[j][i] = utils.getFullURL(sDocuments[j][i]);
+ sDocuments[j][i] = TestDocument.getUrl(doc[i]);
}
}
}
@@ -162,141 +216,323 @@ public class CheckMemoryUsage extends ComplexTestCase {
/**
* delete all created files on disk
*/
- public void after() {
+ @After
+ public void after()
+ {
// delete the constructed files.
- for (int i=0; i<iExportDocCount; i++) {
- File f = new File(sTempDir + "DocExport" + i + ".pdf");
- f.delete();
- }
- File f = new File(sProcessIdCommand);
- f.delete();
- f = new File(sOfficeMemoryCommand);
- f.delete();
+// we don't need to delete anything, all is stored in $USER_TREE
+// for (int i = 0; i < iExportDocCount; i++)
+// {
+// final String sDocumentName = "DocExport" + i + ".pdf";
+// final String sFilename = FileHelper.appendPath(m_sTempDir, sDocumentName);
+// File f = new File(FileHelper.getJavaCompatibleFilename(sFilename));
+// f.delete();
+// }
+ // File f = new File(sProcessIdCommand);
+ // f.delete();
+ // f = new File(sOfficeMemoryCommand);
+ // f.delete();
}
/**
- * Thet etst function: load documents and save them using the given filters
+ * The test function: load documents and save them using the given filters
* for each given document type.
*/
- public void loadAndSaveDocuments() {
- int storageBefore = getOfficeMemoryUsage();
+ @Test
+ public void loadAndSaveDocuments()
+ {
+ int nOk = 0;
+ int nRunThrough = 0;
- XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF();
+ // At first:
+ // we load the document, there will be some post work in office like late initialisations
+ // we store exact one time the document
+ // so the memory footprint should be right
// iterate over all document types
- for (int k=0; k<sDocTypeExportFilter.length; k++) {
+ for (int k = 0; k < sDocTypeExportFilter.length; k++)
+ {
// iterate over all documents of this type
- for (int i=0; i<sDocuments[k].length; i++) {
- System.out.println("Document: "+ sDocuments[k][i]);
- XComponent xComponent = DesktopTools.loadDoc(xMSF, sDocuments[k][i], null);
- XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, xComponent);
- if (xStorable != null) {
- // export each document iExportDocCount times
- for (int j=0; j<iExportDocCount; j++) {
- String url = utils.getFullURL(sTempDir + "DocExport" + j + ".pdf");
- try {
- PropertyValue[] props = new PropertyValue[1];
- props[0] = new PropertyValue();
- props[0].Name = "FilterName";
- // use export filter for this doc type
- props[0].Value = sDocTypeExportFilter[k][1];
- xStorable.storeToURL(url, props);
- }
- catch(com.sun.star.io.IOException e) {
- failed("Could not store to '" + url + "'", true);
- }
- }
- // close the doc
- XCloseable xCloseable = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xStorable);
- try {
- xCloseable.close(true);
- }
- catch(com.sun.star.util.CloseVetoException e) {
- e.printStackTrace((java.io.PrintWriter)log);
- failed("Cannot close document: test is futile, Office will surely use more space.");
- }
- }
- else {
- log.println("Cannot query for XStorable interface on document '" + sDocuments[i] + "'");
- log.println(" -> Skipping storage.");
- }
+ for (int i = 0; i < sDocuments[k].length; i++)
+ {
+
+ final String sDocument = sDocuments[k][i];
+ final String sExtension = sDocTypeExportFilter[k][1];
+
+// OfficeMemchecker aChecker = new OfficeMemchecker();
+// aChecker.setDocumentName(FileHelper.getBasename(sDocument));
+// aChecker.setExtension(sExtension);
+// aChecker.start();
+
+ loadAndSaveNTimesDocument(sDocument, 1, sExtension);
+
+// nOk += checkMemory(aChecker);
+// nRunThrough ++;
}
+ System.out.println();
+ System.out.println();
}
- // short wait for the office to 'calm down' and free some memory
- shortWait(5000);
- // wait util memory is not freed anymore.
- int storageAfter = getOfficeMemoryUsage();
- int mem = 0;
- int count = 0;
- while (storageAfter != mem && count < 10) {
- count++;
- mem = storageAfter;
- storageAfter = getOfficeMemoryUsage();
- shortWait(1000);
- }
- assure("The Office consumes now " + (storageAfter - storageBefore)
- + "K more memory than at the start of the test; allowed were "
- + iAllowMemoryIncrease * iExportDocCount + "K.",
- storageAfter - storageBefore < iAllowMemoryIncrease * iExportDocCount);
+ shortWait(10000);
+
+ // Now the real test, load document and store 25 times
+
+ // iterate over all document types
+ for (int k = 0; k < sDocTypeExportFilter.length; k++)
+ {
+ // iterate over all documents of this type
+ for (int i = 0; i < sDocuments[k].length; i++)
+ {
+
+ final String sDocument = sDocuments[k][i];
+ final String sExtension = sDocTypeExportFilter[k][1];
+
+ OfficeMemchecker aChecker = new OfficeMemchecker();
+ aChecker.setDocumentName(FileHelper.getBasename(sDocument));
+ aChecker.setExtension(sExtension);
+ aChecker.start();
+
+ loadAndSaveNTimesDocument(sDocument, iExportDocCount, sExtension);
+
+ aChecker.stop();
+ final int nConsumMore = aChecker.getConsumMore();
+
+ nOk += checkMemory(nConsumMore);
+ nRunThrough++;
+ }
+ System.out.println();
+ System.out.println();
+ }
+ System.out.println("Find the output of used 'pmap' here: " + m_aTempDir.getTempDir() + " if test failed.");
+ assertTrue("Office consumes too many memory.", nOk == nRunThrough);
}
/**
- * Get the process ID from the Office
- * @return the Id as String
+ * Checks how much memory should consum
+ * @param storageBefore
+ * @return 1 if consum is ok, else 0
*/
- private String getOfficeProcessID() {
- writeExecutableFile(sProcessIdCommand, sProcessId);
- ProcessHandler processID = new ProcessHandler(sProcessIdCommand);
- processID.executeSynchronously();
- String text = processID.getOutputText();
- if (text == null || text.equals("") || text.indexOf(' ') == -1)
- failed("Could not determine Office process ID. Check " + sProcessIdCommand);
- StringTokenizer aToken = new StringTokenizer(text);
- // this is not nice, but ps gives the same output on every machine
- aToken.nextToken();
- String id = aToken.nextToken();
- return id;
+ private int checkMemory(int nConsumMore)
+ {
+ int nAllowed = iAllowMemoryIncrease * iExportDocCount;
+ System.out.println("The Office consumes now " + nConsumMore
+ + "K more memory than at the start of the test; allowed were "
+ + nAllowed + "K.");
+ if (nConsumMore > nAllowed)
+ {
+ System.out.println("ERROR: This is not allowed.");
+ return 0;
+ }
+ System.out.println("OK.");
+ return 1;
}
/**
- * Get the memory usage of the Office in KByte.
- * @return The memory used by the Office.
+ * load and save exact one document
*/
- private int getOfficeMemoryUsage() {
- String command = sMemoryMonitor.replaceAll("<processID>", getOfficeProcessID());
- writeExecutableFile(sOfficeMemoryCommand, command);
- ProcessHandler processID = new ProcessHandler(sOfficeMemoryCommand);
- processID.executeSynchronously();
- String text = processID.getOutputText();
- if (text == null || text.equals("") || text.indexOf(' ') == -1) {
- failed("Could not determine Office memory usage. Check " + sOfficeMemoryCommand);
+ private void loadAndSaveNTimesDocument(String _sDocument, int _nCount, String _sStoreExtension)
+ {
+ System.out.println("Document: " + _sDocument);
+ XComponent xComponent = DesktopTools.loadDoc(getMSF(), _sDocument, null);
+ XStorable xStorable = UnoRuntime.queryInterface(XStorable.class, xComponent);
+ if (xStorable != null)
+ {
+ // export each document iExportDocCount times
+ for (int j = 0; j < _nCount; j++)
+ {
+ final String sDocumentName = FileHelper.getBasename(_sDocument) + "_" + j + ".pdf";
+ final String sFilename = FileHelper.appendPath(m_aTempDir.getOfficeTempDir(), sDocumentName);
+ // String url = utils.getFullURL(sFilename);
+ String url = sFilename; // graphical.FileHelper.getFileURLFromSystemPath(sFilename);
+ try
+ {
+ PropertyValue[] props = new PropertyValue[1];
+ props[0] = new PropertyValue();
+ props[0].Name = "FilterName";
+ // use export filter for this doc type
+ props[0].Value = _sStoreExtension;
+ xStorable.storeToURL(url, props);
+ }
+ catch (com.sun.star.io.IOException e)
+ {
+ fail("Could not store to '" + url + "'");
+ }
+ }
+ // close the doc
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xStorable);
+ try
+ {
+ xCloseable.close(true);
+ }
+ catch (com.sun.star.util.CloseVetoException e)
+ {
+ e.printStackTrace();
+ fail("Cannot close document: test is futile, Office will surely use more space.");
+ }
+ }
+ else
+ {
+ System.out.println("Cannot query for XStorable interface on document '" + _sDocument + "'");
+ System.out.println(" -> Skipping storage.");
}
- StringTokenizer aToken = new StringTokenizer(text);
- // this works, because the output of pmap is quite standardized.
- aToken.nextToken();
- String mem = aToken.nextToken();
- mem = mem.substring(0, mem.indexOf('K'));
- Integer memory = new Integer(mem);
- return memory.intValue();
+
}
- /**
- * Write a script file and set its rights to rwxrwxrwx.
- * @param fileName The name of the created file
- * @param line The commandline that has to be written inside of the file.
- */
- private void writeExecutableFile(String fileName, String line) {
- try {
- PrintWriter fWriter = new PrintWriter(new FileWriter(fileName));
- fWriter.println(bash);
- fWriter.println(line);
- fWriter.close();
- // change rights to rwxrwxrwx
- ProcessHandler processID = new ProcessHandler(sChmod + fileName);
+// -----------------------------------------------------------------------------
+ private class OfficeMemchecker
+ {
+
+ /**
+ * After called start() it contains the memory need at startup
+ */
+ private int m_nMemoryStart;
+ /**
+ * After called stop() it contains the memory usage
+ */
+ private int m_nMemoryUsage;
+ private String m_sDocumentName;
+ private String m_sExtension;
+
+ public OfficeMemchecker()
+ {
+ m_nMemoryStart = 0;
+ }
+
+ public void setDocumentName(String _sDocName)
+ {
+ m_sDocumentName = _sDocName;
+ }
+
+ public void setExtension(String _sExt)
+ {
+ m_sExtension = _sExt;
+ }
+
+ public void start()
+ {
+ m_nMemoryStart = getOfficeMemoryUsage(createModeName("start", 0));
+ }
+
+ private String createModeName(String _sSub, int _nCount)
+ {
+ StringBuffer aBuf = new StringBuffer();
+ aBuf.append(_sSub);
+ aBuf.append('_').append(m_sDocumentName).append('_').append(m_sExtension);
+ aBuf.append('_').append(_nCount);
+ return aBuf.toString();
+ }
+
+ public void stop()
+ {
+ // short wait for the office to 'calm down' and free some memory
+ shortWait(20000);
+ // wait util memory is not freed anymore.
+ int storageAfter = getOfficeMemoryUsage(createModeName("stop", 0));
+ int mem = 0;
+ int count = 0;
+ while (storageAfter != mem && count < 10)
+ {
+ count++;
+ mem = storageAfter;
+ storageAfter = getOfficeMemoryUsage(createModeName("stop", count));
+ shortWait(1000);
+ }
+ m_nMemoryUsage = (storageAfter - m_nMemoryStart);
+ }
+
+ public int getConsumMore()
+ {
+ return m_nMemoryUsage;
+ }
+
+ /**
+ * Get the process ID from the Office
+ * @return the Id as String
+ */
+ private String getOfficeProcessID()
+ {
+ String sProcessIdCommand = FileHelper.appendPath(m_aTempDir.getTempDir(), "getPS");
+ final String sofficeArg = org.openoffice.test.Argument.get("soffice");
+ final String sPSGrep = "ps -ef | grep $USER | grep <soffice>.bin | grep -v grep";
+ final String sProcessId = sPSGrep.replaceAll("<soffice>", FileHelper.getJavaCompatibleFilename(sofficeArg));
+
+ createExecutableFile(sProcessIdCommand, sProcessId);
+ ProcessHandler processID = new ProcessHandler(sProcessIdCommand);
+ processID.noOutput();
+ processID.executeSynchronously();
+ String text = processID.getOutputText();
+ if (text == null || text.equals("") || text.indexOf(' ') == -1)
+ {
+ fail("Could not determine Office process ID. Check " + sProcessIdCommand);
+ }
+ StringTokenizer aToken = new StringTokenizer(text);
+ // this is not nice, but ps gives the same output on every machine
+ aToken.nextToken();
+ String id = aToken.nextToken();
+ return id;
+ }
+
+ /**
+ * Get the memory usage of the Office in KByte.
+ * @return The memory used by the Office.
+ */
+ private int getOfficeMemoryUsage(String _sMode)
+ {
+ final String sMemoryMonitor = "pmap <processID> |tee <pmapoutputfile> | grep total";
+ String sOfficeMemoryCommand = null;
+ sOfficeMemoryCommand = FileHelper.appendPath(m_aTempDir.getTempDir(), "getPmap");
+ // sOfficeMemoryCommand = FileHelper.getJavaCompatibleFilename(sOfficeMemoryCommand);
+ String command = sMemoryMonitor.replaceAll("<processID>", getOfficeProcessID());
+ String sPmapOutputFile = FileHelper.appendPath(m_aTempDir.getTempDir(), "pmap_" + _sMode + ".txt");
+ command = command.replaceAll("<pmapoutputfile>", sPmapOutputFile);
+ createExecutableFile(sOfficeMemoryCommand, command);
+
+ ProcessHandler processID = new ProcessHandler(sOfficeMemoryCommand);
+ processID.noOutput();
processID.executeSynchronously();
+ int nError = processID.getExitCode();
+ assertTrue("Execute of " + sOfficeMemoryCommand + " failed", nError == 0);
+ String text = processID.getOutputText();
+ if (text == null || text.equals("") || text.indexOf(' ') == -1)
+ {
+ fail("Could not determine Office memory usage. Check " + sOfficeMemoryCommand);
+ }
+ StringTokenizer aToken = new StringTokenizer(text);
+ // this works, because the output of pmap is quite standardized.
+ aToken.nextToken();
+ String mem = aToken.nextToken();
+ mem = mem.substring(0, mem.indexOf('K'));
+ Integer memory = new Integer(mem);
+ return memory.intValue();
}
- catch(java.io.IOException e) {
+
+ /**
+ * Write a script file and set its rights to rwxrwxrwx.
+ * @param fileName The name of the created file
+ * @param line The commandline that has to be written inside of the file.
+ */
+ private void createExecutableFile(String fileName, String line)
+ {
+ final String sChmod = "chmod a+x ";
+ final String bash = "#!/bin/bash";
+
+ try
+ {
+ String sFilename = FileHelper.getJavaCompatibleFilename(fileName);
+ PrintWriter fWriter = new PrintWriter(new FileWriter(sFilename));
+ fWriter.println(bash);
+ fWriter.println(line);
+ fWriter.close();
+ // change rights to rwxrwxrwx
+ ProcessHandler processID = new ProcessHandler(sChmod + sFilename);
+ processID.noOutput();
+ processID.executeSynchronously();
+ int nError = processID.getExitCode();
+ assertTrue("chmod failed. ", nError == 0);
+ }
+ catch (java.io.IOException e)
+ {
+ }
}
}
@@ -304,11 +540,15 @@ public class CheckMemoryUsage extends ComplexTestCase {
* Let this thread sleep for some time
* @param milliSeconds time to wait in milliseconds.
*/
- private void shortWait(int milliSeconds) {
- try {
+ public static void shortWait(int milliSeconds)
+ {
+ System.out.println("Wait for: " + milliSeconds + "ms");
+ try
+ {
Thread.sleep(milliSeconds);
}
- catch(java.lang.InterruptedException e) { // ignore
+ catch (java.lang.InterruptedException e)
+ { // ignore
}
}
@@ -316,15 +556,20 @@ public class CheckMemoryUsage extends ComplexTestCase {
* Own file filter, will just return ok for all files that end with a given
* suffix
*/
- private class FileFilter implements FilenameFilter {
+ private class FileFilter implements FilenameFilter
+ {
+
private String suffix = null;
+
/**
* C'tor.
* @param suffix The suffix each filename should end with.
*/
- public FileFilter(String suffix) {
+ public FileFilter(String suffix)
+ {
this.suffix = suffix;
}
+
/**
* Returns true, if the name of the file has the suffix given to the
* c'tor.
@@ -332,9 +577,32 @@ public class CheckMemoryUsage extends ComplexTestCase {
* @param file Not used.
* @return True, if name ends with suffix.
*/
- public boolean accept(File file, String name) {
+ public boolean accept(File file, String name)
+ {
return name.endsWith(suffix);
}
- };
+ }
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+ // setup and close connections
+ @BeforeClass
+ public static void setUpConnection() throws Exception
+ {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+ private static final OfficeConnection connection = new OfficeConnection();
}
diff --git a/vcl/qa/complex/memCheck/FileHelper.java b/vcl/qa/complex/memCheck/FileHelper.java
new file mode 100644
index 000000000000..21ce46185b4a
--- /dev/null
+++ b/vcl/qa/complex/memCheck/FileHelper.java
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+package complex.memCheck;
+
+import java.io.File;
+
+/**
+ *
+ * @author ll93751
+ */
+public class FileHelper
+{
+ public static String appendPath(String _sPath, String _sRelativePathToAdd)
+ {
+ String sNewPath = _sPath;
+ String fs = System.getProperty("file.separator");
+ if (_sPath.startsWith("file:"))
+ {
+ fs = "/"; // we use a file URL so only '/' is allowed.
+ }
+ if (! (sNewPath.endsWith("/") || sNewPath.endsWith("\\") ) )
+ {
+ sNewPath += fs;
+ }
+ sNewPath += _sRelativePathToAdd;
+ return sNewPath;
+ }
+ public static String getJavaCompatibleFilename(String _sFilename)
+ {
+ // It is a little bit stupid that office urls not compatible to java file urls
+ // System.out.println("java.io.File can't access Office file urls.");
+ if(_sFilename.startsWith("path:"))
+ {
+ final String sPath = _sFilename.substring(5);
+ return sPath;
+ }
+
+ String sSystemPath = graphical.FileHelper.getSystemPathFromFileURL(_sFilename);
+ if (sSystemPath == null)
+ {
+ sSystemPath = _sFilename;
+ }
+ return sSystemPath;
+ }
+
+public static String getBasename(String _sFilename)
+ {
+ if (_sFilename == null)
+ {
+ return "";
+ }
+ // String fs = System.getProperty("file.separator");
+
+ int nIdx = _sFilename.lastIndexOf("\\");
+ if (nIdx == -1)
+ {
+ nIdx = _sFilename.lastIndexOf("/");
+ }
+ if (nIdx > 0)
+ {
+ return _sFilename.substring(nIdx + 1);
+ }
+ return _sFilename;
+ }
+}
diff --git a/vcl/qa/complex/memCheck/TestDocument.java b/vcl/qa/complex/memCheck/TestDocument.java
new file mode 100644
index 000000000000..8ca9f7b71192
--- /dev/null
+++ b/vcl/qa/complex/memCheck/TestDocument.java
@@ -0,0 +1,45 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+package complex.memCheck;
+
+import java.io.File;
+import org.openoffice.test.OfficeFileUrl;
+
+final class TestDocument
+{
+ final static String sPathname = "testdocuments";
+ public static String getUrl(String name)
+ {
+ return OfficeFileUrl.getAbsolute(new File(sPathname, name));
+ }
+ public static String getUrl()
+ {
+ return OfficeFileUrl.getAbsolute(new File(sPathname));
+ }
+ private TestDocument() {}
+}
diff --git a/vcl/qa/complex/memCheck/makefile.mk b/vcl/qa/complex/memCheck/makefile.mk
index d1d4b5c08c98..4a809e71e50e 100755
--- a/vcl/qa/complex/memCheck/makefile.mk
+++ b/vcl/qa/complex/memCheck/makefile.mk
@@ -25,65 +25,107 @@
#
#*************************************************************************
-PRJ = ..$/..$/..
-TARGET = MemoryCheck
-PRJNAME = $(TARGET)
-PACKAGE = complex$/memCheck
-
-# --- Settings -----------------------------------------------------
-.INCLUDE: settings.mk
-
-
-#----- compile .java files -----------------------------------------
-
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-JAVAFILES = CheckMemoryUsage.java
-
-#----- make a jar from compiled files ------------------------------
-
-MAXLINELENGTH = 100000
-
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-# --- Parameters for the test --------------------------------------
+PRJ = ../../..
+PRJNAME = vcl
+TARGET = qa_complex_memCheck
-# start an office if the parameter is set for the makefile
-.IF "$(OFFICE)" == ""
-CT_APPEXECCOMMAND =
-.ELSE
-CT_APPEXECCOMMAND = -AppExecutionCommand \
- "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
-.ENDIF
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/memCheck
-# test base is java complex
-CT_TESTBASE = -TestBase java_complex
+# here store only Files which contain a @Test
+JAVATESTFILES = \
+ CheckMemoryUsage.java
-# replace $/ with . in package name
-CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+# put here all other files
+JAVAFILES = $(JAVATESTFILES) \
+ FileHelper.java \
+ TestDocument.java
-# start the runner application
-CT_APP = org.openoffice.Runner
-# --- Targets ------------------------------------------------------
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
-.IF "$(depend)" == ""
-$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
-.ELSE
-$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
-.ENDIF
+# Sample how to debug
+# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
-.INCLUDE : target.mk
+.END
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+ALLTAR : javatest
-$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : CheckMemoryUsage.props
- cp $(@:f) $@
- jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(@:f)
+.END
-RUN: run
-run:
- java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).CheckMemoryUsage
+#
+#
+#
+# PRJ = ..$/..$/..
+# TARGET = MemoryCheck
+# PRJNAME = $(TARGET)
+# PACKAGE = complex$/memCheck
+#
+# # --- Settings -----------------------------------------------------
+# .INCLUDE: settings.mk
+#
+#
+# #----- compile .java files -----------------------------------------
+#
+# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+# JAVAFILES = CheckMemoryUsage.java
+#
+# #----- make a jar from compiled files ------------------------------
+#
+# MAXLINELENGTH = 100000
+#
+# JARCLASSDIRS = $(PACKAGE)
+# JARTARGET = $(TARGET).jar
+# JARCOMPRESS = TRUE
+#
+# # --- Parameters for the test --------------------------------------
+#
+# # start an office if the parameter is set for the makefile
+# .IF "$(OFFICE)" == ""
+# CT_APPEXECCOMMAND =
+# .ELSE
+# CT_APPEXECCOMMAND = -AppExecutionCommand \
+# "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+# .ENDIF
+#
+# # test base is java complex
+# CT_TESTBASE = -TestBase java_complex
+#
+# # replace $/ with . in package name
+# CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+#
+# # start the runner application
+# CT_APP = org.openoffice.Runner
+#
+# # --- Targets ------------------------------------------------------
+#
+# .IF "$(depend)" == ""
+# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
+# .ELSE
+# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
+# .ENDIF
+#
+# .INCLUDE : target.mk
+#
+#
+#
+# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : CheckMemoryUsage.props
+# cp $(@:f) $@
+# jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(@:f)
+#
+#
+# RUN: run
+#
+# run:
+# java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).CheckMemoryUsage
diff --git a/vcl/qa/testdocuments/CalcDoc.sxc b/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc
index 4b2b572085dc..4b2b572085dc 100755
--- a/vcl/qa/testdocuments/CalcDoc.sxc
+++ b/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc
Binary files differ
diff --git a/vcl/qa/testdocuments/ImpressDoc.sxi b/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi
index efcdf9b6a25e..efcdf9b6a25e 100755
--- a/vcl/qa/testdocuments/ImpressDoc.sxi
+++ b/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi
Binary files differ
diff --git a/vcl/qa/testdocuments/WriterDoc.sxw b/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw
index 1b2c2cb2dab6..1b2c2cb2dab6 100755
--- a/vcl/qa/testdocuments/WriterDoc.sxw
+++ b/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw
Binary files differ
diff --git a/vcl/qa/complex/persistent_window_states/DocumentHandle.java b/vcl/qa/complex/persistent_window_states/DocumentHandle.java
index 0b32eaaeff51..ea28c41f65f7 100644
--- a/vcl/qa/complex/persistent_window_states/DocumentHandle.java
+++ b/vcl/qa/complex/persistent_window_states/DocumentHandle.java
@@ -34,13 +34,9 @@ import com.sun.star.lang.XComponent;
import com.sun.star.awt.XWindow;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyState;
-import com.sun.star.frame.XController;
-import com.sun.star.frame.FrameSearchFlag;
-import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.FrameSearchFlag;
-import com.sun.star.frame.XFramesSupplier;
import helper.WindowListener;
/**
@@ -59,7 +55,7 @@ public class DocumentHandle {
/**
* Constructor
- * @param xComponentLoader A loader to load a document
+ * @param xCompLoader A loader to load a document
*/
public DocumentHandle(XComponentLoader xCompLoader) {
this.xCompLoader = xCompLoader;
@@ -71,6 +67,7 @@ public class DocumentHandle {
* @param docName The name of a document as file URL
* @param hidden If true, the document is loaded hidden.
* @return The size of the opened/created document.
+ * @throws Exception
*/
public Rectangle loadDocument(String docName, boolean hidden)
throws Exception{
@@ -91,13 +88,13 @@ public class DocumentHandle {
}
// get the current active window
- XFrame xCurFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class, xCompLoader);
+ XFrame xCurFrame = UnoRuntime.queryInterface(XFrame.class, xCompLoader);
// create a new frame
XFrame xFrame = xCurFrame.findFrame("_blank", FrameSearchFlag.CREATE);
// load document in this frame
- XComponentLoader xFrameLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
+ XComponentLoader xFrameLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
xComp = xFrameLoader.loadComponentFromURL(
docName, "_self", 0, szArgs);
// wait for the document to load.
diff --git a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java
index edceeeafd883..898324504b4e 100644
--- a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java
+++ b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java
@@ -26,31 +26,27 @@
************************************************************************/
package complex.persistent_window_states;
-
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XInitialization;
-import com.sun.star.uno.Type;
import com.sun.star.uno.Any;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XComponent;
-import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XFramesSupplier;
import com.sun.star.frame.XFrames;
-import com.sun.star.registry.XRegistryKey;
-import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.container.XIndexAccess;
-import com.sun.star.beans.XPropertySet;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.AnyConverter;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.awt.Rectangle;
import com.sun.star.util.XCloseable;
import helper.ConfigurationRead;
-import complexlib.ComplexTestCase;
-import helper.OfficeProvider;
-import complex.persistent_window_states.DocumentHandle;
+
+
+
+// import org.junit.After;
+import org.junit.AfterClass;
+// import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
/**
* Parameters:
@@ -58,10 +54,11 @@ import complex.persistent_window_states.DocumentHandle;
* <li>NoOffice=yes - StarOffice is not started initially.</li>
* </ul>
*/
-public class PersistentWindowTest extends ComplexTestCase {
+public class PersistentWindowTest
+{
- private XMultiServiceFactory xMSF;
- private OfficeProvider oProvider;
+ // private XMultiServiceFactory xMSF;
+// private OfficeProvider oProvider;
private int iOfficeCloseTime = 0;
/**
@@ -69,9 +66,18 @@ public class PersistentWindowTest extends ComplexTestCase {
* Right now, it's only 'checkPersistentWindowState'.
* @return All test methods.
*/
- public String[] getTestMethodNames() {
- return new String[]{"checkPersistentWindowState"};
- }
+// public String[] getTestMethodNames()
+// {
+// return new String[]
+// {
+// "checkPersistentWindowState"
+// };
+// }
+
+ /**
+ * The test parameters
+ */
+ // private static TestParameters param = null;
/**
* Test if all available document types change the
@@ -94,42 +100,32 @@ public class PersistentWindowTest extends ComplexTestCase {
* - close office
* - Test finished
*/
- public void checkPersistentWindowState()
+ @Test public void checkPersistentWindowState()
{
- try {
-
- log.println("Connect the first time.");
- log.println("AppExecCommand: " + (String)param.get("AppExecutionCommand"));
- log.println("ConnString: " + (String)param.get("ConnectionString"));
- oProvider = new OfficeProvider();
- iOfficeCloseTime = param.getInt("OfficeCloseTime");
- if ( iOfficeCloseTime == 0 ) {
- iOfficeCloseTime = 1000;
- }
+ // final XMultiServiceFactory xMsf = getMSF();
- if (!connect()) return;
+ // some Tests need the qadevOOo TestParameters, it is like a Hashmap for Properties.
+// param = new TestParameters();
+// param.put("ServiceFactory", xMsf); // some qadevOOo functions need the ServiceFactory
- // create the configuration provider
- Object o = null;
- try {
- o = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider");
- }
- catch(com.sun.star.uno.Exception e) {
- failed("Cannot create \"com.sun.star.configuration."+
- "ConfigurationProvider\"");
- return;
- }
+ try
+ {
- // fetch the multi service factory for setup
- XMultiServiceFactory xCP = (XMultiServiceFactory)
- UnoRuntime.queryInterface(XMultiServiceFactory.class, o);
+ // At first we are already connected
+ // if (!connect())
+ // {
+ // return;
+ // }
- // create the configuration reader
- ConfigurationRead cfgRead = new ConfigurationRead(xCP);
+ // fetch the multi service factory for setup
+ // XMultiServiceFactory xCP = getMSF();
+
+ // create the configuration reader
+ // ConfigurationRead cfgRead = new ConfigurationRead(xCP);
- // just test the wrong ones, not all.
- String [] els = new String[]{
+ // just test the wrong ones, not all.
+ String[] els = new String[]
+ {
"Office/Factories/com.sun.star.drawing.DrawingDocument",
"Office/Factories/com.sun.star.formula.FormulaProperties",
//"Office/Factories/com.sun.star.presentation.PresentationDocument",
@@ -138,92 +134,98 @@ public class PersistentWindowTest extends ComplexTestCase {
"Office/Factories/com.sun.star.text.TextDocument",
"Office/Factories/com.sun.star.text.WebDocument",
};
- // uncomment the following line for all doc types
-// String [] els = cfgRead.getSubNodeNames("Office/Factories");
-
- log.println("Found "+ els.length + " document types to test.\n");
- if (!disconnect()) return;
-
- // for all types
- for(int i=0; i<els.length; i++) {
- log.println("\tStart test for document type " + i + ": " + els[i]);
- // exclude chart documents: cannot be created this way.
- if ( els[i].indexOf("ChartDocument") != -1) {
- log.println("Skipping chart document: cannot be create like this.");
- continue;
- }
+ // uncomment the following line for all doc types
+ // String [] els = cfgRead.getSubNodeNames("Office/Factories");
+
+ System.out.println("Found " + els.length + " document types to test.\n");
+ disconnect();
+
+ // for all types
+ for (int i = 0; i < els.length; i++)
+ {
+ System.out.println("\tStart test for document type " + i + ": " + els[i]);
+ // exclude chart documents: cannot be created this way.
+ if (els[i].indexOf("ChartDocument") != -1)
+ {
+ System.out.println("Skipping chart document: cannot be create like this.");
+ continue;
+ }
- // start an office
- if (!connect()) return;
+ // start an office
+ connect();
- // get configuration
- String[] settings = getConfigurationAndLoader(xMSF, els[i]);
- if (settings == null) {
- log.println("Skipping document type " + els[i]);
- disconnect();
- continue;
- }
- String cfg = settings[1];
+ // get configuration
+ String[] settings = getConfigurationAndLoader(getMSF(), els[i]);
+ if (settings == null)
+ {
+ System.out.println("Skipping document type " + els[i]);
+ disconnect();
+ continue;
+ }
+ String cfg = settings[1];
- // load a document
- DocumentHandle handle = loadDocument(xMSF, settings[0]);
+ // load a document
+ DocumentHandle handle = loadDocument(getMSF(), settings[0]);
- // first size
- Rectangle rect1 = handle.getDocumentPosSize();
+ // first size
+ Rectangle rect1 = handle.getDocumentPosSize();
- // resize
- handle.resizeDocument();
- // after resize
- Rectangle rect2 = handle.getDocumentPosSize();
+ // resize
+ handle.resizeDocument();
+ // after resize
+ Rectangle rect2 = handle.getDocumentPosSize();
- // disposeManager and start a new office
- if (!disconnect()) return;
+ // disposeManager and start a new office
+ disconnect();
- if (!connect()) return;
+ connect();
- // get configuration
- settings = getConfigurationAndLoader(xMSF, els[i]);
+ // get configuration
+ settings = getConfigurationAndLoader(getMSF(), els[i]);
- String newCfg = settings[1];
+ String newCfg = settings[1];
- // load a document
- handle = loadDocument(xMSF, settings[0]);
+ // load a document
+ handle = loadDocument(getMSF(), settings[0]);
- Rectangle newRect = handle.getDocumentPosSize();
+ Rectangle newRect = handle.getDocumentPosSize();
- // print the settings and window sizes
- log.println("----------------------------");
- log.println("Initial Config String : " + cfg);
- log.println("Config String after restart: " + newCfg);
+ // print the settings and window sizes
+ System.out.println("----------------------------");
+ System.out.println("Initial Config String : " + cfg);
+ System.out.println("Config String after restart: " + newCfg);
- log.println("----------------------------");
- log.println("Initial window (X,Y,Width,Height): "
- +rect1.X+";"+rect1.Y+";"+ rect1.Width+";"+rect1.Height);
- log.println("Window after resize (X,Y,Width,Height): "
- +rect2.X+";"+rect2.Y+";"+ rect2.Width+";"+rect2.Height);
- log.println("Window after restart (X,Y,Width,Height): "
- +newRect.X+";"+newRect.Y+";"+newRect.Width+";"
- +newRect.Height);
+ System.out.println("----------------------------");
+ System.out.println("Initial window (X,Y,Width,Height): "
+ + rect1.X + ";" + rect1.Y + ";" + rect1.Width + ";" + rect1.Height);
+ System.out.println("Window after resize (X,Y,Width,Height): "
+ + rect2.X + ";" + rect2.Y + ";" + rect2.Width + ";" + rect2.Height);
+ System.out.println("Window after restart (X,Y,Width,Height): "
+ + newRect.X + ";" + newRect.Y + ";" + newRect.Width + ";"
+ + newRect.Height);
- // compare to see if resize worked
- log.println("----------------------------");
- assure("Resize values for "+ els[i] +
- " are equal.", !compareRectangles(rect1, rect2), true);
- // compare settings and sizes
- assure("Config settings for "+ els[i] +
- " were not changed.", !cfg.equals(newCfg), true);
- assure("Resized and restarted window for "+ els[i] +
- " are not equal.", compareRectangles(rect2, newRect), true);
- log.println("----------------------------");
+ // compare to see if resize worked
+ System.out.println("----------------------------");
+ if (els[i].indexOf("SpreadsheetDocument") == -1 &&
+ els[i].indexOf("DrawingDocument") == -1)
+ {
+ // leave out Spreadsheet- and DrawingDocumnt
+ assertTrue("Resize values for " + els[i] + " are equal.", !compareRectangles(rect1, rect2));
+ }
+ // compare settings and sizes
+ assertTrue("Config settings for " + els[i] + " were not changed.", !cfg.equals(newCfg));
+ assertTrue("Resized and restarted window for " + els[i] + " are not equal.", compareRectangles(rect2, newRect));
+ System.out.println("----------------------------");
- // disposeManager
- if (!disconnect()) return;
+ // disposeManager
+ disconnect();
- log.println("\tFinish test for document type " + i + ": " + els[i]);
+ System.out.println("\tFinish test for document type " + i + ": " + els[i]);
+ }
}
- }
- catch(Exception e) {
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
@@ -235,16 +237,17 @@ public class PersistentWindowTest extends ComplexTestCase {
* @return Settings and Loader
*/
private static String[] getConfigurationAndLoader(XMultiServiceFactory xMSF,
- String cfgString) {
+ String cfgString)
+ {
String[] conf = new String[2];
- try {
+ try
+ {
Object o = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider");
+ "com.sun.star.configuration.ConfigurationProvider");
// fetch the multi service factory for setup
- XMultiServiceFactory xCP = (XMultiServiceFactory)
- UnoRuntime.queryInterface(XMultiServiceFactory.class, o);
+ XMultiServiceFactory xCP = UnoRuntime.queryInterface(XMultiServiceFactory.class, o);
// create the configuration reader
ConfigurationRead cfgRead = new ConfigurationRead(xCP);
@@ -253,22 +256,28 @@ public class PersistentWindowTest extends ComplexTestCase {
String loader = getStringFromObject(
cfgRead.getByHierarchicalName(cfgString + "/ooSetupFactoryEmptyDocumentURL"));
- if (loader == null) return null;
- log.println("\tLoader: " + loader);
+ if (loader == null)
+ {
+ return null;
+ }
+ System.out.println("\tLoader: " + loader);
// read attributes
String hierchName = cfgString + "/ooSetupFactoryWindowAttributes";
String setupSettings = getStringFromObject(cfgRead.getByHierarchicalName(hierchName));
// remove slots: just plain document types have to start
- if ( loader.indexOf("?slot") != -1 ) {
+ if (loader.indexOf("?slot") != -1)
+ {
loader = loader.substring(0, loader.indexOf("?slot"));
- System.out.println("Loader: "+loader);
+ System.out.println("Loader: " + loader);
}
conf[0] = loader;
conf[1] = setupSettings;
}
- catch(com.sun.star.uno.Exception e) {}
+ catch (com.sun.star.uno.Exception e)
+ {
+ }
return conf;
}
@@ -279,97 +288,105 @@ public class PersistentWindowTest extends ComplexTestCase {
* @return A handle to the document
*/
private DocumentHandle loadDocument(XMultiServiceFactory xMSF,
- String docLoader) {
+ String docLoader)
+ {
DocumentHandle docHandle = null;
- try {
+ try
+ {
// create component loaader
- XComponentLoader xCompLoader = (XComponentLoader)
- UnoRuntime.queryInterface(
- XComponentLoader.class, xMSF.createInstance(
- "com.sun.star.frame.Desktop"));
- XFramesSupplier xFrameSupp = (XFramesSupplier)UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
+ XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xMSF.createInstance("com.sun.star.frame.Desktop"));
+ XFramesSupplier xFrameSupp = UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
// close all existing frames
XFrames xFrames = xFrameSupp.getFrames();
- XIndexAccess xAcc = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
- for ( int i=0; i<xAcc.getCount(); i++ ) {
- XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
- try {
- if ( xClose != null ) {
+ XIndexAccess xAcc = UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
+ for (int i = 0; i < xAcc.getCount(); i++)
+ {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
+ try
+ {
+ if (xClose != null)
+ {
xClose.close(false);
}
- else {
- failed("Could not query frame for XCloseable!");
+ else
+ {
+ fail("Could not query frame for XCloseable!");
}
}
- catch( com.sun.star.uno.Exception e ) {
- e.printStackTrace((java.io.PrintWriter)log);
- failed("Could not query frame for XCloseable!");
+ catch (com.sun.star.uno.Exception e)
+ {
+ e.printStackTrace();
+ fail("Could not query frame for XCloseable!");
}
}
docHandle = new DocumentHandle(xCompLoader);
docHandle.loadDocument(docLoader, false);
}
- catch(com.sun.star.uno.Exception e) {
+ catch (com.sun.star.uno.Exception e)
+ {
e.printStackTrace();
}
- catch(java.lang.Exception e) {
+ catch (java.lang.Exception e)
+ {
e.printStackTrace();
}
return docHandle;
}
- private boolean connect() {
- try {
- xMSF = (XMultiServiceFactory)oProvider.getManager(param);
- try {
- Thread.sleep(10000);
- }
- catch(java.lang.InterruptedException e) {}
+ private boolean connect()
+ {
+ try
+ {
+ connection.setUp();
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ fail("can't connect.");
}
- catch (java.lang.Exception e) {
- log.println(e.getClass().getName());
- log.println("Message: " + e.getMessage());
- failed("Cannot connect the Office.");
- return false;
+ catch (Exception e)
+ {
+ fail("can't connect.");
}
return true;
}
- private boolean disconnect() {
- try {
- XDesktop desk = null;
- desk = (XDesktop) UnoRuntime.queryInterface(
- XDesktop.class, xMSF.createInstance(
- "com.sun.star.frame.Desktop"));
- xMSF = null;
- desk.terminate();
- log.println("Waiting " + iOfficeCloseTime + " milliseconds for the Office to close down");
- try {
- Thread.sleep(iOfficeCloseTime);
- }
- catch(java.lang.InterruptedException e) {}
+ private boolean disconnect()
+ {
+ try
+ {
+ connection.tearDown();
}
- catch (java.lang.Exception e) {
- e.printStackTrace();
- failed("Cannot dispose the Office.");
- return false;
+ catch (java.lang.InterruptedException e)
+ {
+ fail("can't disconnect.");
+ }
+ catch (Exception e)
+ {
+ fail("can't disconnect.");
}
return true;
}
- private static String getStringFromObject(Object oName) {
+ private static String getStringFromObject(Object oName)
+ {
if (oName instanceof String)
- return (String)oName;
+ {
+ return (String) oName;
+ }
String value = null;
- if (oName instanceof Any) {
- try {
+ if (oName instanceof Any)
+ {
+ try
+ {
value = AnyConverter.toString(oName);
- if (value == null) {
- log.println("Got a void css.uno.Any as loading string.");
+ if (value == null)
+ {
+ System.out.println("Got a void css.uno.Any as loading string.");
}
}
- catch(Exception e) {
- log.println("This document type cannot be opened directly.");
+ catch (Exception e)
+ {
+ System.out.println("This document type cannot be opened directly.");
}
}
return value;
@@ -382,12 +399,37 @@ public class PersistentWindowTest extends ComplexTestCase {
* @param rect2 Second Rectangle.
* @return True, if the rectangles are equal.
*/
- private boolean compareRectangles(Rectangle rect1, Rectangle rect2) {
+ private boolean compareRectangles(Rectangle rect1, Rectangle rect2)
+ {
boolean result = true;
- result &= (rect1.X==rect2.X);
- result &= (rect1.Y==rect2.Y);
- result &= (rect1.Width==rect2.Width);
- result &= (rect1.Height==rect2.Height);
+ result &= (rect1.X == rect2.X);
+ result &= (rect1.Y == rect2.Y);
+ result &= (rect1.Width == rect2.Width);
+ result &= (rect1.Height == rect2.Height);
return result;
}
+
+
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ // setup and close connections
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
}
diff --git a/vcl/qa/complex/persistent_window_states/makefile.mk b/vcl/qa/complex/persistent_window_states/makefile.mk
index 4c61d8969b8d..e4d9f6b514a0 100644
--- a/vcl/qa/complex/persistent_window_states/makefile.mk
+++ b/vcl/qa/complex/persistent_window_states/makefile.mk
@@ -24,58 +24,44 @@
# for a copy of the LGPLv3 License.
#
#*************************************************************************
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-PRJ = ..$/..$/..
-TARGET = PersistentWindowTest
-PRJNAME = $(TARGET)
-PACKAGE = complex$/persistent_window_states
-
-# --- Settings -----------------------------------------------------
-.INCLUDE: settings.mk
+PRJ = ../../..
+PRJNAME = vcl
+TARGET = qa_complex_persistent_window_states
-#----- compile .java files -----------------------------------------
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/persistent_window_states
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-JAVAFILES = PersistentWindowTest.java DocumentHandle.java
+# here store only Files which contain a @Test
+JAVATESTFILES = \
+ PersistentWindowTest.java
-#----- make a jar from compiled files ------------------------------
+# put here all other files
+JAVAFILES = $(JAVATESTFILES) \
+DocumentHandle.java
-MAXLINELENGTH = 100000
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
-# --- Parameters for the test --------------------------------------
+# Sample how to debug
+# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
-# test base is java complex
-CT_TESTBASE = -TestBase java_complex
+.END
-# test looks something like the.full.package.TestName
-CT_TEST = -o $(PACKAGE:s\$/\.\).$(TARGET)
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
-# start the runner application
-CT_APP = org.openoffice.Runner
+ALLTAR : javatest
-# --- Targets ------------------------------------------------------
+.END
-$(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props : ALLTAR
-.INCLUDE : target.mk
-$(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props : $(TARGET).props
- cp $(TARGET).props $@
- jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(TARGET).props
-RUN: run
-# start an office if the parameter is set for the makefile
-.IF "$(OFFICE)" == ""
-run:
- @echo "Execute this test with 'dmake run OFFICE=/system/path/to/office/program'."
- @echo "The office will be started by the test with a socket connection on port 8100"
-.ELSE
-run: $(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props
- java -cp $(CLASSPATH) $(CT_APP) -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" $(CT_TESTBASE) $(CT_TEST)
-.ENDIF
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index dd9a5b4a15ee..b48db1d6ee97 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -37,32 +37,33 @@
#include <cmath>
#include <limits.h>
-#include <vcl/svdata.hxx>
-#include <svsys.h>
+#include "vcl/svdata.hxx"
+#include "svsys.h"
#ifdef WNT
#undef min
#endif
-#include <tools/debug.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/event.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/group.hxx>
-#include <vcl/field.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/wrkwin.hxx>
-#include <vcl/sound.hxx>
-#include <vcl/threadex.hxx>
-#include <vcl/dbggui.hxx>
-#include <com/sun/star/i18n/XCharacterClassification.hpp>
-
-#include <vcl/unohelp.hxx>
-#include <vcl/unohelp2.hxx>
-#include <vos/mutex.hxx>
+#include "tools/debug.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/event.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/button.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/group.hxx"
+#include "vcl/field.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/wrkwin.hxx"
+#include "vcl/sound.hxx"
+#include "vcl/threadex.hxx"
+#include "vcl/dbggui.hxx"
+#include "com/sun/star/i18n/XCharacterClassification.hpp"
+
+#include "vcl/unohelp.hxx"
+#include "vcl/unohelp2.hxx"
+#include "vos/mutex.hxx"
+#include "vcl/salinst.hxx"
#include <map>
#include <algorithm>
@@ -1963,9 +1964,11 @@ void DbgPrintWindow( const char* pLine )
// =======================================================================
-#ifdef WNT
-void ImplDbgTestSolarMutex();
-#endif
+void ImplDbgTestSolarMutex()
+{
+ bool bCheck = ImplGetSVData()->mpDefInst->CheckYieldMutex();
+ OSL_ENSURE( bCheck, "SolarMutex not locked" );
+}
// =======================================================================
@@ -1973,9 +1976,7 @@ void DbgGUIInit()
{
DbgSetPrintMsgBox( DbgPrintMsgBox );
DbgSetPrintWindow( DbgPrintWindow );
-#ifdef WNT
DbgSetTestSolarMutex( ImplDbgTestSolarMutex );
-#endif
}
// -----------------------------------------------------------------------
@@ -1984,9 +1985,7 @@ void DbgGUIDeInit()
{
DbgSetPrintMsgBox( NULL );
DbgSetPrintWindow( NULL );
-#ifdef WNT
DbgSetTestSolarMutex( NULL );
-#endif
DbgWindow* pDbgWindow = ImplGetSVData()->maWinData.mpDbgWin;
if ( pDbgWindow )
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index 1f9efa7b6e65..2c7ad2fa9c3e 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -62,12 +62,7 @@ Help::~Help()
// -----------------------------------------------------------------------
-BOOL Help::Start( ULONG, const Window* )
-{
- return FALSE;
-}
-
-void Help::OpenHelpAgent( ULONG )
+void Help::OpenHelpAgent( const rtl::OString& )
{
}
@@ -78,11 +73,9 @@ BOOL Help::Start( const XubString&, const Window* )
return FALSE;
}
-// -----------------------------------------------------------------------
-
-XubString Help::GetHelpText( ULONG, const Window* )
+BOOL Help::SearchKeyword( const XubString& )
{
- return ImplGetSVEmptyStr();
+ return FALSE;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 9a2404d36740..2a04389d8f44 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -74,6 +74,29 @@ void SalInstance::FillFontPathList( std::list< rtl::OString >& )
// do nothing
}
+SalMenu* SalInstance::CreateMenu( BOOL, Menu* )
+{
+ // default: no native menus
+ return NULL;
+}
+
+void SalInstance::DestroyMenu( SalMenu* pMenu )
+{
+ (void)pMenu;
+ OSL_ENSURE( pMenu == 0, "DestroyMenu called with non-native menus" );
+}
+
+SalMenuItem* SalInstance::CreateMenuItem( const SalItemParams* )
+{
+ return NULL;
+}
+
+void SalInstance::DestroyMenuItem( SalMenuItem* pItem )
+{
+ (void)pItem;
+ OSL_ENSURE( pItem == 0, "DestroyMenu called with non-native menus" );
+}
+
SalTimer::~SalTimer()
{
}
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 980e0f1c5b58..b91afbbae9fe 100755..100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -424,7 +424,10 @@ ImplStyleData::ImplStyleData()
mnPushButtonStyle = 0;
mnTabControlStyle = 0;
mnLogoDisplayTime = LOGO_DISPLAYTIME_STARTTIME;
- mnDragFullOptions = 0;
+ mnDragFullOptions = DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE |
+ DRAGFULL_OPTION_OBJECTMOVE | DRAGFULL_OPTION_OBJECTSIZE |
+ DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT |
+ DRAGFULL_OPTION_SCROLL;
mnAnimationOptions = 0;
mnSelectionOptions = 0;
mnDisplayOptions = 0;
@@ -1041,6 +1044,8 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const
(mpData->mnUseSystemUIFonts == rSet.mpData->mnUseSystemUIFonts) &&
(mpData->mnUseFlatBorders == rSet.mpData->mnUseFlatBorders) &&
(mpData->mnUseFlatMenues == rSet.mpData->mnUseFlatMenues) &&
+ (mpData->mnSymbolsStyle == rSet.mpData->mnSymbolsStyle) &&
+ (mpData->mnPreferredSymbolsStyle == rSet.mpData->mnPreferredSymbolsStyle) &&
(mpData->maFaceColor == rSet.mpData->maFaceColor) &&
(mpData->maCheckedColor == rSet.mpData->maCheckedColor) &&
(mpData->maLightColor == rSet.mpData->maLightColor) &&
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index f1065c07ca24..935d2c1894ea 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -27,47 +27,49 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
+
#include <string.h>
-#ifndef _SV_SVSYS_HXX
-#include <svsys.h>
-#endif
-#include <vcl/salinst.hxx>
-#include <vcl/salframe.hxx>
-
-#ifndef _VOS_MUTEX_HXX
-#include <vos/mutex.hxx>
-#endif
-
-#include <osl/process.h>
-#include <osl/file.hxx>
-#include <uno/current_context.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <tools/debug.hxx>
-#include <unotools/fontcfg.hxx>
-#include <vcl/configsettings.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/window.h>
-#include <vcl/svapp.hxx>
-#include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/unohelp.hxx>
-#include <vcl/button.hxx> // for Button::GetStandardText
-#include <vcl/dockwin.hxx> // for DockingManager
-#include <vcl/salimestatus.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/awt/XExtendedToolkit.hpp>
-#include <com/sun/star/java/JavaNotConfiguredException.hpp>
-#include <com/sun/star/java/JavaVMCreationFailureException.hpp>
-#include <com/sun/star/java/MissingJavaRuntimeException.hpp>
-#include <com/sun/star/java/JavaDisabledException.hpp>
-
-#include <com/sun/star/lang/XComponent.hpp>
+#include "rtl/instance.hxx"
+#include "osl/process.h"
+#include "osl/file.hxx"
+
+#include "svsys.h"
+
+#include "tools/debug.hxx"
+#include "tools/resary.hxx"
+
+#include "vcl/salinst.hxx"
+#include "vcl/salframe.hxx"
+#include "vcl/configsettings.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/window.h"
+#include "vcl/svapp.hxx"
+#include "vcl/wrkwin.hxx"
+#include "vcl/msgbox.hxx"
+#include "vcl/unohelp.hxx"
+#include "vcl/button.hxx" // for Button::GetStandardText
+#include "vcl/dockwin.hxx" // for DockingManager
+#include "vcl/salimestatus.hxx"
+#include "vcl/salsys.hxx"
+#include "vcl/svids.hrc"
+
+#include "unotools/fontcfg.hxx"
+
+#include "vos/mutex.hxx"
+
+#include "cppuhelper/implbase1.hxx"
+#include "uno/current_context.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/awt/XExtendedToolkit.hpp"
+#include "com/sun/star/java/JavaNotConfiguredException.hpp"
+#include "com/sun/star/java/JavaVMCreationFailureException.hpp"
+#include "com/sun/star/java/MissingJavaRuntimeException.hpp"
+#include "com/sun/star/java/JavaDisabledException.hpp"
#include <stdio.h>
-#include <vcl/salsys.hxx>
-#include <vcl/svids.hrc>
-#include <rtl/instance.hxx>
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -127,6 +129,9 @@ void ImplInitSVData()
break;
}
}
+
+ // mark default layout border as unitialized
+ pImplSVData->maAppData.mnDefaultLayoutBorder = -1;
}
// -----------------------------------------------------------------------
@@ -162,6 +167,11 @@ void ImplDeInitSVData()
delete pSVData->maAppData.mpMSFTempFileName;
pSVData->maAppData.mpMSFTempFileName = NULL;
}
+
+ if( pSVData->maCtrlData.mpFieldUnitStrings )
+ delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL;
+ if( pSVData->maCtrlData.mpCleanUnitStrings )
+ delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL;
}
// -----------------------------------------------------------------------
@@ -239,6 +249,52 @@ ResId VclResId( sal_Int32 nId )
return ResId( nId, *pMgr );
}
+FieldUnitStringList* ImplGetFieldUnits()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( ! pSVData->maCtrlData.mpFieldUnitStrings )
+ {
+ ResMgr* pResMgr = ImplGetResMgr();
+ if( pResMgr )
+ {
+ ResStringArray aUnits( ResId (SV_FUNIT_STRINGS, *pResMgr) );
+ sal_uInt32 nUnits = aUnits.Count();
+ pSVData->maCtrlData.mpFieldUnitStrings = new FieldUnitStringList();
+ pSVData->maCtrlData.mpFieldUnitStrings->reserve( nUnits );
+ for( sal_uInt32 i = 0; i < nUnits; i++ )
+ {
+ std::pair< String, FieldUnit > aElement( aUnits.GetString(i), static_cast<FieldUnit>(aUnits.GetValue(i)) );
+ pSVData->maCtrlData.mpFieldUnitStrings->push_back( aElement );
+ }
+ }
+ }
+ return pSVData->maCtrlData.mpFieldUnitStrings;
+}
+
+FieldUnitStringList* ImplGetCleanedFieldUnits()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if( ! pSVData->maCtrlData.mpCleanUnitStrings )
+ {
+ FieldUnitStringList* pUnits = ImplGetFieldUnits();
+ if( pUnits )
+ {
+ size_t nUnits = pUnits->size();
+ pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList();
+ pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits );
+ for( size_t i = 0; i < nUnits; i++ )
+ {
+ String aUnit( (*pUnits)[i].first );
+ aUnit.EraseAllChars( sal_Unicode( ' ' ) );
+ aUnit.ToLowerAscii();
+ std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second );
+ pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement );
+ }
+ }
+ }
+ return pSVData->maCtrlData.mpCleanUnitStrings;
+}
+
DockingManager* ImplGetDockingManager()
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx
index 6bed493cacde..7cfdecbfdb00 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -62,6 +62,10 @@ extern Sequence< OUString > SAL_CALL FontIdentificator_getSupportedServiceNames(
extern OUString SAL_CALL FontIdentificator_getImplementationName();
extern Reference< XInterface > SAL_CALL FontIdentificator_createInstance( const Reference< XMultiServiceFactory > & );
+extern Sequence< OUString > SAL_CALL StringMirror_getSupportedServiceNames();
+extern OUString SAL_CALL StringMirror_getImplementationName();
+extern Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory > & );
+
extern Sequence< OUString > SAL_CALL Clipboard_getSupportedServiceNames();
extern OUString SAL_CALL Clipboard_getImplementationName();
extern Reference< XSingleServiceFactory > SAL_CALL Clipboard_createFactory( const Reference< XMultiServiceFactory > & );
@@ -84,62 +88,6 @@ extern "C" {
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- VCL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pXUnoKey )
- {
- if( pXUnoKey )
- {
- try
- {
- Reference< ::com::sun::star::registry::XRegistryKey > xKey( reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >( pXUnoKey ) );
-
- OUStringBuffer aImplName(64);
- aImplName.appendAscii( "/" );
- aImplName.append( vcl_session_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl_session_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
-
- aImplName.appendAscii( "/" );
- aImplName.append( vcl::DisplayAccess_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl::DisplayAccess_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
-
- aImplName.appendAscii( "/" );
- aImplName.append( vcl::FontIdentificator_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl::FontIdentificator_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
-
- #if defined UNX
- aImplName.appendAscii( "/" );
- aImplName.append( vcl::Clipboard_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl::Clipboard_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
-
- aImplName.appendAscii( "/" );
- aImplName.append( vcl::DragSource_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl::DragSource_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
-
- aImplName.appendAscii( "/" );
- aImplName.append( vcl::DropTarget_getImplementationName() );
- aImplName.appendAscii( "/UNO/SERVICES/" );
- aImplName.append( vcl::DropTarget_getSupportedServiceNames()[0] );
- xKey->createKey( aImplName.makeStringAndClear() );
- #endif
-
- return sal_True;
- }
- catch( ::com::sun::star::registry::InvalidRegistryException& )
- {
- }
- }
- return sal_False;
- }
-
VCL_DLLPUBLIC void* SAL_CALL component_getFactory(
const sal_Char* pImplementationName,
void* pXUnoSMgr,
@@ -172,6 +120,12 @@ extern "C" {
xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance,
vcl::FontIdentificator_getSupportedServiceNames() );
}
+ else if( vcl::StringMirror_getImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory(
+ xMgr, vcl::StringMirror_getImplementationName(), vcl::StringMirror_createInstance,
+ vcl::StringMirror_getSupportedServiceNames() );
+ }
else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) )
{
xFactory = vcl::Clipboard_createFactory( xMgr );
diff --git a/vcl/source/components/makefile.mk b/vcl/source/components/makefile.mk
index e30975dbc099..982687104c01 100644
--- a/vcl/source/components/makefile.mk
+++ b/vcl/source/components/makefile.mk
@@ -39,9 +39,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
-SLOFILES= $(SLO)$/display.obj \
- $(SLO)$/dtranscomp.obj \
- $(SLO)$/fontident.obj \
+SLOFILES= $(SLO)$/display.obj \
+ $(SLO)$/dtranscomp.obj \
+ $(SLO)$/fontident.obj \
+ $(SLO)$/stringmirror.obj \
$(SLO)$/factory.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/source/components/stringmirror.cxx b/vcl/source/components/stringmirror.cxx
new file mode 100644
index 000000000000..78806914a7c4
--- /dev/null
+++ b/vcl/source/components/stringmirror.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * 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"
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/util/XStringMapping.hpp"
+
+#include "cppuhelper/implbase2.hxx"
+#include "rtl/ustrbuf.hxx"
+#include "vcl/svapp.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+// -----------------------------------------------------------------------
+
+namespace vcl
+{
+
+class StringMirror : public ::cppu::WeakAggImplHelper2< XStringMapping, XServiceInfo >
+{
+public:
+ StringMirror()
+ {}
+
+ virtual ~StringMirror()
+ {}
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const OUString& ) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ // XStringMapping
+ virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException)
+ {
+ sal_Int32 nItems = io_rStrings.getLength();
+ for( sal_Int32 n = 0; n < nItems; n++ )
+ {
+ rtl::OUString& rStr( io_rStrings.getArray()[n] );
+
+ sal_Int32 nLen = rStr.getLength();
+ rtl::OUStringBuffer aMirror( nLen );
+ for(sal_Int32 i = nLen - 1; i >= 0; i--)
+ {
+ sal_Unicode cChar = rStr[ i ];
+ aMirror.append(sal_Unicode(GetMirroredChar(cChar)));
+ }
+ rStr = aMirror.makeStringAndClear();
+ }
+ return sal_True;
+ }
+};
+
+Sequence< OUString > StringMirror_getSupportedServiceNames()
+{
+ static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.StringMirror" ) );
+ static Sequence< OUString > aServiceNames( &aServiceName, 1 );
+ return aServiceNames;
+}
+
+OUString StringMirror_getImplementationName()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::StringMirror" ) );
+}
+
+Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory >& )
+{
+ return static_cast< ::cppu::OWeakObject * >( new StringMirror );
+}
+
+
+// XServiceInfo
+OUString SAL_CALL StringMirror::getImplementationName() throw (RuntimeException)
+{
+ return StringMirror_getImplementationName();
+}
+
+sal_Bool SAL_CALL StringMirror::supportsService( const OUString& i_rServiceName ) throw (RuntimeException)
+{
+ Sequence< OUString > aSN( StringMirror_getSupportedServiceNames() );
+ for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ )
+ {
+ if( aSN[nService] == i_rServiceName )
+ return sal_True;
+ }
+ return sal_False;
+}
+
+Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (RuntimeException)
+{
+ return StringMirror_getSupportedServiceNames();
+}
+
+} // namespace vcl
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index d4f29e224e7b..db7649a90258 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -896,7 +896,8 @@ void PushButton::ImplInitSettings( BOOL bFont,
// #i38498#: do not check for GetParent()->IsChildTransparentModeEnabled()
// otherwise the formcontrol button will be overdrawn due to PARENTCLIPMODE_NOCLIP
// for radio and checkbox this is ok as they shoud appear transparent in documents
- if ( IsNativeControlSupported( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL ) )
+ if ( IsNativeControlSupported( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL ) ||
+ (GetStyle() & WB_FLATBUTTON) != 0 )
{
EnableChildTransparentMode( TRUE );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
@@ -1155,7 +1156,9 @@ static void ImplDrawBtnDropDownArrow( OutputDevice* pDev,
void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags,
const Rectangle& rRect,
- bool bLayout )
+ bool bLayout,
+ bool bMenuBtnSep
+ )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Rectangle aInRect = rRect;
@@ -1203,19 +1206,22 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags
aSize.Width() -= ( 5 + nSymbolSize );
ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep,
- nDrawFlags, nTextStyle, NULL, (GetStyle() & WB_FLATBUTTON) != 0 );
+ nDrawFlags, nTextStyle, NULL, true );
}
else
ImplCalcSymbolRect( aInRect );
if( ! bLayout )
{
- DecorationView aDecoView( pDev );
long nDistance = (aInRect.GetHeight() > 10) ? 2 : 1;
- long nX = aInRect.Left() - 2*nDistance;;
- Point aStartPt( nX, aInRect.Top()+nDistance );
- Point aEndPt( nX, aInRect.Bottom()-nDistance );
- aDecoView.DrawSeparator( aStartPt, aEndPt );
+ DecorationView aDecoView( pDev );
+ if( bMenuBtnSep )
+ {
+ long nX = aInRect.Left() - 2*nDistance;;
+ Point aStartPt( nX, aInRect.Top()+nDistance );
+ Point aEndPt( nX, aInRect.Bottom()-nDistance );
+ aDecoView.DrawSeparator( aStartPt, aEndPt );
+ }
aDecoView.DrawSymbol( aInRect, SYMBOL_SPIN_DOWN, aColor, nStyle );
aInRect.Left() -= 2*nDistance;
ImplSetSymbolRect( aInRect );
@@ -1227,7 +1233,7 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags
// FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary
// in the next major this should be replaced by "true"
ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags,
- nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 );
+ nTextStyle, IsSymbol() ? &aSymbolRect : NULL, true );
if ( IsSymbol() && ! bLayout )
{
@@ -1356,6 +1362,12 @@ void PushButton::ImplDrawPushButton( bool bLayout )
return;
bool bRollOver = (IsMouseOver() && aInRect.IsInside( GetPointerPosPixel() ));
+ bool bDrawMenuSep = true;
+ if( (GetStyle() & WB_FLATBUTTON) )
+ {
+ if( ! bRollOver && ! HasFocus() )
+ bDrawMenuSep = false;
+ }
if ( (bNativeOK=IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL)) == TRUE )
{
PushButtonValue aControlValue;
@@ -1406,7 +1418,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
// draw content using the same aInRect as non-native VCL would do
ImplDrawPushButtonContent( this,
(nState&CTRL_STATE_ROLLOVER) ? WINDOW_DRAW_ROLLOVER : 0,
- aInRect, bLayout );
+ aInRect, bLayout, bDrawMenuSep );
if ( HasFocus() )
ShowFocus( ImplGetFocusRect() );
@@ -1432,7 +1444,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
}
// draw content
- ImplDrawPushButtonContent( this, 0, aInRect, bLayout );
+ ImplDrawPushButtonContent( this, 0, aInRect, bLayout, bDrawMenuSep );
if( ! bLayout && HasFocus() )
{
@@ -1753,7 +1765,7 @@ void PushButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
nButtonStyle |= BUTTON_DRAW_CHECKED;
aRect = aDecoView.DrawButton( aRect, nButtonStyle );
- ImplDrawPushButtonContent( pDev, nFlags, aRect, false );
+ ImplDrawPushButtonContent( pDev, nFlags, aRect, false, true );
pDev->Pop();
}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index c0e7b352642c..5091a4722845 100644..100755
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -122,6 +122,7 @@ struct DDInfo
BOOL bStarterOfDD;
BOOL bDroppedInMe;
BOOL bVisCursor;
+ BOOL bIsStringSupported;
DDInfo()
{
@@ -130,6 +131,7 @@ struct DDInfo
bStarterOfDD = FALSE;
bDroppedInMe = FALSE;
bVisCursor = FALSE;
+ bIsStringSupported = FALSE;
}
};
@@ -1799,6 +1801,9 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
}
break;
+ /* #i101255# disable autocomplete tab forward/backward
+ users expect tab/shif-tab to move the focus to other controls
+ not suddenly to cycle the autocompletion
case KEY_TAB:
{
if ( !mbReadOnly && maAutocompleteHdl.IsSet() &&
@@ -1820,6 +1825,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
}
}
break;
+ */
default:
{
@@ -2861,6 +2867,14 @@ Size Edit::CalcMinimumSize() const
return aSize;
}
+Size Edit::GetMinimumEditSize()
+{
+ Window* pDefWin = ImplGetDefaultWindow();
+ Edit aEdit( pDefWin, WB_BORDER );
+ Size aSize( aEdit.CalcMinimumSize() );
+ return aSize;
+}
+
// -----------------------------------------------------------------------
Size Edit::GetOptimalSize(WindowSizeType eType) const
@@ -3054,17 +3068,26 @@ void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent&
rDTDE.Context->dropComplete( bChanges );
}
-void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& ) throw (::com::sun::star::uno::RuntimeException)
+void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
{
if ( !mpDDInfo )
{
mpDDInfo = new DDInfo;
}
-// sal_Bool bTextContent = mbReadOnly ? sal_False : sal_True; // quiery from rDTDEE.SupportedDataFlavors()
-// if ( bTextContent )
-// rDTDEE.Context->acceptDrop(datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE);
-// else
-// rDTDEE.Context->rejectDrop();
+ // search for string data type
+ const Sequence< com::sun::star::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors );
+ sal_Int32 nEle = rFlavors.getLength();
+ mpDDInfo->bIsStringSupported = FALSE;
+ for( sal_Int32 i = 0; i < nEle; i++ )
+ {
+ sal_Int32 nIndex = 0;
+ rtl::OUString aMimetype = rFlavors[i].MimeType.getToken( 0, ';', nIndex );
+ if( aMimetype.equalsAscii( "text/plain" ) )
+ {
+ mpDDInfo->bIsStringSupported = TRUE;
+ break;
+ }
+ }
}
void Edit::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException)
@@ -3096,7 +3119,7 @@ void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEv
aSel.Justify();
// Don't accept drop in selection or read-only field...
- if ( IsReadOnly() || aSel.IsInside( mpDDInfo->nDropPos ) )
+ if ( IsReadOnly() || aSel.IsInside( mpDDInfo->nDropPos ) || ! mpDDInfo->bIsStringSupported )
{
ImplHideDDCursor();
rDTDE.Context->rejectDrag();
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 090aa2a84163..4c4e3c870429 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -52,8 +52,6 @@
using namespace ::com::sun::star;
-static ResStringArray *strAllUnits = NULL;
-
// -----------------------------------------------------------------------
#define FORMAT_NUMERIC 1
@@ -224,6 +222,42 @@ static BOOL ImplNumericGetValue( const XubString& rStr, double& rValue,
return TRUE;
}
+static void ImplUpdateSeparatorString( String& io_rText,
+ const String& rOldDecSep, const String& rNewDecSep,
+ const String& rOldThSep, const String& rNewThSep )
+{
+ rtl::OUStringBuffer aBuf( io_rText.Len() );
+ xub_StrLen nIndexDec = 0, nIndexTh = 0, nIndex = 0;
+
+ const sal_Unicode* pBuffer = io_rText.GetBuffer();
+ while( nIndex != STRING_NOTFOUND )
+ {
+ nIndexDec = io_rText.Search( rOldDecSep, nIndex );
+ nIndexTh = io_rText.Search( rOldThSep, nIndex );
+ if( (nIndexTh != STRING_NOTFOUND && nIndexDec != STRING_NOTFOUND && nIndexTh < nIndexDec )
+ || (nIndexTh != STRING_NOTFOUND && nIndexDec == STRING_NOTFOUND)
+ )
+ {
+ aBuf.append( pBuffer + nIndex, nIndexTh - nIndex );
+ aBuf.append( rNewThSep );
+ nIndex = nIndexTh + rOldThSep.Len();
+ }
+ else if( nIndexDec != STRING_NOTFOUND )
+ {
+ aBuf.append( pBuffer + nIndex, nIndexDec - nIndex );
+ aBuf.append( rNewDecSep );
+ nIndex = nIndexDec + rOldDecSep.Len();
+ }
+ else
+ {
+ aBuf.append( pBuffer + nIndex );
+ nIndex = STRING_NOTFOUND;
+ }
+ }
+
+ io_rText = aBuf.makeStringAndClear();
+}
+
static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDecSep,
const String& rOldThSep, const String& rNewThSep,
Edit* pEdit )
@@ -236,10 +270,7 @@ static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDe
BOOL bUpdateMode = pEdit->IsUpdateMode();
pEdit->SetUpdateMode( FALSE );
String aText = pEdit->GetText();
- if( bChangeDec )
- aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep );
- if( bChangeTh )
- aText.SearchAndReplaceAll( rNewThSep, rOldThSep );
+ ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep );
pEdit->SetText( aText );
ComboBox* pCombo = dynamic_cast<ComboBox*>(pEdit);
@@ -250,12 +281,11 @@ static void ImplUpdateSeparators( const String& rOldDecSep, const String& rNewDe
for ( USHORT i=0; i < nEntryCount; i++ )
{
aText = pCombo->GetEntry( i );
- if( bChangeDec )
- aText.SearchAndReplaceAll( rNewDecSep, rOldDecSep );
- if( bChangeTh )
- aText.SearchAndReplaceAll( rNewThSep, rOldThSep );
+ void* pEntryData = pCombo->GetEntryData( i );
+ ImplUpdateSeparatorString( aText, rOldDecSep, rNewDecSep, rOldThSep, rNewThSep );
pCombo->RemoveEntry( i );
pCombo->InsertEntry( aText, i );
+ pCombo->SetEntryData( i, pEntryData );
}
}
if( bUpdateMode )
@@ -1099,34 +1129,37 @@ static XubString ImplMetricGetUnitText( const XubString& rStr )
// #104355# support localized mesaurements
-static String ImplMetricToString( FieldUnit rUnit )
+static const String& ImplMetricToString( FieldUnit rUnit )
{
- if( !strAllUnits )
+ FieldUnitStringList* pList = ImplGetFieldUnits();
+ if( pList )
{
- ResMgr* pResMgr = ImplGetResMgr();
- strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) );
+ // return unit's default string (ie, the first one )
+ for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it )
+ {
+ if ( it->second == rUnit )
+ return it->first;
+ }
}
- // return unit's default string (ie, the first one )
- for( USHORT i=0; i < strAllUnits->Count(); i++ )
- if( (FieldUnit) strAllUnits->GetValue( i ) == rUnit )
- return strAllUnits->GetString( i );
- return String();
+ return String::EmptyString();
}
static FieldUnit ImplStringToMetric( const String &rMetricString )
{
- if( !strAllUnits )
+ FieldUnitStringList* pList = ImplGetCleanedFieldUnits();
+ if( pList )
{
- ResMgr* pResMgr = ImplGetResMgr();
- strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) );
+ // return FieldUnit
+ String aStr( rMetricString );
+ aStr.ToLowerAscii();
+ aStr.EraseAllChars( sal_Unicode( ' ' ) );
+ for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it )
+ {
+ if ( it->first.Equals( aStr ) )
+ return it->second;
+ }
}
- // return FieldUnit
- String aStr( rMetricString );
- aStr.ToLowerAscii();
- for( USHORT i=0; i < strAllUnits->Count(); i++ )
- if ( strAllUnits->GetString( i ).Equals( aStr ) )
- return (FieldUnit) strAllUnits->GetValue( i );
return FUNIT_NONE;
}
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 37406293d7cf..f73cf008a5e5 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -27,13 +27,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <vcl/decoview.hxx>
-#include <vcl/event.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/controldata.hxx>
-#include <vcl/window.h>
+#include "vcl/decoview.hxx"
+#include "vcl/event.hxx"
+#include "vcl/fixed.hxx"
+#include "vcl/controldata.hxx"
+#include "vcl/window.h"
-#include <tools/rc.h>
+#include "tools/rc.h"
// =======================================================================
@@ -501,7 +501,7 @@ void FixedLine::ImplDraw( bool bLayout )
String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL;
DecorationView aDecoView( this );
- if ( !aText.Len() || (nWinStyle & WB_VERT) )
+ if ( !aText.Len() )
{
if( !pVector )
{
@@ -520,11 +520,34 @@ void FixedLine::ImplDraw( bool bLayout )
}
}
}
+ else if( (nWinStyle & WB_VERT) )
+ {
+ long nWidth = GetTextWidth( aText );
+ Push( PUSH_FONT );
+ Font aFont( GetFont() );
+ aFont.SetOrientation( 900 );
+ SetFont( aFont );
+ Point aStartPt( aOutSize.Width()/2, aOutSize.Height()-1 );
+ if( (nWinStyle & WB_VCENTER) )
+ aStartPt.Y() -= (aOutSize.Height() - nWidth)/2;
+ Point aTextPt( aStartPt );
+ aTextPt.X() -= GetTextHeight()/2;
+ DrawText( aTextPt, aText, 0, STRING_LEN, pVector, pDisplayText );
+ Pop();
+ if( aOutSize.Height() - aStartPt.Y() > FIXEDLINE_TEXT_BORDER )
+ aDecoView.DrawSeparator( Point( aStartPt.X(), aOutSize.Height()-1 ),
+ Point( aStartPt.X(), aStartPt.Y() + FIXEDLINE_TEXT_BORDER ) );
+ if( aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER > 0 )
+ aDecoView.DrawSeparator( Point( aStartPt.X(), aStartPt.Y() - nWidth - FIXEDLINE_TEXT_BORDER ),
+ Point( aStartPt.X(), 0 ) );
+ }
else
{
USHORT nStyle = TEXT_DRAW_MNEMONIC | TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS;
Rectangle aRect( 0, 0, aOutSize.Width(), aOutSize.Height() );
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if( (nWinStyle & WB_CENTER) )
+ nStyle |= TEXT_DRAW_CENTER;
if ( !IsEnabled() )
nStyle |= TEXT_DRAW_DISABLE;
@@ -539,6 +562,8 @@ void FixedLine::ImplDraw( bool bLayout )
{
long nTop = aRect.Top() + ((aRect.GetHeight()-1)/2);
aDecoView.DrawSeparator( Point( aRect.Right()+FIXEDLINE_TEXT_BORDER, nTop ), Point( aOutSize.Width()-1, nTop ), false );
+ if( aRect.Left() > FIXEDLINE_TEXT_BORDER )
+ aDecoView.DrawSeparator( Point( 0, nTop ), Point( aRect.Left()-FIXEDLINE_TEXT_BORDER, nTop ), false );
}
}
}
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 02c8d2b5fcb3..bd0179ffe454 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -529,7 +529,8 @@ USHORT ImplEntryList::FindFirstSelectable( USHORT nPos, bool bForward /* = true
// =======================================================================
ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
- Control( pParent, 0 )
+ Control( pParent, 0 ),
+ maQuickSelectionEngine( *this )
{
mpEntryList = new ImplEntryList( this );
@@ -568,9 +569,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
SetTextFillColor();
SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
- maSearchTimeout.SetTimeout( 2500 );
- maSearchTimeout.SetTimeoutHdl( LINK( this, ImplListBoxWindow, SearchStringTimeout ) );
-
ImplInitSettings( TRUE, TRUE, TRUE );
ImplCalcMetrics();
}
@@ -579,7 +577,6 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
ImplListBoxWindow::~ImplListBoxWindow()
{
- maSearchTimeout.Stop();
delete mpEntryList;
}
@@ -624,14 +621,6 @@ void ImplListBoxWindow::ImplCalcMetrics()
// -----------------------------------------------------------------------
-IMPL_LINK( ImplListBoxWindow, SearchStringTimeout, Timer*, EMPTYARG )
-{
- maSearchStr.Erase();
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
void ImplListBoxWindow::Clear()
{
mpEntryList->Clear();
@@ -648,6 +637,7 @@ void ImplListBoxWindow::Clear()
ImplClearLayoutData();
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
+ maQuickSelectionEngine.Reset();
Invalidate();
}
@@ -918,7 +908,7 @@ USHORT ImplListBoxWindow::GetLastVisibleEntry() const
void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
if ( !IsReadOnly() )
{
@@ -1465,7 +1455,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1492,7 +1482,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1523,7 +1513,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1557,7 +1547,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1578,7 +1568,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
bDone = TRUE;
}
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1604,7 +1594,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1615,7 +1605,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ScrollHorz( -HORZ_SCROLL );
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1626,7 +1616,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ScrollHorz( HORZ_SCROLL );
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1638,7 +1628,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
ImplCallSelect();
bDone = FALSE; // RETURN nicht abfangen.
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1653,7 +1643,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
bDone = TRUE;
}
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
}
break;
@@ -1673,7 +1663,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
SetUpdateMode( bUpdates );
Invalidate();
- maSearchStr.Erase();
+ maQuickSelectionEngine.Reset();
bDone = TRUE;
break;
@@ -1682,43 +1672,12 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
// fall through intentional
default:
{
- xub_Unicode c = rKEvt.GetCharCode();
-
- if ( !IsReadOnly() && (c >= 32) && (c != 127) && !rKEvt.GetKeyCode().IsMod2() )
+ if ( !IsReadOnly() )
{
- maSearchStr += c;
- XubString aTmpSearch( maSearchStr );
-
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos );
- if ( (nSelect == LISTBOX_ENTRY_NOTFOUND) && (aTmpSearch.Len() > 1) )
- {
- // Wenn alles die gleichen Buchstaben, dann anderer Such-Modus
- BOOL bAllEqual = TRUE;
- for ( USHORT n = aTmpSearch.Len(); n && bAllEqual; )
- bAllEqual = aTmpSearch.GetChar( --n ) == c;
- if ( bAllEqual )
- {
- aTmpSearch = c;
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, mnCurrentPos+1 );
- }
- }
- if ( nSelect == LISTBOX_ENTRY_NOTFOUND )
- nSelect = mpEntryList->FindMatchingEntry( aTmpSearch, 0 );
-
- if ( nSelect != LISTBOX_ENTRY_NOTFOUND )
- {
- ShowProminentEntry( nSelect );
-
- if ( mpEntryList->IsEntryPosSelected( nSelect ) )
- nSelect = LISTBOX_ENTRY_NOTFOUND;
-
- maSearchTimeout.Start();
- }
- else
- maSearchStr.Erase();
- bDone = TRUE;
+ bDone = maQuickSelectionEngine.HandleKeyEvent( rKEvt );
}
- }
+ }
+ break;
}
if ( ( nSelect != LISTBOX_ENTRY_NOTFOUND )
@@ -1744,6 +1703,72 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
}
// -----------------------------------------------------------------------
+namespace
+{
+ static ::vcl::StringEntryIdentifier lcl_getEntry( const ImplEntryList& _rList, USHORT _nPos, String& _out_entryText )
+ {
+ OSL_PRECOND( ( _nPos != LISTBOX_ENTRY_NOTFOUND ), "lcl_getEntry: invalid position!" );
+ USHORT nEntryCount( _rList.GetEntryCount() );
+ if ( _nPos >= nEntryCount )
+ _nPos = 0;
+ _out_entryText = _rList.GetEntryText( _nPos );
+
+ // ::vcl::StringEntryIdentifier does not allow for 0 values, but our position is 0-based
+ // => normalize
+ return reinterpret_cast< ::vcl::StringEntryIdentifier >( _nPos + 1 );
+ }
+
+ static USHORT lcl_getEntryPos( ::vcl::StringEntryIdentifier _entry )
+ {
+ // our pos is 0-based, but StringEntryIdentifier does not allow for a NULL
+ return static_cast< USHORT >( reinterpret_cast< sal_Int64 >( _entry ) ) - 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+::vcl::StringEntryIdentifier ImplListBoxWindow::CurrentEntry( String& _out_entryText ) const
+{
+ return lcl_getEntry( *GetEntryList(), ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND ) ? 0 : mnCurrentPos + 1, _out_entryText );
+}
+
+// -----------------------------------------------------------------------
+::vcl::StringEntryIdentifier ImplListBoxWindow::NextEntry( ::vcl::StringEntryIdentifier _currentEntry, String& _out_entryText ) const
+{
+ USHORT nNextPos = lcl_getEntryPos( _currentEntry ) + 1;
+ return lcl_getEntry( *GetEntryList(), nNextPos, _out_entryText );
+}
+
+// -----------------------------------------------------------------------
+void ImplListBoxWindow::SelectEntry( ::vcl::StringEntryIdentifier _entry )
+{
+ USHORT nSelect = lcl_getEntryPos( _entry );
+ if ( mpEntryList->IsEntryPosSelected( nSelect ) )
+ {
+ // ignore that. This method is a callback from the QuickSelectionEngine, which means the user attempted
+ // to select the given entry by typing its starting letters. No need to act.
+ return;
+ }
+
+ // normalize
+ OSL_ENSURE( nSelect < mpEntryList->GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" );
+ if( nSelect >= mpEntryList->GetEntryCount() )
+ nSelect = mpEntryList->GetEntryCount()-1;
+
+ // make visible
+ ShowProminentEntry( nSelect );
+
+ // actually select
+ mnCurrentPos = nSelect;
+ if ( SelectEntries( nSelect, LET_KEYMOVE, FALSE, FALSE ) )
+ {
+ mbTravelSelect = TRUE;
+ mnSelectModifier = 0;
+ ImplCallSelect();
+ mbTravelSelect = FALSE;
+ }
+}
+
+// -----------------------------------------------------------------------
void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout )
{
@@ -2356,7 +2381,11 @@ IMPL_LINK( ImplListBox, MRUChanged, void*, EMPTYARG )
IMPL_LINK( ImplListBox, LBWindowScrolled, void*, EMPTYARG )
{
+ long nSet = GetTopEntry();
+ if( nSet > mpVScrollBar->GetRangeMax() )
+ mpVScrollBar->SetRangeMax( GetEntryList()->GetEntryCount() );
mpVScrollBar->SetThumbPos( GetTopEntry() );
+
mpHScrollBar->SetThumbPos( GetLeftIndent() );
maScrollHdl.Call( this );
@@ -2395,7 +2424,11 @@ void ImplListBox::ImplCheckScrollBars()
mbVScroll = TRUE;
// Ueberpruefung des rausgescrollten Bereichs
- SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
+ if( GetEntryList()->GetSelectEntryCount() == 1 &&
+ GetEntryList()->GetSelectEntryPos( 0 ) != LISTBOX_ENTRY_NOTFOUND )
+ ShowProminentEntry( GetEntryList()->GetSelectEntryPos( 0 ) );
+ else
+ SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
}
else
{
@@ -2428,7 +2461,11 @@ void ImplListBox::ImplCheckScrollBars()
mbVScroll = TRUE;
// Ueberpruefung des rausgescrollten Bereichs
- SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
+ if( GetEntryList()->GetSelectEntryCount() == 1 &&
+ GetEntryList()->GetSelectEntryPos( 0 ) != LISTBOX_ENTRY_NOTFOUND )
+ ShowProminentEntry( GetEntryList()->GetSelectEntryPos( 0 ) );
+ else
+ SetTopEntry( GetTopEntry() ); // MaxTop wird geprueft...
}
}
diff --git a/vcl/source/control/makefile.mk b/vcl/source/control/makefile.mk
index a2553333246d..b1644e58ccd9 100644
--- a/vcl/source/control/makefile.mk
+++ b/vcl/source/control/makefile.mk
@@ -62,7 +62,8 @@ SLOFILES= $(SLO)$/button.obj \
$(SLO)$/slider.obj \
$(SLO)$/spinfld.obj \
$(SLO)$/spinbtn.obj \
- $(SLO)$/tabctrl.obj
+ $(SLO)$/tabctrl.obj \
+ $(SLO)$/quickselectionengine.obj
EXCEPTIONSFILES= \
$(SLO)$/button.obj \
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
new file mode 100644
index 000000000000..2d32393bf79a
--- /dev/null
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* 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"
+
+#include "vcl/quickselectionengine.hxx"
+#include "vcl/event.hxx"
+#include "vcl/timer.hxx"
+#include "vcl/i18nhelp.hxx"
+#include "vcl/svapp.hxx"
+
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace vcl
+{
+//........................................................................
+
+ //====================================================================
+ //= QuickSelectionEngine_Data
+ //====================================================================
+ struct QuickSelectionEngine_Data
+ {
+ ISearchableStringList& rEntryList;
+ String sCurrentSearchString;
+ ::boost::optional< sal_Unicode > aSingleSearchChar;
+ Timer aSearchTimeout;
+
+ QuickSelectionEngine_Data( ISearchableStringList& _entryList )
+ :rEntryList( _entryList )
+ ,sCurrentSearchString()
+ ,aSingleSearchChar()
+ ,aSearchTimeout()
+ {
+ aSearchTimeout.SetTimeout( 2500 );
+ aSearchTimeout.SetTimeoutHdl( LINK( this, QuickSelectionEngine_Data, SearchStringTimeout ) );
+ }
+
+ ~QuickSelectionEngine_Data()
+ {
+ aSearchTimeout.Stop();
+ }
+
+ DECL_LINK( SearchStringTimeout, Timer* );
+ };
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ static void lcl_reset( QuickSelectionEngine_Data& _data )
+ {
+ _data.sCurrentSearchString.Erase();
+ _data.aSingleSearchChar.reset();
+ _data.aSearchTimeout.Stop();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( QuickSelectionEngine_Data, SearchStringTimeout, Timer*, /*EMPTYARG*/ )
+ {
+ lcl_reset( *this );
+ return 1;
+ }
+
+ //--------------------------------------------------------------------
+ static StringEntryIdentifier findMatchingEntry( const String& _searchString, QuickSelectionEngine_Data& _engineData )
+ {
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetLocaleI18nHelper();
+ // TODO: do we really need the Window's settings here? The original code used it ...
+
+ String sEntryText;
+ // get the "current + 1" entry
+ StringEntryIdentifier pSearchEntry = _engineData.rEntryList.CurrentEntry( sEntryText );
+ if ( pSearchEntry )
+ pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText );
+ // loop 'til we find another matching entry
+ StringEntryIdentifier pStartedWith = pSearchEntry;
+ while ( pSearchEntry )
+ {
+ if ( rI18nHelper.MatchString( _searchString, sEntryText ) != 0 )
+ break;
+
+ pSearchEntry = _engineData.rEntryList.NextEntry( pSearchEntry, sEntryText );
+ if ( pSearchEntry == pStartedWith )
+ pSearchEntry = NULL;
+ }
+
+ return pSearchEntry;
+ }
+
+ //====================================================================
+ //= QuickSelectionEngine
+ //====================================================================
+ //--------------------------------------------------------------------
+ QuickSelectionEngine::QuickSelectionEngine( ISearchableStringList& _entryList )
+ :m_pData( new QuickSelectionEngine_Data( _entryList ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ QuickSelectionEngine::~QuickSelectionEngine()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ bool QuickSelectionEngine::HandleKeyEvent( const KeyEvent& _keyEvent )
+ {
+ xub_Unicode c = _keyEvent.GetCharCode();
+
+ if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
+ {
+ m_pData->sCurrentSearchString += c;
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", ByteString( m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8 ).GetBuffer() );
+
+ if ( m_pData->sCurrentSearchString.Len() == 1 )
+ { // first character in the search -> remmeber
+ m_pData->aSingleSearchChar.reset( c );
+ }
+ else if ( m_pData->sCurrentSearchString.Len() > 1 )
+ {
+ if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
+ // we already have a "single char", but the current one is different -> reset
+ m_pData->aSingleSearchChar.reset();
+ }
+
+ XubString aSearchTemp( m_pData->sCurrentSearchString );
+
+ StringEntryIdentifier pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: found %p", pMatchingEntry );
+ if ( !pMatchingEntry && ( aSearchTemp.Len() > 1 ) && !!m_pData->aSingleSearchChar )
+ {
+ // if there's only one letter in the search string, use a different search mode
+ aSearchTemp = *m_pData->aSingleSearchChar;
+ pMatchingEntry = findMatchingEntry( aSearchTemp, *m_pData );
+ }
+
+ if ( pMatchingEntry )
+ {
+ m_pData->rEntryList.SelectEntry( pMatchingEntry );
+ m_pData->aSearchTimeout.Start();
+ }
+ else
+ {
+ lcl_reset( *m_pData );
+ }
+
+ return true;
+ }
+ return false;
+ }
+
+ //--------------------------------------------------------------------
+ void QuickSelectionEngine::Reset()
+ {
+ lcl_reset( *m_pData );
+ }
+
+//........................................................................
+} // namespace vcl
+//........................................................................
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index c892b32534ec..e9696aa8c492 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -42,7 +42,6 @@
#include "vcl/controldata.hxx"
#include "vcl/sound.hxx"
#include "vcl/lstbox.hxx"
-#include "vcl/smartid.hxx"
#include "vcl/window.h"
@@ -59,7 +58,7 @@ struct ImplTabItem
String maText;
String maFormatText;
String maHelpText;
- ULONG mnHelpId;
+ rtl::OString maHelpId;
Rectangle maRect;
USHORT mnLine;
bool mbFullVisible;
@@ -67,7 +66,7 @@ struct ImplTabItem
Image maTabImage;
ImplTabItem()
- : mnId( 0 ), mnTabPageResId( 0 ), mpTabPage( NULL ), mnHelpId( 0 ),
+ : mnId( 0 ), mnTabPageResId( 0 ), mpTabPage( NULL ),
mnLine( 0 ), mbFullVisible( FALSE ), mbEnabled( true )
{}
};
@@ -151,7 +150,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
mbRestoreUnqId = FALSE;
mbSingleLine = FALSE;
mbScroll = FALSE;
- mbRestoreSmartId = FALSE;
mbSmallInvalidate = FALSE;
mbExtraSpace = FALSE;
mpTabCtrlData = new ImplTabCtrlData;
@@ -705,11 +703,9 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
if ( pOldPage )
{
if ( mbRestoreHelpId )
- pCtrlParent->SetHelpId( 0 );
+ pCtrlParent->SetHelpId( rtl::OString() );
if ( mbRestoreUnqId )
- pCtrlParent->SetUniqueId( 0 );
- if( mbRestoreSmartId )
- pCtrlParent->SetSmartHelpId( SmartId() );
+ pCtrlParent->SetUniqueId( rtl::OString() );
pOldPage->DeactivatePage();
}
@@ -719,21 +715,16 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId )
// activate page here so the conbtrols can be switched
// also set the help id of the parent window to that of the tab page
- if ( !GetHelpId() )
+ if ( !GetHelpId().getLength() )
{
mbRestoreHelpId = TRUE;
pCtrlParent->SetHelpId( pPage->GetHelpId() );
}
- if ( !pCtrlParent->GetUniqueId() )
+ if ( !pCtrlParent->GetUniqueId().getLength() )
{
mbRestoreUnqId = TRUE;
pCtrlParent->SetUniqueId( pPage->GetUniqueId() );
}
- if( ! GetSmartHelpId().HasAny() )
- {
- mbRestoreSmartId = TRUE;
- pCtrlParent->SetSmartHelpId( pPage->GetSmartHelpId() );
- }
pPage->ActivatePage();
@@ -1486,13 +1477,13 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt )
}
else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
{
- ULONG nHelpId = GetHelpId( nItemId );
- if ( nHelpId )
+ rtl::OUString aHelpId( rtl::OStringToOUString( GetHelpId( nItemId ), RTL_TEXTENCODING_UTF8 ) );
+ if ( aHelpId.getLength() )
{
// Wenn eine Hilfe existiert, dann ausloesen
Help* pHelp = Application::GetHelp();
if ( pHelp )
- pHelp->Start( nHelpId, this );
+ pHelp->Start( aHelpId, this );
return;
}
}
@@ -1574,7 +1565,7 @@ void TabControl::Command( const CommandEvent& rCEvt )
aMenu.InsertItem( it->mnId, it->maText, MIB_CHECKABLE | MIB_RADIOCHECK );
if ( it->mnId == mnCurPageId )
aMenu.CheckItem( it->mnId );
- aMenu.SetHelpId( it->mnId, it->mnHelpId );
+ aMenu.SetHelpId( it->mnId, it->maHelpId );
}
USHORT nId = aMenu.Execute( this, aMenuPos );
@@ -1826,7 +1817,6 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText,
pItem->mnId = nPageId;
pItem->mpTabPage = NULL;
pItem->mnTabPageResId = 0;
- pItem->mnHelpId = 0;
pItem->maText = rText;
pItem->mbFullVisible = FALSE;
@@ -2154,11 +2144,11 @@ const XubString& TabControl::GetHelpText( USHORT nPageId ) const
if ( pItem )
{
- if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
+ if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() )
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
- pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this );
+ pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
}
return pItem->maHelpText;
@@ -2169,24 +2159,25 @@ const XubString& TabControl::GetHelpText( USHORT nPageId ) const
// -----------------------------------------------------------------------
-void TabControl::SetHelpId( USHORT nPageId, ULONG nHelpId )
+void TabControl::SetHelpId( USHORT nPageId, const rtl::OString& rHelpId )
{
ImplTabItem* pItem = ImplGetItem( nPageId );
if ( pItem )
- pItem->mnHelpId = nHelpId;
+ pItem->maHelpId = rHelpId;
}
// -----------------------------------------------------------------------
-ULONG TabControl::GetHelpId( USHORT nPageId ) const
+rtl::OString TabControl::GetHelpId( USHORT nPageId ) const
{
+ rtl::OString aRet;
ImplTabItem* pItem = ImplGetItem( nPageId );
if ( pItem )
- return pItem->mnHelpId;
- else
- return 0;
+ aRet = pItem->maHelpId;
+
+ return aRet;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 9e2a21b43e37..ec476157fbeb 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -961,8 +961,8 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
const long nScanlineSize = pWriteAcc->GetScanlineSize();
const long nNewWidth1 = nNewWidth - 1L;
const long nNewHeight1 = nNewHeight - 1L;
- const long nWidth1 = pReadAcc->Width() - 1L;
- const long nHeight1 = pReadAcc->Height() - 1L;
+ const long nWidth = pReadAcc->Width();
+ const long nHeight = pReadAcc->Height();
long* pLutX = new long[ nNewWidth ];
long* pLutY = new long[ nNewHeight ];
long nX, nY, nMapY, nActY = 0L;
@@ -970,10 +970,10 @@ BOOL Bitmap::ImplScaleFast( const double& rScaleX, const double& rScaleY )
if( nNewWidth1 && nNewHeight1 )
{
for( nX = 0L; nX < nNewWidth; nX++ )
- pLutX[ nX ] = nX * nWidth1 / nNewWidth1;
+ pLutX[ nX ] = nX * nWidth / nNewWidth;
for( nY = 0L; nY < nNewHeight; nY++ )
- pLutY[ nY ] = nY * nHeight1 / nNewHeight1;
+ pLutY[ nY ] = nY * nHeight / nNewHeight;
while( nActY < nNewHeight )
{
diff --git a/vcl/source/gdi/impimage.cxx b/vcl/source/gdi/impimage.cxx
index 476ac3ca44a9..3105850c4fbf 100644
--- a/vcl/source/gdi/impimage.cxx
+++ b/vcl/source/gdi/impimage.cxx
@@ -553,14 +553,14 @@ void ImplImageBmp::Draw( USHORT nPos, OutputDevice* pOutDev,
// -----------------------------------------------------------------------
void ImplImageBmp::ImplUpdateDisplayBmp( OutputDevice*
-#if defined WIN || defined WNT
+#if defined WNT
pOutDev
#endif
)
{
if( !mpDisplayBmp && !maBmpEx.IsEmpty() )
{
-#if defined WIN || defined WNT
+#if defined WNT
if( maBmpEx.IsAlpha() )
mpDisplayBmp = new BitmapEx( maBmpEx );
else
diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx
deleted file mode 100644
index 5224286cdad1..000000000000
--- a/vcl/source/gdi/impprn.cxx
+++ /dev/null
@@ -1,584 +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"
-
-#define _SPOOLPRINTER_EXT
-#include "tools/queue.hxx"
-#include "vcl/svapp.hxx"
-#include "vcl/metaact.hxx"
-#include "vcl/gdimtf.hxx"
-#include "vcl/timer.hxx"
-#include "vcl/impprn.hxx"
-#include "vcl/jobset.h"
-
-#include "vcl/svdata.hxx"
-#include "vcl/salprn.hxx"
-
-// -----------
-// - Defines -
-// -----------
-
-#define OPTIMAL_BMP_RESOLUTION 300
-#define NORMAL_BMP_RESOLUTION 200
-
-// =======================================================================
-
-struct QueuePage
-{
- GDIMetaFile* mpMtf;
- JobSetup* mpSetup;
- USHORT mnPage;
- BOOL mbEndJob;
-
- QueuePage() { mpMtf = NULL; mpSetup = NULL; }
- ~QueuePage() { delete mpMtf; if ( mpSetup ) delete mpSetup; }
-};
-
-// =======================================================================
-
-ImplQPrinter::ImplQPrinter( Printer* pParent ) :
- Printer( pParent->GetName() ),
- mpParent( pParent ),
- mbAborted( false ),
- mbUserCopy( false ),
- mbDestroyAllowed( true ),
- mbDestroyed( false ),
- mnMaxBmpDPIX( mnDPIX ),
- mnMaxBmpDPIY( mnDPIY ),
- mnCurCopyCount( 0 )
-{
- SetSelfAsQueuePrinter( TRUE );
- SetPrinterProps( pParent );
- SetPageQueueSize( 0 );
- mnCopyCount = pParent->mnCopyCount;
- mbCollateCopy = pParent->mbCollateCopy;
-}
-
-// -----------------------------------------------------------------------
-
-ImplQPrinter::~ImplQPrinter()
-{
- for( std::vector< QueuePage* >::iterator it = maQueue.begin();
- it != maQueue.end(); ++it )
- delete (*it);
-}
-
-// -----------------------------------------------------------------------------
-
-void ImplQPrinter::Destroy()
-{
- if( mbDestroyAllowed )
- delete this;
- else
- mbDestroyed = TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::ImplPrintMtf( GDIMetaFile& rPrtMtf, long nMaxBmpDPIX, long nMaxBmpDPIY )
-{
- for( MetaAction* pAct = rPrtMtf.FirstAction(); pAct && !mbAborted; pAct = rPrtMtf.NextAction() )
- {
- const ULONG nType = pAct->GetType();
- sal_Bool bExecuted = sal_False;
-
- if( nType == META_COMMENT_ACTION )
- {
- // search for special comments ( ..._BEGIN/..._END )
- MetaCommentAction* pComment = (MetaCommentAction*) pAct;
-
- if( pComment->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
- {
- pAct = rPrtMtf.NextAction();
-
- // if next action is a GradientEx action, execute this and
- // skip actions until a XGRAD_SEQ_END comment is found
- if( pAct && ( pAct->GetType() == META_GRADIENTEX_ACTION ) )
- {
- MetaGradientExAction* pGradientExAction = (MetaGradientExAction*) pAct;
- DrawGradientEx( this, pGradientExAction->GetPolyPolygon(), pGradientExAction->GetGradient() );
-
- // seek to end of this comment
- do
- {
- pAct = rPrtMtf.NextAction();
- }
- while( pAct &&
- ( ( pAct->GetType() != META_COMMENT_ACTION ) ||
- ( ( (MetaCommentAction*) pAct )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) != COMPARE_EQUAL ) ) );
-
- bExecuted = sal_True;
- }
- }
- else if( pComment->GetComment().CompareIgnoreCaseToAscii( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) == COMPARE_EQUAL )
- {
- pAct = rPrtMtf.NextAction();
-
- if( pAct && ( pAct->GetType() == META_BMPSCALE_ACTION ) )
- {
- // execute action here to avoid DPI processing of bitmap;
- pAct->Execute( this );
-
-#ifdef VERBOSE_DEBUG
- Push();
- SetLineColor(COL_RED);
- SetFillColor();
- DrawRect( Rectangle(
- static_cast<MetaBmpScaleAction*>(pAct)->GetPoint(),
- static_cast<MetaBmpScaleAction*>(pAct)->GetSize()) );
- Pop();
-#endif
-
- // seek to end of this comment
- do
- {
- pAct = rPrtMtf.NextAction();
- }
- while( pAct &&
- ( ( pAct->GetType() != META_COMMENT_ACTION ) ||
- ( ( (MetaCommentAction*) pAct )->GetComment().CompareIgnoreCaseToAscii( "PRNSPOOL_TRANSPARENTBITMAP_END" ) != COMPARE_EQUAL ) ) );
-
- bExecuted = sal_True;
- }
- }
- }
- else if( nType == META_GRADIENT_ACTION )
- {
- MetaGradientAction* pGradientAction = (MetaGradientAction*) pAct;
- DrawGradientEx( this, pGradientAction->GetRect(), pGradientAction->GetGradient() );
- bExecuted = sal_True;
- }
- else if( nType == META_BMPSCALE_ACTION )
- {
- MetaBmpScaleAction* pBmpScaleAction = (MetaBmpScaleAction*) pAct;
- const Bitmap& rBmp = pBmpScaleAction->GetBitmap();
-
- DrawBitmap( pBmpScaleAction->GetPoint(), pBmpScaleAction->GetSize(),
- GetDownsampledBitmap( pBmpScaleAction->GetSize(),
- Point(), rBmp.GetSizePixel(),
- rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) );
-
- bExecuted = sal_True;
- }
- else if( nType == META_BMPSCALEPART_ACTION )
- {
- MetaBmpScalePartAction* pBmpScalePartAction = (MetaBmpScalePartAction*) pAct;
- const Bitmap& rBmp = pBmpScalePartAction->GetBitmap();
-
- DrawBitmap( pBmpScalePartAction->GetDestPoint(), pBmpScalePartAction->GetDestSize(),
- GetDownsampledBitmap( pBmpScalePartAction->GetDestSize(),
- pBmpScalePartAction->GetSrcPoint(), pBmpScalePartAction->GetSrcSize(),
- rBmp, nMaxBmpDPIX, nMaxBmpDPIY ) );
-
- bExecuted = sal_True;
- }
- else if( nType == META_BMPEXSCALE_ACTION )
- {
- MetaBmpExScaleAction* pBmpExScaleAction = (MetaBmpExScaleAction*) pAct;
- const BitmapEx& rBmpEx = pBmpExScaleAction->GetBitmapEx();
-
- DrawBitmapEx( pBmpExScaleAction->GetPoint(), pBmpExScaleAction->GetSize(),
- GetDownsampledBitmapEx( pBmpExScaleAction->GetSize(),
- Point(), rBmpEx.GetSizePixel(),
- rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) );
-
- bExecuted = sal_True;
- }
- else if( nType == META_BMPEXSCALEPART_ACTION )
- {
- MetaBmpExScalePartAction* pBmpExScalePartAction = (MetaBmpExScalePartAction*) pAct;
- const BitmapEx& rBmpEx = pBmpExScalePartAction->GetBitmapEx();
-
- DrawBitmapEx( pBmpExScalePartAction->GetDestPoint(), pBmpExScalePartAction->GetDestSize(),
- GetDownsampledBitmapEx( pBmpExScalePartAction->GetDestSize(),
- pBmpExScalePartAction->GetSrcPoint(), pBmpExScalePartAction->GetSrcSize(),
- rBmpEx, nMaxBmpDPIX, nMaxBmpDPIY ) );
-
- bExecuted = sal_True;
- }
- else if( nType == META_TRANSPARENT_ACTION )
- {
- MetaTransparentAction* pTransAct = static_cast<MetaTransparentAction*>(pAct);
- USHORT nTransparency( pTransAct->GetTransparence() );
-
- // #i10613# Respect transparency for draw color
- if( nTransparency )
- {
- Push( PUSH_LINECOLOR|PUSH_FILLCOLOR );
-
- // assume white background for alpha blending
- Color aLineColor( GetLineColor() );
- aLineColor.SetRed( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetRed()) / 100L ) );
- aLineColor.SetGreen( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetGreen()) / 100L ) );
- aLineColor.SetBlue( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetBlue()) / 100L ) );
- SetLineColor( aLineColor );
-
- Color aFillColor( GetFillColor() );
- aFillColor.SetRed( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetRed()) / 100L ) );
- aFillColor.SetGreen( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetGreen()) / 100L ) );
- aFillColor.SetBlue( static_cast<UINT8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetBlue()) / 100L ) );
- SetFillColor( aFillColor );
- }
-
- DrawPolyPolygon( pTransAct->GetPolyPolygon() );
-
- if( nTransparency )
- Pop();
-
- bExecuted = sal_True;
- }
- else if( nType == META_FLOATTRANSPARENT_ACTION )
- {
- MetaFloatTransparentAction* pFloatAction = (MetaFloatTransparentAction*) pAct;
- GDIMetaFile& rMtf = (GDIMetaFile&) pFloatAction->GetGDIMetaFile();
- MapMode aDrawMap( rMtf.GetPrefMapMode() );
- Point aDestPoint( LogicToPixel( pFloatAction->GetPoint() ) );
- Size aDestSize( LogicToPixel( pFloatAction->GetSize() ) );
-
- if( aDestSize.Width() && aDestSize.Height() )
- {
- Size aTmpPrefSize( LogicToPixel( rMtf.GetPrefSize(), aDrawMap ) );
-
- if( !aTmpPrefSize.Width() )
- aTmpPrefSize.Width() = aDestSize.Width();
-
- if( !aTmpPrefSize.Height() )
- aTmpPrefSize.Height() = aDestSize.Height();
-
- Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() );
- Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() );
-
- aDrawMap.SetScaleX( aScaleX *= aDrawMap.GetScaleX() );
- aDrawMap.SetScaleY( aScaleY *= aDrawMap.GetScaleY() );
- aDrawMap.SetOrigin( PixelToLogic( aDestPoint, aDrawMap ) );
-
- Push();
- SetMapMode( aDrawMap );
- ImplPrintMtf( rMtf, nMaxBmpDPIX, nMaxBmpDPIY );
- Pop();
- }
-
- bExecuted = sal_True;
- }
-
- if( !bExecuted && pAct )
- pAct->Execute( this );
-
- if( ! ImplGetSVData()->maGDIData.mbPrinterPullModel )
- Application::Reschedule();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::PrePrintPage( QueuePage* pPage )
-{
- mnRestoreDrawMode = GetDrawMode();
- mnMaxBmpDPIX = mnDPIX;
- mnMaxBmpDPIY = mnDPIY;
-
- const PrinterOptions& rPrinterOptions = GetPrinterOptions();
-
- if( rPrinterOptions.IsReduceBitmaps() )
- {
- // calculate maximum resolution for bitmap graphics
- if( PRINTER_BITMAP_OPTIMAL == rPrinterOptions.GetReducedBitmapMode() )
- {
- mnMaxBmpDPIX = Min( (long) OPTIMAL_BMP_RESOLUTION, mnMaxBmpDPIX );
- mnMaxBmpDPIY = Min( (long) OPTIMAL_BMP_RESOLUTION, mnMaxBmpDPIY );
- }
- else if( PRINTER_BITMAP_NORMAL == rPrinterOptions.GetReducedBitmapMode() )
- {
- mnMaxBmpDPIX = Min( (long) NORMAL_BMP_RESOLUTION, mnMaxBmpDPIX );
- mnMaxBmpDPIY = Min( (long) NORMAL_BMP_RESOLUTION, mnMaxBmpDPIY );
- }
- else
- {
- mnMaxBmpDPIX = Min( (long) rPrinterOptions.GetReducedBitmapResolution(), mnMaxBmpDPIX );
- mnMaxBmpDPIY = Min( (long) rPrinterOptions.GetReducedBitmapResolution(), mnMaxBmpDPIY );
- }
- }
-
- // convert to greysacles
- if( rPrinterOptions.IsConvertToGreyscales() )
- {
- SetDrawMode( GetDrawMode() | ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
- DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
- }
-
- // disable transparency output
- if( rPrinterOptions.IsReduceTransparency() && ( PRINTER_TRANSPARENCY_NONE == rPrinterOptions.GetReducedTransparencyMode() ) )
- {
- SetDrawMode( GetDrawMode() | DRAWMODE_NOTRANSPARENCY );
- }
-
- maCurPageMetaFile = GDIMetaFile();
- RemoveTransparenciesFromMetaFile( *pPage->mpMtf, maCurPageMetaFile, mnMaxBmpDPIX, mnMaxBmpDPIY,
- rPrinterOptions.IsReduceTransparency(),
- rPrinterOptions.GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO,
- rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency()
- );
-}
-
-void ImplQPrinter::PostPrintPage()
-{
- SetDrawMode( mnRestoreDrawMode );
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::PrintPage( unsigned int nPage )
-{
- if( nPage >= maQueue.size() )
- return;
- mnCurCopyCount = (mbUserCopy && !mbCollateCopy) ? mnCopyCount : 1;
- QueuePage* pActPage = maQueue[nPage];
- PrePrintPage( pActPage );
- if ( pActPage->mpSetup )
- SetJobSetup( *pActPage->mpSetup );
-
- StartPage();
- ImplPrintMtf( maCurPageMetaFile, mnMaxBmpDPIX, mnMaxBmpDPIY );
- EndPage();
-
- mnCurCopyCount--;
- if( mnCurCopyCount == 0 )
- PostPrintPage();
-}
-
-// -----------------------------------------------------------------------
-
-ImplJobSetup* ImplQPrinter::GetPageSetup( unsigned int nPage ) const
-{
- return nPage >= maQueue.size() ? NULL :
- ( maQueue[nPage]->mpSetup ? maQueue[nPage]->mpSetup->ImplGetData() : NULL );
-}
-
-// -----------------------------------------------------------------------
-ULONG ImplQPrinter::GetPrintPageCount() const
-{
- ULONG nPageCount = maQueue.size() * ((mbUserCopy && !mbCollateCopy) ? mnCopyCount : 1);
- return nPageCount;
-}
-
-// -----------------------------------------------------------------------
-
-IMPL_LINK( ImplQPrinter, ImplPrintHdl, Timer*, EMPTYARG )
-{
- // Ist Drucken abgebrochen wurden?
- if( !IsPrinting() || ( mpParent->IsJobActive() && ( maQueue.size() < (ULONG)mpParent->GetPageQueueSize() ) ) )
- return 0;
-
- // Druck-Job zuende?
- QueuePage* pActPage = maQueue.front();
- maQueue.erase( maQueue.begin() );
-
-
- vcl::DeletionListener aDel( this );
- if ( pActPage->mbEndJob )
- {
- maTimer.Stop();
- delete pActPage;
- if( ! EndJob() )
- mpParent->Error();
- if( ! aDel.isDeleted() )
- mpParent->ImplEndPrint();
- }
- else
- {
- mbDestroyAllowed = FALSE;
-
- PrePrintPage( pActPage );
-
- USHORT nCopyCount = 1;
- if( mbUserCopy && !mbCollateCopy )
- nCopyCount = mnCopyCount;
-
- for ( USHORT i = 0; i < nCopyCount; i++ )
- {
- if ( pActPage->mpSetup )
- {
- SetJobSetup( *pActPage->mpSetup );
- if ( mbAborted )
- break;
- }
-
- StartPage();
-
- if ( mbAborted )
- break;
-
- ImplPrintMtf( maCurPageMetaFile, mnMaxBmpDPIX, mnMaxBmpDPIY );
-
- if( !mbAborted )
- EndPage();
- else
- break;
- }
-
- PostPrintPage();
-
- delete pActPage;
- mbDestroyAllowed = TRUE;
-
- if( mbDestroyed )
- Destroy();
- }
-
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::StartQueuePrint()
-{
- if( ! ImplGetSVData()->maGDIData.mbPrinterPullModel )
- {
- maTimer.SetTimeout( 50 );
- maTimer.SetTimeoutHdl( LINK( this, ImplQPrinter, ImplPrintHdl ) );
- maTimer.Start();
- }
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::EndQueuePrint()
-{
- if( ImplGetSVData()->maGDIData.mbPrinterPullModel )
- {
- DBG_ASSERT( mpPrinter, "no SalPrinter in ImplQPrinter" );
- if( mpPrinter )
- {
- #if 0
- mpPrinter->StartJob( mbPrintFile ? &maPrintFile : NULL,
- Application::GetDisplayName(),
- maJobSetup.ImplGetConstData(),
- this );
- #endif
- EndJob();
- mpParent->ImplEndPrint();
- }
- }
- else
- {
- QueuePage* pQueuePage = new QueuePage;
- pQueuePage->mbEndJob = TRUE;
- maQueue.push_back( pQueuePage );
- }
-}
-
-// -----------------------------------------------------------------------
-
-bool ImplQPrinter::GetPaperRanges( std::vector< ULONG >& o_rRanges, bool i_bIncludeOrientationChanges ) const
-{
- bool bRet = false;
-
- if( ImplGetSVData()->maGDIData.mbPrinterPullModel )
- {
- bRet = true;
- o_rRanges.clear();
-
- if( ! maQueue.empty() )
- {
- ULONG nCurPage = 0;
-
- // get first job data
- const ImplJobSetup* pLastFormat = NULL;
- if( maQueue.front()->mpSetup )
- pLastFormat = maQueue.front()->mpSetup->ImplGetConstData();
-
- // begin first range
- o_rRanges.push_back( 0 );
- for( std::vector< QueuePage* >::const_iterator it = maQueue.begin();
- it != maQueue.end(); ++it, ++nCurPage )
- {
- const ImplJobSetup* pNewSetup = (*it)->mpSetup ? (*it)->mpSetup->ImplGetConstData() : NULL;
- if( pNewSetup && pNewSetup != pLastFormat )
- {
- bool bChange = false;
- if( pLastFormat == NULL )
- {
- bChange = true;
- }
- else if( ! i_bIncludeOrientationChanges &&
- pNewSetup->meOrientation != pLastFormat->meOrientation )
- {
- bChange = true;
- }
- else if( pNewSetup->mePaperFormat != pLastFormat->mePaperFormat ||
- ( pNewSetup->mePaperFormat == PAPER_USER &&
- ( pNewSetup->mnPaperWidth != pLastFormat->mnPaperWidth ||
- pNewSetup->mnPaperHeight != pLastFormat->mnPaperHeight ) ) )
- {
- bChange = true;
- }
- else if( pNewSetup->mnPaperBin != pLastFormat->mnPaperBin )
- {
- bChange = true;
- }
- if( bChange )
- {
- o_rRanges.push_back( nCurPage );
- pLastFormat = pNewSetup;
- }
- }
- }
-
- o_rRanges.push_back( nCurPage );
- }
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::AbortQueuePrint()
-{
- maTimer.Stop();
- mbAborted = TRUE;
- AbortJob();
-}
-
-// -----------------------------------------------------------------------
-
-void ImplQPrinter::AddQueuePage( GDIMetaFile* pPage, USHORT nPage, BOOL bNewJobSetup )
-{
- QueuePage* pQueuePage = new QueuePage;
- pQueuePage->mpMtf = pPage;
- pQueuePage->mnPage = nPage;
- pQueuePage->mbEndJob = FALSE;
- // ensure that the first page has a valid setup, this is needed
- // in GetPaperRanges (used in pullmodel)
- // caution: this depends on mnCurPage in Printer being
- // 0: not printing 1: after StartJob, 2 after first EndPage, 3+ at following EndPage calls
- if ( bNewJobSetup || (nPage == 2 && ImplGetSVData()->maGDIData.mbPrinterPullModel) )
- pQueuePage->mpSetup = new JobSetup( mpParent->GetJobSetup() );
- maQueue.push_back( pQueuePage );
-}
diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk
index 77df20976c73..ac2e586a41cb 100755
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -63,6 +63,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \
$(SLO)$/impgraph.obj \
$(SLO)$/metric.obj \
$(SLO)$/pdfwriter_impl.obj \
+ $(SLO)$/pdfwriter_impl2.obj \
$(SLO)$/pdffontcache.obj\
$(SLO)$/bmpconv.obj \
$(SLO)$/pdfextoutdevdata.obj \
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index 325146b6be8a..6d225ad7e0dc 100644
--- a/vcl/source/gdi/metric.cxx
+++ b/vcl/source/gdi/metric.cxx
@@ -34,6 +34,8 @@
#include <vector>
#include <set>
+#include <cstdio>
+
// =======================================================================
ImplFontMetric::ImplFontMetric()
@@ -51,6 +53,7 @@ ImplFontMetric::ImplFontMetric()
inline void ImplFontMetric::AddReference()
{
+ // TODO: disable refcounting on the default maps?
++mnRefCount;
}
@@ -58,6 +61,7 @@ inline void ImplFontMetric::AddReference()
inline void ImplFontMetric::DeReference()
{
+ // TODO: disable refcounting on the default maps?
if( --mnRefCount <= 0 )
delete this;
}
@@ -252,7 +256,7 @@ ImplFontCharMap::ImplFontCharMap( const CmapResult& rCR )
, mpGlyphIds( rCR.mpGlyphIds )
, mnRangeCount( rCR.mnRangeCount )
, mnCharCount( 0 )
-, mnRefCount( 1 )
+, mnRefCount( 0 )
{
const sal_uInt32* pRangePtr = mpRangeCodes;
for( int i = mnRangeCount; --i >= 0; pRangePtr += 2 )
@@ -263,7 +267,8 @@ ImplFontCharMap::ImplFontCharMap( const CmapResult& rCR )
}
}
-static ImplFontCharMap* pDefaultImplFontCharMap = NULL;
+static ImplFontCharMap* pDefaultUnicodeImplFontCharMap = NULL;
+static ImplFontCharMap* pDefaultSymbolImplFontCharMap = NULL;
static const sal_uInt32 aDefaultUnicodeRanges[] = {0x0020,0xD800, 0xE000,0xFFF0};
static const sal_uInt32 aDefaultSymbolRanges[] = {0x0020,0x0100, 0xF020,0xF100};
@@ -284,44 +289,60 @@ ImplFontCharMap::~ImplFontCharMap()
delete[] mpRangeCodes;
delete[] mpStartGlyphs;
delete[] mpGlyphIds;
-}
+ }
// -----------------------------------------------------------------------
-ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols)
+namespace
{
- if( pDefaultImplFontCharMap )
- pDefaultImplFontCharMap->AddReference();
- else
+ ImplFontCharMap *GetDefaultUnicodeMap()
{
- const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges;
- int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes);
- if( bSymbols )
+ if( !pDefaultUnicodeImplFontCharMap )
{
- pRangeCodes = aDefaultSymbolRanges;
- nCodesCount = sizeof(aDefaultSymbolRanges) / sizeof(*pRangeCodes);
+ const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges;
+ int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes);
+ CmapResult aDefaultCR( false, pRangeCodes, nCodesCount/2 );
+ pDefaultUnicodeImplFontCharMap = new ImplFontCharMap( aDefaultCR );
+ pDefaultUnicodeImplFontCharMap->AddReference();
}
- CmapResult aDefaultCR( bSymbols, pRangeCodes, nCodesCount/2 );
- pDefaultImplFontCharMap = new ImplFontCharMap( aDefaultCR );
+ return pDefaultUnicodeImplFontCharMap;
}
- return pDefaultImplFontCharMap;
+ ImplFontCharMap *GetDefaultSymbolMap()
+ {
+ if( !pDefaultSymbolImplFontCharMap )
+ {
+ const sal_uInt32* pRangeCodes = aDefaultSymbolRanges;
+ int nCodesCount = sizeof(aDefaultSymbolRanges) / sizeof(*pRangeCodes);
+ CmapResult aDefaultCR( true, pRangeCodes, nCodesCount/2 );
+ pDefaultSymbolImplFontCharMap = new ImplFontCharMap( aDefaultCR );
+ pDefaultSymbolImplFontCharMap->AddReference();
+ }
+
+ return pDefaultSymbolImplFontCharMap;
+ }
+}
+
+ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols)
+{
+ return bSymbols ? GetDefaultSymbolMap() : GetDefaultUnicodeMap();
}
// -----------------------------------------------------------------------
-void ImplFontCharMap::AddReference()
+void ImplFontCharMap::AddReference( void ) const
{
+ // TODO: disable refcounting on the default maps?
++mnRefCount;
}
// -----------------------------------------------------------------------
-void ImplFontCharMap::DeReference()
+void ImplFontCharMap::DeReference( void ) const
{
if( --mnRefCount <= 0 )
- if( this != pDefaultImplFontCharMap )
+ if( (this != pDefaultUnicodeImplFontCharMap) && (this != pDefaultSymbolImplFontCharMap) )
delete this;
}
@@ -815,7 +836,9 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
FontCharMap::FontCharMap()
: mpImpl( ImplFontCharMap::GetDefaultMap() )
-{}
+{
+ mpImpl->AddReference();
+}
// -----------------------------------------------------------------------
@@ -841,19 +864,14 @@ int FontCharMap::CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const
// -----------------------------------------------------------------------
-void FontCharMap::Reset( ImplFontCharMap* pNewMap )
+void FontCharMap::Reset( const ImplFontCharMap* pNewMap )
{
+ mpImpl->DeReference();
if( pNewMap == NULL )
- {
- mpImpl->DeReference();
mpImpl = ImplFontCharMap::GetDefaultMap();
- }
else if( pNewMap != mpImpl )
- {
- mpImpl->DeReference();
mpImpl = pNewMap;
- mpImpl->AddReference();
- }
+ mpImpl->AddReference();
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index bf1cc2728bf1..f4ea98484c33 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -27,62 +27,57 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include <cstring>
-#include <i18npool/mslangid.hxx>
-#ifndef _SV_SVSYS_HXX
-#include <svsys.h>
-#endif
-#include <vcl/salgdi.hxx>
-#include <vcl/sallayout.hxx>
-#include <rtl/tencinfo.h>
-#include <tools/debug.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/metric.hxx>
-#include <vcl/impfont.hxx>
-#include <vcl/metaact.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/outdata.hxx>
-#include <vcl/outfont.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <tools/poly.hxx>
-#include <vcl/outdev.h>
-#include <vcl/virdev.hxx>
-#include <vcl/print.hxx>
-#include <vcl/event.hxx>
-#include <vcl/window.h>
-#include <vcl/window.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/bmpacc.hxx>
-#include <unotools/fontcvt.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/edit.hxx>
-#include <unotools/fontcfg.hxx>
-#include <vcl/sysdata.hxx>
-#include <vcl/textlayout.hxx>
-#ifndef _OSL_FILE_H
-#include <osl/file.h>
-#endif
+#include "i18npool/mslangid.hxx"
+
+#include "svsys.h"
+#include "vcl/salgdi.hxx"
+#include "vcl/sallayout.hxx"
+#include "rtl/tencinfo.h"
+#include "tools/debug.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/metric.hxx"
+#include "vcl/impfont.hxx"
+#include "vcl/metaact.hxx"
+#include "vcl/gdimtf.hxx"
+#include "vcl/outdata.hxx"
+#include "vcl/outfont.hxx"
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
+#include "tools/poly.hxx"
+#include "vcl/outdev.h"
+#include "vcl/virdev.hxx"
+#include "vcl/print.hxx"
+#include "vcl/event.hxx"
+#include "vcl/window.h"
+#include "vcl/window.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/bmpacc.hxx"
+#include "unotools/fontcvt.hxx"
+#include "vcl/outdev.hxx"
+#include "vcl/edit.hxx"
+#include "unotools/fontcfg.hxx"
+#include "vcl/sysdata.hxx"
+#include "vcl/textlayout.hxx"
+#include "vcl/svids.hrc"
+#include "osl/file.h"
#ifdef ENABLE_GRAPHITE
-#include <vcl/graphite_features.hxx>
+#include "vcl/graphite_features.hxx"
#endif
#ifdef USE_BUILTIN_RASTERIZER
-#include <vcl/glyphcache.hxx>
+#include "vcl/glyphcache.hxx"
#endif
-#include <vcl/unohelp.hxx>
-#include <pdfwriter_impl.hxx>
-#include <vcl/controllayout.hxx>
-#include <rtl/logfile.hxx>
+#include "vcl/unohelp.hxx"
+#include "pdfwriter_impl.hxx"
+#include "vcl/controllayout.hxx"
+#include "rtl/logfile.hxx"
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUES_HDL_
-#include <com/sun/star/beans/PropertyValues.hdl>
-#endif
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-#include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/i18n/XBreakIterator.hpp"
+#include "com/sun/star/i18n/WordType.hpp"
+#include "com/sun/star/linguistic2/XLinguServiceManager.hpp"
#if defined UNX
#define GLYPH_FONT_HEIGHT 128
@@ -92,7 +87,7 @@
#define GLYPH_FONT_HEIGHT 256
#endif
-#include <sal/alloca.h>
+#include "sal/alloca.h"
#include <cmath>
#include <cstring>
@@ -1327,11 +1322,11 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const
"msmincho", "fzmingti", "fzheiti", "ipamincho", "sazanamimincho", "kochimincho", "",
"sunbatang", "sundotum", "baekmukdotum", "gulim", "batang", "dotum", "",
"hgmincholightj", "msunglightsc", "msunglighttc", "hymyeongjolightk", "",
- "tahoma", "dejavusans", "timesnewroman", "lucidatypewriter", "lucidasans", "nimbussansl", "",
+ "tahoma", "dejavusans", "timesnewroman", "liberationsans", "",
"shree", "mangal", "",
"raavi", "shruti", "tunga", "",
"latha", "gautami", "kartika", "vrinda", "",
- "shayyalmt", "naskmt", "",
+ "shayyalmt", "naskmt", "scheherazade", "",
"david", "nachlieli", "lucidagrande", "",
"norasi", "angsanaupc", "",
"khmerossystem", "",
@@ -1381,6 +1376,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const
}
}
+#ifdef SAL_FONTENUM_STABLE_ON_PLATFORM // #i113472#
// sort the list of fonts for glyph fallback by quality (highest first)
// #i33947# keep the EUDC font at the front of the list
// an insertion sort is good enough for this short list
@@ -1396,6 +1392,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const
break;
pFallbackList[ j+1 ] = pTestFont;
}
+#endif
#if defined(HDU_DEBUG)
for( int i = 0; i < nMaxLevel; ++i )
@@ -1529,7 +1526,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData )
// add font alias if available
// a font alias should never win against an original font with similar quality
- if( aMapNames.Len() >= nMapNameIndex )
+ if( aMapNames.Len() <= nMapNameIndex )
break;
if( bKeepNewData ) // try to recycle obsoleted object
pNewData = pNewData->CreateAlias();
@@ -1645,10 +1642,25 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNa
pFoundData = ImplFindBySearchName( aSearchName );
if( pFoundData )
- break;
+ return pFoundData;
}
- return pFoundData;
+ // use known attributes from the configuration to find a matching substitute
+ const ULONG nSearchType = rFontAttr.Type;
+ if( nSearchType != 0 )
+ {
+ const FontWeight eSearchWeight = rFontAttr.Weight;
+ const FontWidth eSearchWidth = rFontAttr.Width;
+ const FontItalic eSearchSlant = ITALIC_DONTKNOW;
+ const FontFamily eSearchFamily = FAMILY_DONTKNOW;
+ const String aSearchName;
+ pFoundData = ImplFindByAttributes( nSearchType,
+ eSearchWeight, eSearchWidth, eSearchFamily, eSearchSlant, aSearchName );
+ if( pFoundData )
+ return pFoundData;
+ }
+
+ return NULL;
}
// -----------------------------------------------------------------------
@@ -2910,6 +2922,18 @@ void OutputDevice::ImplInitFontList() const
mpGraphics->GetDevFontList( mpFontList );
}
}
+ if( meOutDevType == OUTDEV_WINDOW && ! mpFontList->Count() )
+ {
+ String aError( RTL_CONSTASCII_USTRINGPARAM( "Application error: no fonts and no vcl resource found on your system" ) );
+ ResMgr* pMgr = ImplGetResMgr();
+ if( pMgr )
+ {
+ String aResStr( ResId( SV_ACCESSERROR_NO_FONTS, *pMgr ) );
+ if( aResStr.Len() )
+ aError = aResStr;
+ }
+ Application::Abort( aError );
+ }
}
// =======================================================================
@@ -3131,17 +3155,17 @@ long OutputDevice::ImplGetTextWidth( const SalLayout& rSalLayout ) const
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY,
- long nX, long nY, long nWidth, long nHeight )
+ long nDistX, long nDistY, long nWidth, long nHeight )
{
+ long nX = nDistX;
+ long nY = nDistY;
+
short nOrientation = mpFontEntry->mnOrientation;
if ( nOrientation )
{
// Rotate rect without rounding problems for 90 degree rotations
if ( !(nOrientation % 900) )
{
- nX -= nBaseX;
- nY -= nBaseY;
-
if ( nOrientation == 900 )
{
long nTemp = nX;
@@ -3169,12 +3193,11 @@ void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY,
nHeight = nTemp;
nX -= nWidth;
}
-
- nX += nBaseX;
- nY += nBaseY;
}
else
{
+ nX += nBaseX;
+ nY += nBaseY;
// inflate because polygons are drawn smaller
Rectangle aRect( Point( nX, nY ), Size( nWidth+1, nHeight+1 ) );
Polygon aPoly( aRect );
@@ -3184,6 +3207,8 @@ void OutputDevice::ImplDrawTextRect( long nBaseX, long nBaseY,
}
}
+ nX += nBaseX;
+ nY += nBaseY;
mpGraphics->DrawRect( nX, nY, nWidth, nHeight, this );
}
@@ -3204,7 +3229,7 @@ void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout )
mpGraphics->SetFillColor( ImplColorToSal( GetTextFillColor() ) );
mbInitFillColor = TRUE;
- ImplDrawTextRect( nX, nY, nX, nY-mpFontEntry->maMetric.mnAscent-mnEmphasisAscent,
+ ImplDrawTextRect( nX, nY, 0, -(mpFontEntry->maMetric.mnAscent + mnEmphasisAscent),
nWidth,
mpFontEntry->mnLineHeight+mnEmphasisAscent+mnEmphasisDescent );
}
@@ -3489,7 +3514,7 @@ static void ImplDrawWavePixel( long nOriginX, long nOriginY,
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
- long nStartX, long nStartY,
+ long nDistX, long nDistY,
long nWidth, long nHeight,
long nLineWidth, short nOrientation,
const Color& rColor )
@@ -3497,6 +3522,9 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
if ( !nHeight )
return;
+ long nStartX = nBaseX + nDistX;
+ long nStartY = nBaseY + nDistY;
+
// Bei Hoehe von 1 Pixel reicht es, eine Linie auszugeben
if ( (nLineWidth == 1) && (nHeight == 1) )
{
@@ -3511,7 +3539,6 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
ImplRotatePos( nBaseX, nBaseY, nEndX, nEndY, nOrientation );
}
mpGraphics->DrawLine( nStartX, nStartY, nEndX, nEndY, this );
-
}
else
{
@@ -3611,7 +3638,7 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
- long nX, long nY, long nWidth,
+ long nDistX, long nDistY, long nWidth,
FontUnderline eTextLine,
Color aColor,
BOOL bIsAbove )
@@ -3637,7 +3664,7 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
nLineWidth = 1;
if ( eTextLine == UNDERLINE_BOLDWAVE )
nLineWidth *= 2;
- nLinePos += nY - (nLineHeight / 2);
+ nLinePos += nDistY - (nLineHeight / 2);
long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY;
if ( eTextLine == UNDERLINE_DOUBLEWAVE )
{
@@ -3658,16 +3685,16 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
nLineDY2 = 1;
nLinePos -= nLineWidthHeight-nLineDY2;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight,
nLineWidth, mpFontEntry->mnOrientation, aColor );
nLinePos += nLineWidthHeight+nLineDY;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight,
nLineWidth, mpFontEntry->mnOrientation, aColor );
}
else
{
nLinePos -= nLineWidthHeight/2;
- ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight,
+ ImplDrawWaveLine( nBaseX, nBaseY, nDistX, nLinePos, nWidth, nLineHeight,
nLineWidth, mpFontEntry->mnOrientation, aColor );
}
}
@@ -3675,7 +3702,7 @@ void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
- long nX, long nY, long nWidth,
+ long nDistX, long nDistY, long nWidth,
FontUnderline eTextLine,
Color aColor,
BOOL bIsAbove )
@@ -3685,6 +3712,8 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
long nLinePos = 0;
long nLinePos2 = 0;
+ const long nY = nDistY;
+
if ( eTextLine > UNDERLINE_LAST )
eTextLine = UNDERLINE_SINGLE;
@@ -3752,7 +3781,7 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
mpGraphics->SetFillColor( ImplColorToSal( aColor ) );
mbInitFillColor = TRUE;
- long nLeft = nX;
+ long nLeft = nDistX;
switch ( eTextLine )
{
@@ -3905,7 +3934,7 @@ void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
- long nX, long nY, long nWidth,
+ long nDistX, long nDistY, long nWidth,
FontStrikeout eStrikeout,
Color aColor )
{
@@ -3914,6 +3943,8 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
long nLinePos = 0;
long nLinePos2 = 0;
+ long nY = nDistY;
+
if ( eStrikeout > STRIKEOUT_LAST )
eStrikeout = STRIKEOUT_SINGLE;
@@ -3946,7 +3977,7 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
mpGraphics->SetFillColor( ImplColorToSal( aColor ) );
mbInitFillColor = TRUE;
- long nLeft = nX;
+ const long& nLeft = nDistX;
switch ( eStrikeout )
{
@@ -3967,7 +3998,7 @@ void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
- long nX, long nY, long nWidth,
+ long nDistX, long nDistY, long nWidth,
FontStrikeout eStrikeout,
Color aColor )
{
@@ -4001,12 +4032,12 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
// calculate acceptable strikeout length
// allow the strikeout to be one pixel larger than the text it strikes out
- long nMaxWidth = nStrikeoutWidth / 2;
+ long nMaxWidth = nStrikeoutWidth * 3 / 4;
if ( nMaxWidth < 2 )
nMaxWidth = 2;
nMaxWidth += nWidth + 1;
- int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth;
+ 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
@@ -4021,7 +4052,9 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
const String aStrikeoutText( aChars, xub_StrLen(nStrikeStrLen) );
if( mpFontEntry->mnOrientation )
- ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation );
+ ImplRotatePos( 0, 0, nDistX, nDistY, mpFontEntry->mnOrientation );
+ nBaseX += nDistX;
+ nBaseY += nDistY;
// strikeout text has to be left aligned
ULONG nOrigTLM = mnTextLayoutMode;
@@ -4037,7 +4070,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
SetTextColor( aColor );
ImplInitTextColor();
- pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY );
+ pLayout->DrawBase() = Point( nBaseX+mnTextOffX, nBaseY+mnTextOffY );
pLayout->DrawText( *mpGraphics );
pLayout->Release();
@@ -4047,8 +4080,8 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
// -----------------------------------------------------------------------
-void OutputDevice::ImplDrawTextLine( long nBaseX,
- long nX, long nY, long nWidth,
+void OutputDevice::ImplDrawTextLine( long nX, long nY,
+ long nDistX, long nWidth,
FontStrikeout eStrikeout,
FontUnderline eUnderline,
FontUnderline eOverline,
@@ -4064,10 +4097,14 @@ void OutputDevice::ImplDrawTextLine( long nBaseX,
BOOL bUnderlineDone = FALSE;
BOOL bOverlineDone = FALSE;
- // TODO: fix rotated text
if ( IsRTLEnabled() )
+ {
// --- RTL --- mirror at basex
- nX = nBaseX - nWidth - (nX - nBaseX - 1);
+ long nXAdd = nWidth - nDistX;
+ if( mpFontEntry->mnOrientation )
+ nXAdd = FRound( nXAdd * cos( mpFontEntry->mnOrientation * F_PI1800 ) );
+ nX += nXAdd - 1;
+ }
if ( !IsTextLineColor() )
aUnderlineColor = GetTextColor();
@@ -4080,7 +4117,7 @@ void OutputDevice::ImplDrawTextLine( long nBaseX,
(eUnderline == UNDERLINE_DOUBLEWAVE) ||
(eUnderline == UNDERLINE_BOLDWAVE) )
{
- ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+ ImplDrawWaveTextLine( nX, nY, nDistX, 0, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
bUnderlineDone = TRUE;
}
if ( (eOverline == UNDERLINE_SMALLWAVE) ||
@@ -4088,25 +4125,25 @@ void OutputDevice::ImplDrawTextLine( long nBaseX,
(eOverline == UNDERLINE_DOUBLEWAVE) ||
(eOverline == UNDERLINE_BOLDWAVE) )
{
- ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE );
+ ImplDrawWaveTextLine( nX, nY, nDistX, 0, nWidth, eOverline, aOverlineColor, TRUE );
bOverlineDone = TRUE;
}
if ( (eStrikeout == STRIKEOUT_SLASH) ||
(eStrikeout == STRIKEOUT_X) )
{
- ImplDrawStrikeoutChar( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor );
+ ImplDrawStrikeoutChar( nX, nY, nDistX, 0, nWidth, eStrikeout, aStrikeoutColor );
bStrikeoutDone = TRUE;
}
if ( !bUnderlineDone )
- ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
+ ImplDrawStraightTextLine( nX, nY, nDistX, 0, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove );
if ( !bOverlineDone )
- ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE );
+ ImplDrawStraightTextLine( nX, nY, nDistX, 0, nWidth, eOverline, aOverlineColor, TRUE );
if ( !bStrikeoutDone )
- ImplDrawStrikeoutLine( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor );
+ ImplDrawStrikeoutLine( nX, nY, nDistX, 0, nWidth, eStrikeout, aStrikeoutColor );
}
// -----------------------------------------------------------------------
@@ -4116,34 +4153,49 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
{
if( bWordLine )
{
- Point aPos, aStartPt;
- sal_Int32 nWidth = 0, nAdvance=0;
+ // draw everything relative to the layout base point
+ const Point aStartPt = rSalLayout.DrawBase();
+ // calculate distance of each word from the base point
+ Point aPos;
+ sal_Int32 nDist = 0, nWidth = 0, nAdvance=0;
for( int nStart = 0;;)
{
+ // iterate through the layouted glyphs
sal_GlyphId nGlyphIndex;
if( !rSalLayout.GetNextGlyphs( 1, &nGlyphIndex, aPos, nStart, &nAdvance ) )
break;
+ // calculate the boundaries of each word
if( !rSalLayout.IsSpacingGlyph( nGlyphIndex ) )
{
if( !nWidth )
{
- aStartPt = aPos;//rSalLayout.DrawBase() - (aPos - rSalLayout.DrawOffset());
+ // get the distance to the base point (as projected to baseline)
+ nDist = aPos.X() - aStartPt.X();
+ if( mpFontEntry->mnOrientation )
+ {
+ const long nDY = aPos.Y() - aStartPt.Y();
+ const double fRad = mpFontEntry->mnOrientation * F_PI1800;
+ nDist = FRound( nDist*cos(fRad) - nDY*sin(fRad) );
+ }
}
+ // update the length of the textline
nWidth += nAdvance;
}
else if( nWidth > 0 )
{
- ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
+ // draw the textline for each word
+ ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), nDist, nWidth,
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
nWidth = 0;
}
}
+ // draw textline for the last word
if( nWidth > 0 )
{
- ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
+ ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), nDist, nWidth,
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
@@ -4151,7 +4203,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout,
{
Point aStartPt = rSalLayout.GetDrawPosition();
int nWidth = rSalLayout.GetTextWidth() / rSalLayout.GetUnitsPerPixel();
- ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth,
+ ImplDrawTextLine( aStartPt.X(), aStartPt.Y(), 0, nWidth,
eStrikeout, eUnderline, eOverline, bUnderlineAbove );
}
}
@@ -4170,7 +4222,7 @@ void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth )
nX = nBaseX - nWidth - (nX - nBaseX - 1);
}
- ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, FALSE );
+ ImplDrawTextLine( nX, nY, 0, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, FALSE );
}
// -----------------------------------------------------------------------
@@ -5418,7 +5470,7 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth,
Point aPos = ImplLogicToDevicePixel( rPos );
nWidth = ImplLogicWidthToDevicePixel( nWidth );
aPos += Point( mnTextOffX, mnTextOffY );
- ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
+ ImplDrawTextLine( aPos.X(), aPos.X(), 0, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
if( mpAlphaVDev )
mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove );
@@ -5495,7 +5547,7 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos,
if( nWaveHeight > pFontEntry->maMetric.mnWUnderlineSize )
nWaveHeight = pFontEntry->maMetric.mnWUnderlineSize;
- ImplDrawWaveLine( nStartX, nStartY, nStartX, nStartY,
+ ImplDrawWaveLine( nStartX, nStartY, 0, 0,
nEndX-nStartX, nWaveHeight, 1,
nOrientation, GetLineColor() );
if( mpAlphaVDev )
@@ -6058,6 +6110,11 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
rtl::OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();
ImplFontSelectData aFontSelData = mpFontEntry->maFontSelData;
+
+ ImplFontMetricData aOrigMetric( aFontSelData );
+ // TODO: use cached metric in fontentry
+ mpGraphics->GetFontMetric( &aOrigMetric );
+
// when device specific font substitution may have been performed for
// the originally selected font then make sure that a fallback to that
// font is performed first
@@ -6102,7 +6159,27 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay
}
#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();
@@ -6764,7 +6841,20 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c
if ( nIndex != STRING_LEN )
{
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
+ if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS )
+ {
+ String aTmpStr( aStr );
+ xub_StrLen nEraseChars = 4;
+ while( nEraseChars < aStr.Len() && _rLayout.GetTextWidth( aTmpStr, 0, aTmpStr.Len() ) > nMaxWidth )
+ {
+ aTmpStr = aStr;
+ xub_StrLen i = (aTmpStr.Len() - nEraseChars)/2;
+ aTmpStr.Erase( i, nEraseChars++ );
+ aTmpStr.InsertAscii( "...", i );
+ }
+ aStr = aTmpStr;
+ }
+ else if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
{
aStr.Erase( nIndex );
if ( nIndex > 1 )
@@ -7947,7 +8037,7 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const
if( !mpFontEntry )
return FALSE;
- // a little font charmap cache helps considerably
+#ifdef ENABLE_IFC_CACHE // a little font charmap cache helps considerably
static const int NMAXITEMS = 16;
static int nUsedItems = 0, nCurItem = 0;
@@ -7965,10 +8055,12 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const
rFontCharMap.Reset( aCache[i].maCharMap.mpImpl );
}
else // need to cache
+#endif // ENABLE_IFC_CACHE
{
- ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap();
+ const ImplFontCharMap* pNewMap = mpGraphics->GetImplFontCharMap();
rFontCharMap.Reset( pNewMap );
+#ifdef ENABLE_IFC_CACHE
// manage cache round-robin and insert data
CharMapCacheItem& rItem = aCache[ nCurItem ];
rItem.mpFontData = pFontData;
@@ -7979,6 +8071,7 @@ BOOL OutputDevice::GetFontCharMap( FontCharMap& rFontCharMap ) const
if( ++nUsedItems >= NMAXITEMS )
nUsedItems = NMAXITEMS;
+#endif // ENABLE_IFC_CACHE
}
if( rFontCharMap.IsDefaultMap() )
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 5dcce25a0315..23ce1dfa6169 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -38,9 +38,9 @@ PDFWriter::AnyWidget::~AnyWidget()
{
}
-PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext )
+PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc )
:
- pImplementation( new PDFWriterImpl( rContext ) )
+ pImplementation( new PDFWriterImpl( rContext, xEnc, *this ) )
{
}
@@ -69,16 +69,6 @@ PDFWriter::PDFVersion PDFWriter::GetVersion() const
return ((PDFWriterImpl*)pImplementation)->getVersion();
}
-void PDFWriter::SetDocInfo( const PDFDocInfo& rInfo )
-{
- ((PDFWriterImpl*)pImplementation)->setDocInfo( rInfo );
-}
-
-const PDFDocInfo& PDFWriter::GetDocInfo() const
-{
- return ((PDFWriterImpl*)pImplementation)->getDocInfo();
-}
-
void PDFWriter::SetDocumentLocale( const com::sun::star::lang::Locale& rLoc )
{
((PDFWriterImpl*)pImplementation)->setDocumentLocale( rLoc );
@@ -569,3 +559,18 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors()
{
return ((PDFWriterImpl*)pImplementation)->getErrors();
}
+
+com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
+PDFWriter::InitEncryption( const rtl::OUString& i_rOwnerPassword,
+ const rtl::OUString& i_rUserPassword,
+ bool b128Bit
+ )
+{
+ return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword, b128Bit );
+}
+
+void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData )
+{
+ ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL);
+}
+
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index aa9f642f9fee..325ccef1c3a6 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -67,6 +67,7 @@
#include "cppuhelper/implbase1.hxx"
#include <icc/sRGB-IEC61966-2.1.hxx>
#include <vcl/lineinfo.hxx>
+#include "vcl/strhelper.hxx"
using namespace vcl;
using namespace rtl;
@@ -112,12 +113,10 @@ void doTestCode()
aContext.Version = PDFWriter::PDF_1_4;
aContext.Tagged = true;
aContext.InitialPage = 2;
+ aContext.DocumentInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) );
+ aContext.DocumentInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) );
PDFWriter aWriter( aContext );
- PDFDocInfo aDocInfo;
- aDocInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) );
- aDocInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) );
- aWriter.SetDocInfo( aDocInfo );
aWriter.NewPage( 595, 842 );
aWriter.BeginStructureElement( PDFWriter::Document );
// set duration of 3 sec for first page
@@ -495,6 +494,12 @@ static inline double pixelToPoint( sal_Int32 px ) { return double(px)/fDivisor;
static inline double pixelToPoint( double px ) { return px/fDivisor; }
static inline sal_Int32 pointToPixel( double pt ) { return sal_Int32(pt*fDivisor); }
+const sal_uInt8 PDFWriterImpl::s_nPadString[32] =
+{
+ 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
+ 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A
+};
+
static void appendHex( sal_Int8 nInt, OStringBuffer& rBuffer )
{
static const sal_Char pHexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7',
@@ -1692,7 +1697,9 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
* class PDFWriterImpl
*/
-PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext )
+ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
+ const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc,
+ PDFWriter& i_rOuterFace)
:
m_pReferenceDevice( NULL ),
m_aMapMode( MAP_POINT, Point(), Fraction( 1L, pointToPixel(1) ), Fraction( 1L, pointToPixel(1) ) ),
@@ -1713,12 +1720,10 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext )
m_aCipher( (rtlCipher)NULL ),
m_aDigest( NULL ),
m_bEncryptThisStream( false ),
- m_aDocID( 32 ),
- m_aCreationDateString( 64 ),
- m_aCreationMetaDateString( 64 ),
m_pEncryptionBuffer( NULL ),
m_nEncryptionBufferSize( 0 ),
- m_bIsPDF_A1( false )
+ m_bIsPDF_A1( false ),
+ m_rOuterFace( i_rOuterFace )
{
#ifdef DO_TEST_PDF
static bool bOnce = true;
@@ -1757,14 +1762,37 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext )
m_bOpen = true;
-/* prepare the cypher engine, can be done in CTOR, free in DTOR */
+ // setup DocInfo
+ setupDocInfo();
+ /* prepare the cypher engine, can be done in CTOR, free in DTOR */
m_aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream );
m_aDigest = rtl_digest_createMD5();
-/* the size of the Codec default maximum */
+ /* the size of the Codec default maximum */
checkEncryptionBufferSize( 0x4000 );
+ if( xEnc.is() )
+ prepareEncryption( xEnc );
+
+ if( m_aContext.Encryption.Encrypt() )
+ {
+ // sanity check
+ if( m_aContext.Encryption.OValue.size() != ENCRYPTED_PWD_SIZE ||
+ m_aContext.Encryption.UValue.size() != ENCRYPTED_PWD_SIZE ||
+ m_aContext.Encryption.EncryptionKey.size() != MAXIMUM_RC4_KEY_LENGTH
+ )
+ {
+ // the field lengths are invalid ? This was not setup by initEncryption.
+ // do not encrypt after all
+ m_aContext.Encryption.OValue.clear();
+ m_aContext.Encryption.UValue.clear();
+ OSL_ENSURE( 0, "encryption data failed sanity check, encryption disabled" );
+ }
+ else // setup key lengths
+ m_nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, m_nKeyLength, m_nRC4KeyLength );
+ }
+
// write header
OStringBuffer aBuffer( 20 );
aBuffer.append( "%PDF-" );
@@ -1810,139 +1838,138 @@ PDFWriterImpl::~PDFWriterImpl()
rtl_freeMemory( m_pEncryptionBuffer );
}
-void PDFWriterImpl::setDocInfo( const PDFDocInfo& rInfo )
+void PDFWriterImpl::setupDocInfo()
{
- m_aDocInfo.Title = rInfo.Title;
- m_aDocInfo.Author = rInfo.Author;
- m_aDocInfo.Subject = rInfo.Subject;
- m_aDocInfo.Keywords = rInfo.Keywords;
- m_aDocInfo.Creator = rInfo.Creator;
- m_aDocInfo.Producer = rInfo.Producer;
+ std::vector< sal_uInt8 > aId;
+ computeDocumentIdentifier( aId, m_aContext.DocumentInfo, m_aCreationDateString, m_aCreationMetaDateString );
+ if( m_aContext.Encryption.DocumentIdentifier.empty() )
+ m_aContext.Encryption.DocumentIdentifier = aId;
+}
-//build the document id
+void PDFWriterImpl::computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier,
+ const vcl::PDFWriter::PDFDocInfo& i_rDocInfo,
+ rtl::OString& o_rCString1,
+ rtl::OString& o_rCString2
+ )
+{
+ o_rIdentifier.clear();
+
+ //build the document id
rtl::OString aInfoValuesOut;
OStringBuffer aID( 1024 );
- if( m_aDocInfo.Title.Len() )
- appendUnicodeTextString( m_aDocInfo.Title, aID );
- if( m_aDocInfo.Author.Len() )
- appendUnicodeTextString( m_aDocInfo.Author, aID );
- if( m_aDocInfo.Subject.Len() )
- appendUnicodeTextString( m_aDocInfo.Subject, aID );
- if( m_aDocInfo.Keywords.Len() )
- appendUnicodeTextString( m_aDocInfo.Keywords, aID );
- if( m_aDocInfo.Creator.Len() )
- appendUnicodeTextString( m_aDocInfo.Creator, aID );
- if( m_aDocInfo.Producer.Len() )
- appendUnicodeTextString( m_aDocInfo.Producer, aID );
+ if( i_rDocInfo.Title.Len() )
+ appendUnicodeTextString( i_rDocInfo.Title, aID );
+ if( i_rDocInfo.Author.Len() )
+ appendUnicodeTextString( i_rDocInfo.Author, aID );
+ if( i_rDocInfo.Subject.Len() )
+ appendUnicodeTextString( i_rDocInfo.Subject, aID );
+ if( i_rDocInfo.Keywords.Len() )
+ appendUnicodeTextString( i_rDocInfo.Keywords, aID );
+ if( i_rDocInfo.Creator.Len() )
+ appendUnicodeTextString( i_rDocInfo.Creator, aID );
+ if( i_rDocInfo.Producer.Len() )
+ appendUnicodeTextString( i_rDocInfo.Producer, aID );
TimeValue aTVal, aGMT;
oslDateTime aDT;
osl_getSystemTime( &aGMT );
osl_getLocalTimeFromSystemTime( &aGMT, &aTVal );
osl_getDateTimeFromTimeValue( &aTVal, &aDT );
- m_aCreationDateString.append( "D:" );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) );
-//--> i59651, we fill the Metadata date string as well, if PDF/A is requested
- if( m_bIsPDF_A1 )
- {
-// according to ISO 19005-1:2005 6.7.3 the date is corrected for
-// local time zone offset UTC only, whereas Acrobat 8 seems
-// to use the localtime notation only
-// according to a raccomandation in XMP Specification (Jan 2004, page 75)
-// the Acrobat way seems the right approach
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) );
- m_aCreationMetaDateString.append( "-" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) );
- m_aCreationMetaDateString.append( "-" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) );
- m_aCreationMetaDateString.append( "T" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) );
- m_aCreationMetaDateString.append( ":" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) );
- m_aCreationMetaDateString.append( ":" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) );
- }
+ rtl::OStringBuffer aCreationDateString(64), aCreationMetaDateString(64);
+ aCreationDateString.append( "D:" );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) );
+
+ //--> i59651, we fill the Metadata date string as well, if PDF/A is requested
+ // according to ISO 19005-1:2005 6.7.3 the date is corrected for
+ // local time zone offset UTC only, whereas Acrobat 8 seems
+ // to use the localtime notation only
+ // according to a raccomandation in XMP Specification (Jan 2004, page 75)
+ // the Acrobat way seems the right approach
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) );
+ aCreationMetaDateString.append( "-" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) );
+ aCreationMetaDateString.append( "-" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) );
+ aCreationMetaDateString.append( "T" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) );
+ aCreationMetaDateString.append( ":" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) );
+ aCreationMetaDateString.append( ":" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) );
+
sal_uInt32 nDelta = 0;
if( aGMT.Seconds > aTVal.Seconds )
{
- m_aCreationDateString.append( "-" );
+ aCreationDateString.append( "-" );
nDelta = aGMT.Seconds-aTVal.Seconds;
- if( m_bIsPDF_A1 )
- m_aCreationMetaDateString.append( "-" );
+ aCreationMetaDateString.append( "-" );
}
else if( aGMT.Seconds < aTVal.Seconds )
{
- m_aCreationDateString.append( "+" );
+ aCreationDateString.append( "+" );
nDelta = aTVal.Seconds-aGMT.Seconds;
- if( m_bIsPDF_A1 )
- m_aCreationMetaDateString.append( "+" );
+ aCreationMetaDateString.append( "+" );
}
else
{
- m_aCreationDateString.append( "Z" );
- if( m_bIsPDF_A1 )
- m_aCreationMetaDateString.append( "Z" );
+ aCreationDateString.append( "Z" );
+ aCreationMetaDateString.append( "Z" );
}
if( nDelta )
{
- m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) );
- m_aCreationDateString.append( "'" );
- m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) );
- m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) );
- if( m_bIsPDF_A1 )
- {
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) );
- m_aCreationMetaDateString.append( ":" );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) );
- m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) );
- }
+ aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) );
+ aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) );
+ aCreationDateString.append( "'" );
+ aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) );
+ aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) );
+
+ aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) );
+ aCreationMetaDateString.append( ":" );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) );
+ aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) );
}
- m_aCreationDateString.append( "'" );
- aID.append( m_aCreationDateString.getStr(), m_aCreationDateString.getLength() );
+ aCreationDateString.append( "'" );
+ aID.append( aCreationDateString.getStr(), aCreationDateString.getLength() );
aInfoValuesOut = aID.makeStringAndClear();
+ o_rCString1 = aCreationDateString.makeStringAndClear();
+ o_rCString2 = aCreationMetaDateString.makeStringAndClear();
- DBG_ASSERT( m_aDigest != NULL, "PDFWrite_Impl::setDocInfo: cannot obtain a digest object !" );
-
- m_aDocID.setLength( 0 );
- if( m_aDigest )
+ rtlDigest aDigest = rtl_digest_createMD5();
+ OSL_ENSURE( aDigest != NULL, "PDFWriterImpl::computeDocumentIdentifier: cannot obtain a digest object !" );
+ if( aDigest )
{
- osl_getSystemTime( &aGMT );
- rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &aGMT, sizeof( aGMT ) );
- if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, m_aContext.URL.getStr(), m_aContext.URL.getLength()*sizeof(sal_Unicode) );
+ rtlDigestError nError = rtl_digest_updateMD5( aDigest, &aGMT, sizeof( aGMT ) );
if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() );
+ nError = rtl_digest_updateMD5( aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() );
if( nError == rtl_Digest_E_None )
{
-//the binary form of the doc id is needed for encryption stuff
- rtl_digest_getMD5( m_aDigest, m_nDocID, 16 );
- for( unsigned int i = 0; i < 16; i++ )
- appendHex( m_nDocID[i], m_aDocID );
+ o_rIdentifier = std::vector< sal_uInt8 >( 16, 0 );
+ //the binary form of the doc id is needed for encryption stuff
+ rtl_digest_getMD5( aDigest, &o_rIdentifier[0], 16 );
}
}
}
@@ -1955,7 +1982,7 @@ append the string as unicode hex, encrypted if needed
inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer )
{
rOutBuffer.append( "<" );
- if( m_aContext.Encrypt )
+ if( m_aContext.Encryption.Encrypt() )
{
const sal_Unicode* pStr = rInString.getStr();
sal_Int32 nLen = rInString.getLength();
@@ -1992,7 +2019,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( rtl::OStringBuffer& rInSt
rOutBuffer.append( "(" );
sal_Int32 nChars = rInString.getLength();
//check for encryption, if ok, encrypt the string, then convert with appndLiteralString
- if( m_aContext.Encrypt && checkEncryptionBufferSize( nChars ) )
+ if( m_aContext.Encryption.Encrypt() && checkEncryptionBufferSize( nChars ) )
{
//encrypt the string in a buffer, then append it
enableStringEncryption( nInObjectNumber );
@@ -2137,7 +2164,10 @@ OutputDevice* PDFWriterImpl::getReferenceDevice()
m_pReferenceDevice = pVDev;
- pVDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_PDF1 );
+ if( m_aContext.DPIx == 0 || m_aContext.DPIy == 0 )
+ pVDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_PDF1 );
+ else
+ pVDev->SetReferenceDevice( m_aContext.DPIx, m_aContext.DPIy );
pVDev->SetOutputSizePixel( Size( 640, 480 ) );
pVDev->SetMapMode( MAP_MM );
@@ -2379,9 +2409,6 @@ SalLayout* PDFWriterImpl::GetTextLayout( ImplLayoutArgs& rArgs, ImplFontSelectDa
sal_Int32 PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation )
{
- if( m_aContext.Encrypt && m_aPages.empty() )
- initEncryption();
-
endPage();
m_nCurrentPage = m_aPages.size();
m_aPages.push_back( PDFPage(this, nPageWidth, nPageHeight, eOrientation ) );
@@ -5876,7 +5903,7 @@ bool PDFWriterImpl::emitCatalog()
}
// viewer preferences, if we had some, then emit
if( m_aContext.HideViewerToolbar ||
- ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) ||
+ ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) ||
m_aContext.HideViewerMenubar ||
m_aContext.HideViewerWindowControls || m_aContext.FitWindow ||
m_aContext.CenterWindow || (m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) ||
@@ -5893,7 +5920,7 @@ bool PDFWriterImpl::emitCatalog()
aLine.append( "/FitWindow true\n" );
if( m_aContext.CenterWindow )
aLine.append( "/CenterWindow true\n" );
- if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle )
+ if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle )
aLine.append( "/DisplayDocTitle true\n" );
if( m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing )
aLine.append( "/Direction/R2L\n" );
@@ -5997,40 +6024,40 @@ sal_Int32 PDFWriterImpl::emitInfoDict( )
aLine.append( nObject );
aLine.append( " 0 obj\n"
"<<" );
- if( m_aDocInfo.Title.Len() )
+ if( m_aContext.DocumentInfo.Title.Len() )
{
aLine.append( "/Title" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Title, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Title, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aDocInfo.Author.Len() )
+ if( m_aContext.DocumentInfo.Author.Len() )
{
aLine.append( "/Author" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Author, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Author, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aDocInfo.Subject.Len() )
+ if( m_aContext.DocumentInfo.Subject.Len() )
{
aLine.append( "/Subject" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Subject, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Subject, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aDocInfo.Keywords.Len() )
+ if( m_aContext.DocumentInfo.Keywords.Len() )
{
aLine.append( "/Keywords" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Keywords, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Keywords, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aDocInfo.Creator.Len() )
+ if( m_aContext.DocumentInfo.Creator.Len() )
{
aLine.append( "/Creator" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Creator, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Creator, nObject, aLine );
aLine.append( "\n" );
}
- if( m_aDocInfo.Producer.Len() )
+ if( m_aContext.DocumentInfo.Producer.Len() )
{
aLine.append( "/Producer" );
- appendUnicodeTextStringEncrypt( m_aDocInfo.Producer, nObject, aLine );
+ appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Producer, nObject, aLine );
aLine.append( "\n" );
}
@@ -6276,45 +6303,45 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " <pdfaid:conformance>A</pdfaid:conformance>\n" );
aMetadataStream.append( " </rdf:Description>\n" );
//... Dublin Core properties go here
- if( m_aDocInfo.Title.Len() ||
- m_aDocInfo.Author.Len() ||
- m_aDocInfo.Subject.Len() )
+ if( m_aContext.DocumentInfo.Title.Len() ||
+ m_aContext.DocumentInfo.Author.Len() ||
+ m_aContext.DocumentInfo.Subject.Len() )
{
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" );
- if( m_aDocInfo.Title.Len() )
+ if( m_aContext.DocumentInfo.Title.Len() )
{
// this is according to PDF/A-1, technical corrigendum 1 (2007-04-01)
aMetadataStream.append( " <dc:title>\n" );
aMetadataStream.append( " <rdf:Alt>\n" );
aMetadataStream.append( " <rdf:li xml:lang=\"x-default\">" );
rtl::OUString aTitle;
- escapeStringXML( m_aDocInfo.Title, aTitle );
+ escapeStringXML( m_aContext.DocumentInfo.Title, aTitle );
aMetadataStream.append( OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</rdf:li>\n" );
aMetadataStream.append( " </rdf:Alt>\n" );
aMetadataStream.append( " </dc:title>\n" );
}
- if( m_aDocInfo.Author.Len() )
+ if( m_aContext.DocumentInfo.Author.Len() )
{
aMetadataStream.append( " <dc:creator>\n" );
aMetadataStream.append( " <rdf:Seq>\n" );
aMetadataStream.append( " <rdf:li>" );
rtl::OUString aAuthor;
- escapeStringXML( m_aDocInfo.Author, aAuthor );
+ escapeStringXML( m_aContext.DocumentInfo.Author, aAuthor );
aMetadataStream.append( OUStringToOString( aAuthor , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</rdf:li>\n" );
aMetadataStream.append( " </rdf:Seq>\n" );
aMetadataStream.append( " </dc:creator>\n" );
}
- if( m_aDocInfo.Subject.Len() )
+ if( m_aContext.DocumentInfo.Subject.Len() )
{
// this is according to PDF/A-1, technical corrigendum 1 (2007-04-01)
aMetadataStream.append( " <dc:description>\n" );
aMetadataStream.append( " <rdf:Alt>\n" );
aMetadataStream.append( " <rdf:li xml:lang=\"x-default\">" );
rtl::OUString aSubject;
- escapeStringXML( m_aDocInfo.Subject, aSubject );
+ escapeStringXML( m_aContext.DocumentInfo.Subject, aSubject );
aMetadataStream.append( OUStringToOString( aSubject , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</rdf:li>\n" );
aMetadataStream.append( " </rdf:Alt>\n" );
@@ -6324,24 +6351,24 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
}
//... PDF properties go here
- if( m_aDocInfo.Producer.Len() ||
- m_aDocInfo.Keywords.Len() )
+ if( m_aContext.DocumentInfo.Producer.Len() ||
+ m_aContext.DocumentInfo.Keywords.Len() )
{
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n" );
- if( m_aDocInfo.Producer.Len() )
+ if( m_aContext.DocumentInfo.Producer.Len() )
{
aMetadataStream.append( " <pdf:Producer>" );
rtl::OUString aProducer;
- escapeStringXML( m_aDocInfo.Producer, aProducer );
+ escapeStringXML( m_aContext.DocumentInfo.Producer, aProducer );
aMetadataStream.append( OUStringToOString( aProducer , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</pdf:Producer>\n" );
}
- if( m_aDocInfo.Keywords.Len() )
+ if( m_aContext.DocumentInfo.Keywords.Len() )
{
aMetadataStream.append( " <pdf:Keywords>" );
rtl::OUString aKeywords;
- escapeStringXML( m_aDocInfo.Keywords, aKeywords );
+ escapeStringXML( m_aContext.DocumentInfo.Keywords, aKeywords );
aMetadataStream.append( OUStringToOString( aKeywords , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</pdf:Keywords>\n" );
}
@@ -6350,11 +6377,11 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
aMetadataStream.append( " <rdf:Description rdf:about=\"\"\n" );
aMetadataStream.append( " xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n" );
- if( m_aDocInfo.Creator.Len() )
+ if( m_aContext.DocumentInfo.Creator.Len() )
{
aMetadataStream.append( " <xmp:CreatorTool>" );
rtl::OUString aCreator;
- escapeStringXML( m_aDocInfo.Creator, aCreator );
+ escapeStringXML( m_aContext.DocumentInfo.Creator, aCreator );
aMetadataStream.append( OUStringToOString( aCreator , RTL_TEXTENCODING_UTF8 ) );
aMetadataStream.append( "</xmp:CreatorTool>\n" );
}
@@ -6410,7 +6437,7 @@ bool PDFWriterImpl::emitTrailer()
sal_Int32 nSecObject = 0;
- if( m_aContext.Encrypt == true )
+ if( m_aContext.Encryption.Encrypt() )
{
//emit the security information
//must be emitted as indirect dictionary object, since
@@ -6424,16 +6451,16 @@ bool PDFWriterImpl::emitTrailer()
aLineS.append( " 0 obj\n"
"<</Filter/Standard/V " );
// check the version
- if( m_aContext.Security128bit == true )
+ if( m_aContext.Encryption.Security128bit )
aLineS.append( "2/Length 128/R 3" );
else
aLineS.append( "1/R 2" );
// emit the owner password, must not be encrypted
aLineS.append( "/O(" );
- appendLiteralString( (const sal_Char*)m_nEncryptedOwnerPassword, 32, aLineS );
+ appendLiteralString( (const sal_Char*)&m_aContext.Encryption.OValue[0], sal_Int32(m_aContext.Encryption.OValue.size()), aLineS );
aLineS.append( ")/U(" );
- appendLiteralString( (const sal_Char*)m_nEncryptedUserPassword, 32, aLineS );
+ appendLiteralString( (const sal_Char*)&m_aContext.Encryption.UValue[0], sal_Int32(m_aContext.Encryption.UValue.size()), aLineS );
aLineS.append( ")/P " );// the permission set
aLineS.append( m_nAccessPermissions );
aLineS.append( ">>\nendobj\n\n" );
@@ -6499,13 +6526,21 @@ bool PDFWriterImpl::emitTrailer()
aLine.append( nDocInfoObject );
aLine.append( " 0 R\n" );
}
- if( m_aDocID.getLength() )
+ if( ! m_aContext.Encryption.DocumentIdentifier.empty() )
{
aLine.append( "/ID [ <" );
- aLine.append( m_aDocID.getStr(), m_aDocID.getLength() );
+ for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin();
+ it != m_aContext.Encryption.DocumentIdentifier.end(); ++it )
+ {
+ appendHex( sal_Int8(*it), aLine );
+ }
aLine.append( ">\n"
"<" );
- aLine.append( m_aDocID.getStr(), m_aDocID.getLength() );
+ for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin();
+ it != m_aContext.Encryption.DocumentIdentifier.end(); ++it )
+ {
+ appendHex( sal_Int8(*it), aLine );
+ }
aLine.append( "> ]\n" );
}
if( aDocChecksum.getLength() )
@@ -9663,7 +9698,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
aLine.append( "[ /Indexed/DeviceRGB " );
aLine.append( (sal_Int32)(pAccess->GetPaletteEntryCount()-1) );
aLine.append( "\n<" );
- if( m_aContext.Encrypt )
+ if( m_aContext.Encryption.Encrypt() )
{
enableStringEncryption( rObject.m_nObject );
//check encryption buffer size
@@ -10850,7 +10885,7 @@ sal_Int32 PDFWriterImpl::setOutlineItemText( sal_Int32 nItem, const OUString& rT
if( nItem < 1 || nItem >= (sal_Int32)m_aOutline.size() )
return -1;
- m_aOutline[ nItem ].m_aTitle = rText;
+ m_aOutline[ nItem ].m_aTitle = psp::WhitespaceToSpace( rText );
return 0;
}
@@ -12049,268 +12084,5 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream
}
}
-/*************************************************************
-begin i12626 methods
-
-Implements Algorithm 3.2, step 1 only
-*/
-void PDFWriterImpl::padPassword( rtl::OUString aPassword, sal_uInt8 *paPasswordTarget )
-{
-// get ansi-1252 version of the password string CHECKIT ! i12626
- rtl::OString aString = rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_MS_1252 );
-
-//copy the string to the target
- sal_Int32 nToCopy = ( aString.getLength() < 32 ) ? aString.getLength() : 32;
- sal_Int32 nCurrentChar;
-
- for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ )
- paPasswordTarget[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] );
-
-//pad it
- if( nCurrentChar < 32 )
- {//fill with standard byte string
- sal_Int32 i,y;
- for( i = nCurrentChar, y = 0 ; i < 32; i++, y++ )
- paPasswordTarget[i] = m_nPadString[y];
- }
-}
-
-/**********************************
-Algorithm 3.2 Compute the encryption key used
-step 1 should already be done before calling, the paThePaddedPassword parameter should contain
-the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter,
-it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used
-
-TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec.
-
-*/
-void PDFWriterImpl::computeEncryptionKey(sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey )
-{
-//step 2
- if( m_aDigest )
- {
- rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, paThePaddedPassword, ENCRYPTED_PWD_SIZE );
-//step 3
- if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, m_nEncryptedOwnerPassword , sizeof( m_nEncryptedOwnerPassword ) );
-//Step 4
- sal_uInt8 nPerm[4];
-
- nPerm[0] = (sal_uInt8)m_nAccessPermissions;
- nPerm[1] = (sal_uInt8)( m_nAccessPermissions >> 8 );
- nPerm[2] = (sal_uInt8)( m_nAccessPermissions >> 16 );
- nPerm[3] = (sal_uInt8)( m_nAccessPermissions >> 24 );
-
- if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, nPerm , sizeof( nPerm ) );
-
-//step 5, get the document ID, binary form
- if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof( m_nDocID ) );
-//get the digest
- sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
- if( nError == rtl_Digest_E_None )
- {
- rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) );
-
-//step 6, only if 128 bit
- if( m_aContext.Security128bit )
- {
- for( sal_Int32 i = 0; i < 50; i++ )
- {
- nError = rtl_digest_updateMD5( m_aDigest, &nMD5Sum, sizeof( nMD5Sum ) );
- if( nError != rtl_Digest_E_None )
- break;
- rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) );
- }
- }
- }
-//Step 7
- for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ )
- paEncryptionKey[i] = nMD5Sum[i];
- }
-}
-
-/**********************************
-Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member
-the step numbers down here correspond to the ones in PDF v.1.4 specfication
-*/
-void PDFWriterImpl::computeODictionaryValue()
-{
-//step 1 already done, data is in m_nPaddedOwnerPassword
-//step 2
- if( m_aDigest )
- {
- rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &m_nPaddedOwnerPassword, sizeof( m_nPaddedOwnerPassword ) );
- if( nError == rtl_Digest_E_None )
- {
- sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
-
- rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) );
-//step 3, only if 128 bit
- if( m_aContext.Security128bit )
- {
- sal_Int32 i;
- for( i = 0; i < 50; i++ )
- {
- nError = rtl_digest_updateMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) );
- if( nError != rtl_Digest_E_None )
- break;
- rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) );
- }
- }
-//Step 4, the key is in nMD5Sum
-//step 5 already done, data is in m_nPaddedUserPassword
-//step 6
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode,
- nMD5Sum, m_nKeyLength , NULL, 0 );
-// encrypt the user password using the key set above
- rtl_cipher_encodeARCFOUR( m_aCipher, m_nPaddedUserPassword, sizeof( m_nPaddedUserPassword ), // the data to be encrypted
- m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); //encrypted data, stored in class data member
-//Step 7, only if 128 bit
- if( m_aContext.Security128bit )
- {
- sal_uInt32 i, y;
- sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key
-
- for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1
- {
- for( y = 0; y < sizeof( nLocalKey ); y++ )
- nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i );
-
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode,
- nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL
- rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ), // the data to be encrypted
- m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); // encrypted data, can be the same as the input, encrypt "in place"
-//step 8, store in class data member
- }
- }
- }
- }
-}
-
-/**********************************
-Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit)
-*/
-void PDFWriterImpl::computeUDictionaryValue()
-{
-//step 1, common to both 3.4 and 3.5
- computeEncryptionKey( m_nPaddedUserPassword , m_nEncryptionKey );
-
- if( m_aContext.Security128bit == false )
- {
-//3.4
-//step 2 and 3
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode,
- m_nEncryptionKey, 5 , // key and key length
- NULL, 0 ); //destination data area
-// encrypt the user password using the key set above, save for later use
- rtl_cipher_encodeARCFOUR( m_aCipher, m_nPadString, sizeof( m_nPadString ), // the data to be encrypted
- m_nEncryptedUserPassword, sizeof( m_nEncryptedUserPassword ) ); //encrypted data, stored in class data member
- }
- else
- {
-//or 3.5, for 128 bit security
-//step6, initilize the last 16 bytes of the encrypted user password to 0
- for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sizeof( m_nEncryptedUserPassword ); i++)
- m_nEncryptedUserPassword[i] = 0;
-//step 2
- if( m_aDigest )
- {
- rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, m_nPadString, sizeof( m_nPadString ) );
-//step 3
- if( nError == rtl_Digest_E_None )
- nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof(m_nDocID) );
-
- sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
- rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) );
-//Step 4
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode,
- m_nEncryptionKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area
- rtl_cipher_encodeARCFOUR( m_aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted
- m_nEncryptedUserPassword, sizeof( nMD5Sum ) ); //encrypted data, stored in class data member
-//step 5
- sal_uInt32 i, y;
- sal_uInt8 nLocalKey[SECUR_128BIT_KEY];
-
- for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1
- {
- for( y = 0; y < sizeof( nLocalKey ) ; y++ )
- nLocalKey[y] = (sal_uInt8)( m_nEncryptionKey[y] ^ i );
-
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode,
- nLocalKey, SECUR_128BIT_KEY, // key and key length
- NULL, 0 ); //destination data area, on init can be NULL
- rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedUserPassword, SECUR_128BIT_KEY, // the data to be encrypted
- m_nEncryptedUserPassword, SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place"
- }
- }
- }
-}
-
-/* init the encryption engine
-1. init the document id, used both for building the document id and for building the encryption key(s)
-2. build the encryption key following algorithms described in the PDF specification
- */
-void PDFWriterImpl::initEncryption()
-{
- m_aOwnerPassword = m_aContext.OwnerPassword;
- m_aUserPassword = m_aContext.UserPassword;
-/* password stuff computing, before sending out anything */
- DBG_ASSERT( m_aCipher != NULL, "PDFWriterImpl::initEncryption: a cipher (ARCFOUR) object is not available !" );
- DBG_ASSERT( m_aDigest != NULL, "PDFWriterImpl::initEncryption: a digest (MD5) object is not available !" );
-
- if( m_aCipher && m_aDigest )
- {
-//if there is no owner password, force it to the user password
- if( m_aOwnerPassword.getLength() == 0 )
- m_aOwnerPassword = m_aUserPassword;
-
- initPadString();
-/*
-1) pad passwords
-*/
- padPassword( m_aOwnerPassword, m_nPaddedOwnerPassword );
- padPassword( m_aUserPassword, m_nPaddedUserPassword );
-/*
-2) compute the access permissions, in numerical form
-
-the default value depends on the revision 2 (40 bit) or 3 (128 bit security):
-- for 40 bit security the unused bit must be set to 1, since they are not used
-- for 128 bit security the same bit must be preset to 0 and set later if needed
-according to the table 3.15, pdf v 1.4 */
- m_nAccessPermissions = ( m_aContext.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ;
-
-/* check permissions for 40 bit security case */
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintTheDocument ) ? 1 << 2 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanModifyTheContent ) ? 1 << 3 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanCopyOrExtract ) ? 1 << 4 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAddOrModify ) ? 1 << 5 : 0;
- m_nKeyLength = SECUR_40BIT_KEY;
- m_nRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5
-
- if( m_aContext.Security128bit )
- {
- m_nKeyLength = SECUR_128BIT_KEY;
- m_nRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum
- // permitted value is 16
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanFillInteractive ) ? 1 << 8 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanExtractForAccessibility ) ? 1 << 9 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAssemble ) ? 1 << 10 : 0;
- m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintFull ) ? 1 << 11 : 0;
- }
- computeODictionaryValue();
- computeUDictionaryValue();
-
-//clear out exceding key values, prepares for generation number default to 0 as well
-// see checkAndEnableStreamEncryption in pdfwriter_impl.hxx
- sal_Int32 i, y;
- for( i = m_nKeyLength, y = 0; y < 5 ; y++ )
- m_nEncryptionKey[i++] = 0;
- }
- else //either no cipher or no digest or both, something is wrong with memory or something else
- m_aContext.Encrypt = false; //then turn the encryption off
-}
-/* end i12626 methods */
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 2eacdc215dd8..5702bee23ea5 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -58,6 +58,7 @@ class ImplFontSelectData;
class ImplFontMetricData;
class FontSubsetInfo;
class ZCodec;
+class EncHashTransporter;
// the maximum password length
#define ENCRYPTED_PWD_SIZE 32
@@ -595,7 +596,6 @@ private:
MapMode m_aMapMode; // PDFWriterImpl scaled units
std::vector< PDFPage > m_aPages;
- PDFDocInfo m_aDocInfo;
/* maps object numbers to file offsets (needed for xref) */
std::vector< sal_uInt64 > m_aObjects;
/* contains Bitmaps until they are written to the
@@ -796,116 +796,37 @@ i12626
/* used to cipher the stream data and for password management */
rtlCipher m_aCipher;
rtlDigest m_aDigest;
-/* pad string used for password in Standard security handler */
- sal_uInt8 m_nPadString[ENCRYPTED_PWD_SIZE];
-/* the owner password, in clear text */
- rtl::OUString m_aOwnerPassword;
-/* the padded owner password */
- sal_uInt8 m_nPaddedOwnerPassword[ENCRYPTED_PWD_SIZE];
-/* the encryption dictionary owner password, according to algorithm 3.3 */
- sal_uInt8 m_nEncryptedOwnerPassword[ENCRYPTED_PWD_SIZE];
-/* the user password, in clear text */
- rtl::OUString m_aUserPassword;
-/* the padded user password */
- sal_uInt8 m_nPaddedUserPassword[ENCRYPTED_PWD_SIZE];
-/* the encryption dictionary user password, according to algorithm 3.4 or 3.5 depending on the
- security handler revision */
- sal_uInt8 m_nEncryptedUserPassword[ENCRYPTED_PWD_SIZE];
-
-/* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2
- for 128 bit security */
- sal_uInt8 m_nEncryptionKey[MAXIMUM_RC4_KEY_LENGTH];
+ /* pad string used for password in Standard security handler */
+ static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE];
+
+ /* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2
+ for 128 bit security */
sal_Int32 m_nKeyLength; // key length, 16 or 5
sal_Int32 m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorith 3.1
-/* set to true if the following stream must be encrypted, used inside writeBuffer() */
+ /* set to true if the following stream must be encrypted, used inside writeBuffer() */
sal_Bool m_bEncryptThisStream;
-/* the numerical value of the access permissions, according to PDF spec, must be signed */
+ /* the numerical value of the access permissions, according to PDF spec, must be signed */
sal_Int32 m_nAccessPermissions;
-/* the document ID, the raw MD5 hash */
- sal_uInt8 m_nDocID[MD5_DIGEST_SIZE];
-/* string buffer to hold document ID, this is the output string */
- rtl::OStringBuffer m_aDocID;
-/* string to hold the PDF creation date */
- rtl::OStringBuffer m_aCreationDateString;
-/* string to hold the PDF creation date, for PDF/A metadata */
- rtl::OStringBuffer m_aCreationMetaDateString;
-/* the buffer where the data are encrypted, dynamically allocated */
+ /* string to hold the PDF creation date */
+ rtl::OString m_aCreationDateString;
+ /* string to hold the PDF creation date, for PDF/A metadata */
+ rtl::OString m_aCreationMetaDateString;
+ /* the buffer where the data are encrypted, dynamically allocated */
sal_uInt8 *m_pEncryptionBuffer;
-/* size of the buffer */
+ /* size of the buffer */
sal_Int32 m_nEncryptionBufferSize;
-/* check and reallocate the buffer for encryption */
- sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize )
- {
- if( m_nEncryptionBufferSize < newSize )
- {
-/* reallocate the buffer, the used function allocate as rtl_allocateMemory
- if the pointer parameter is NULL */
- m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize );
- if( m_pEncryptionBuffer )
- m_nEncryptionBufferSize = newSize;
- else
- m_nEncryptionBufferSize = 0;
- }
- return ( m_nEncryptionBufferSize != 0 );
- }
-/* init the internal pad string */
- void initPadString()
- {
- static const sal_uInt8 nPadString[32] =
- {
- 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08,
- 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A
- };
-
- for(sal_uInt32 i = 0; i < sizeof( nPadString ); i++ )
- m_nPadString[i] = nPadString[i];
-
- };
-/* initialize the encryption engine */
- void initEncryption();
-
-/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */
- void checkAndEnableStreamEncryption( register sal_Int32 nObject )
- {
- if( m_aContext.Encrypt )
- {
- m_bEncryptThisStream = true;
- register sal_Int32 i = m_nKeyLength;
- m_nEncryptionKey[i++] = (sal_uInt8)nObject;
- m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 );
- m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 );
-//the other location of m_nEncryptionKey are already set to 0, our fixed generation number
-// do the MD5 hash
- sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
- // the i+2 to take into account the generation number, always zero
- rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) );
-// initialize the RC4 with the key
-// key legth: see algoritm 3.1, step 4: (N+5) max 16
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 );
- }
- };
+ /* check and reallocate the buffer for encryption */
+ sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize );
+ /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */
+ void checkAndEnableStreamEncryption( register sal_Int32 nObject );
void disableStreamEncryption() { m_bEncryptThisStream = false; };
-/* */
- void enableStringEncryption( register sal_Int32 nObject )
- {
- register sal_Int32 i = m_nKeyLength;
- m_nEncryptionKey[i++] = (sal_uInt8)nObject;
- m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 );
- m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 );
-//the other location of m_nEncryptionKey are already set to 0, our fixed generation number
-// do the MD5 hash
- sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
- // the i+2 to take into account the generation number, always zero
- rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) );
-// initialize the RC4 with the key
-// key legth: see algoritm 3.1, step 4: (N+5) max 16
- rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 );
- };
+ /* */
+ void enableStringEncryption( register sal_Int32 nObject );
// test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter
void appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer );
@@ -1095,24 +1016,56 @@ i12626
/* true if PDF/A-1a or PDF/A-1b is output */
sal_Bool m_bIsPDF_A1;
-
-/*
-i12626
-methods for PDF security
-
- pad a password according algorithm 3.2, step 1 */
- void padPassword( const rtl::OUString aPassword, sal_uInt8 *paPasswordTarget );
-/* algorithm 3.2: compute an encryption key */
- void computeEncryptionKey( sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey );
-/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */
- void computeODictionaryValue();
-/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */
- void computeUDictionaryValue();
+ PDFWriter& m_rOuterFace;
+
+ /*
+ i12626
+ methods for PDF security
+
+ pad a password according algorithm 3.2, step 1 */
+ static void padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW );
+ /* algorithm 3.2: compute an encryption key */
+ static bool computeEncryptionKey( EncHashTransporter*,
+ vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
+ sal_Int32 i_nAccessPermissions
+ );
+ /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */
+ static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword,
+ std::vector< sal_uInt8 >& io_rOValue,
+ sal_Int32 i_nKeyLength
+ );
+ /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */
+ static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter,
+ vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
+ sal_Int32 i_nKeyLength,
+ sal_Int32 i_nAccessPermissions
+ );
+
+ static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier,
+ const vcl::PDFWriter::PDFDocInfo& i_rDocInfo,
+ rtl::OString& o_rCString1,
+ rtl::OString& o_rCString2
+ );
+ static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties,
+ sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength );
+ void setupDocInfo();
+ bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
+
+ // helper for playMetafile
+ void implWriteGradient( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
+ VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
+ void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx,
+ VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
public:
- PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext );
+ PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >&, PDFWriter& );
~PDFWriterImpl();
+ static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
+ initEncryption( const rtl::OUString& i_rOwnerPassword,
+ const rtl::OUString& i_rUserPassword,
+ bool b128Bit );
+
/* for OutputDevice so the reference device can have a list
* that contains only suitable fonts (subsettable or builtin)
* produces a new font list
@@ -1134,6 +1087,7 @@ public:
bool emit();
std::set< PDFWriter::ErrorCode > getErrors();
void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); }
+ void playMetafile( const GDIMetaFile&, vcl::PDFExtOutDevData*, const vcl::PDFWriter::PlayMetafileContext&, VirtualDevice* pDummyDev = NULL );
Size getCurPageSize() const
{
@@ -1144,8 +1098,6 @@ public:
}
PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; }
- void setDocInfo( const PDFDocInfo& rInfo );
- const PDFDocInfo& getDocInfo() const { return m_aDocInfo; }
void setDocumentLocale( const com::sun::star::lang::Locale& rLoc )
{ m_aContext.DocumentLocale = rLoc; }
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
new file mode 100644
index 000000000000..ee1fe1cc6bc5
--- /dev/null
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -0,0 +1,1540 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_vcl.hxx"
+
+#include "pdfwriter_impl.hxx"
+
+#include "vcl/pdfextoutdevdata.hxx"
+#include "vcl/virdev.hxx"
+#include "vcl/gdimtf.hxx"
+#include "vcl/metaact.hxx"
+#include "vcl/graph.hxx"
+#include "vcl/svdata.hxx"
+#include "unotools/streamwrap.hxx"
+#include "unotools/processfactory.hxx"
+#include "comphelper/processfactory.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/io/XSeekable.hpp"
+#include "com/sun/star/graphic/XGraphicProvider.hpp"
+
+#include "cppuhelper/implbase1.hxx"
+
+#include <rtl/digest.h>
+
+using namespace vcl;
+using namespace rtl;
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+// -----------------------------------------------------------------------------
+
+void PDFWriterImpl::implWriteGradient( const PolyPolygon& i_rPolyPoly, const Gradient& i_rGradient,
+ VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext )
+{
+ GDIMetaFile aTmpMtf;
+
+ i_pDummyVDev->AddGradientActions( i_rPolyPoly.GetBoundRect(), i_rGradient, aTmpMtf );
+
+ m_rOuterFace.Push();
+ m_rOuterFace.IntersectClipRegion( i_rPolyPoly.getB2DPolyPolygon() );
+ playMetafile( aTmpMtf, NULL, i_rContext, i_pDummyVDev );
+ m_rOuterFace.Pop();
+}
+
+// -----------------------------------------------------------------------------
+
+void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx,
+ VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext )
+{
+ if ( !i_rBitmapEx.IsEmpty() && i_rSize.Width() && i_rSize.Height() )
+ {
+ BitmapEx aBitmapEx( i_rBitmapEx );
+ Point aPoint( i_rPoint );
+ Size aSize( i_rSize );
+
+ // #i19065# Negative sizes have mirror semantics on
+ // OutputDevice. BitmapEx and co. have no idea about that, so
+ // perform that _before_ doing anything with aBitmapEx.
+ ULONG nMirrorFlags(BMP_MIRROR_NONE);
+ if( aSize.Width() < 0 )
+ {
+ aSize.Width() *= -1;
+ aPoint.X() -= aSize.Width();
+ nMirrorFlags |= BMP_MIRROR_HORZ;
+ }
+ if( aSize.Height() < 0 )
+ {
+ aSize.Height() *= -1;
+ aPoint.Y() -= aSize.Height();
+ nMirrorFlags |= BMP_MIRROR_VERT;
+ }
+
+ if( nMirrorFlags != BMP_MIRROR_NONE )
+ {
+ aBitmapEx.Mirror( nMirrorFlags );
+ }
+ if( i_rContext.m_nMaxImageResolution > 50 )
+ {
+ // do downsampling if neccessary
+ const Size aDstSizeTwip( i_pDummyVDev->PixelToLogic( i_pDummyVDev->LogicToPixel( aSize ), MAP_TWIP ) );
+ const Size aBmpSize( aBitmapEx.GetSizePixel() );
+ const double fBmpPixelX = aBmpSize.Width();
+ const double fBmpPixelY = aBmpSize.Height();
+ const double fMaxPixelX = aDstSizeTwip.Width() * i_rContext.m_nMaxImageResolution / 1440.0;
+ const double fMaxPixelY = aDstSizeTwip.Height() * i_rContext.m_nMaxImageResolution / 1440.0;
+
+ // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance)
+ if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) ||
+ ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) &&
+ ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) )
+ {
+ // do scaling
+ Size aNewBmpSize;
+ const double fBmpWH = fBmpPixelX / fBmpPixelY;
+ const double fMaxWH = fMaxPixelX / fMaxPixelY;
+
+ if( fBmpWH < fMaxWH )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH );
+ aNewBmpSize.Height() = FRound( fMaxPixelY );
+ }
+ else if( fBmpWH > 0.0 )
+ {
+ aNewBmpSize.Width() = FRound( fMaxPixelX );
+ aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH);
+ }
+ if( aNewBmpSize.Width() && aNewBmpSize.Height() )
+ aBitmapEx.Scale( aNewBmpSize );
+ else
+ aBitmapEx.SetEmpty();
+ }
+ }
+
+ const Size aSizePixel( aBitmapEx.GetSizePixel() );
+ if ( aSizePixel.Width() && aSizePixel.Height() )
+ {
+ sal_Bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
+ if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
+ bUseJPGCompression = sal_False;
+
+ SvMemoryStream aStrm;
+ Bitmap aMask;
+
+ bool bTrueColorJPG = true;
+ if ( bUseJPGCompression )
+ {
+ sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap
+ { // to determine if jpeg compression is usefull
+ SvMemoryStream aTemp;
+ aTemp.SetCompressMode( aTemp.GetCompressMode() | COMPRESSMODE_ZBITMAP );
+ aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
+ aTemp << aBitmapEx; // is capable of zlib stream compression
+ aTemp.Seek( STREAM_SEEK_TO_END );
+ nZippedFileSize = aTemp.Tell();
+ }
+ if ( aBitmapEx.IsTransparent() )
+ {
+ if ( aBitmapEx.IsAlpha() )
+ aMask = aBitmapEx.GetAlpha().GetBitmap();
+ else
+ aMask = aBitmapEx.GetMask();
+ }
+ Graphic aGraphic( aBitmapEx.GetBitmap() );
+ sal_Int32 nColorMode = 0;
+
+ Sequence< PropertyValue > aFilterData( 2 );
+ aFilterData[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) );
+ aFilterData[ 0 ].Value <<= sal_Int32(i_rContext.m_nJPEGQuality);
+ aFilterData[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) );
+ aFilterData[ 1 ].Value <<= nColorMode;
+
+ try
+ {
+ uno::Reference < io::XStream > xStream = new utl::OStreamWrapper( aStrm );
+ Reference< io::XSeekable > xSeekable( xStream, UNO_QUERY_THROW );
+ Reference< graphic::XGraphicProvider > xGraphicProvider( ImplGetSVData()->maAppData.mxMSF->createInstance(
+ OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY );
+ if ( xGraphicProvider.is() )
+ {
+ Reference< graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
+ Reference < io::XOutputStream > xOut( xStream->getOutputStream() );
+ rtl::OUString aMimeType( ::rtl::OUString::createFromAscii( "image/jpeg" ) );
+ uno::Sequence< beans::PropertyValue > aOutMediaProperties( 3 );
+ aOutMediaProperties[0].Name = ::rtl::OUString::createFromAscii( "OutputStream" );
+ aOutMediaProperties[0].Value <<= xOut;
+ aOutMediaProperties[1].Name = ::rtl::OUString::createFromAscii( "MimeType" );
+ aOutMediaProperties[1].Value <<= aMimeType;
+ aOutMediaProperties[2].Name = ::rtl::OUString::createFromAscii( "FilterData" );
+ aOutMediaProperties[2].Value <<= aFilterData;
+ xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
+ xOut->flush();
+ if ( xSeekable->getLength() > nZippedFileSize )
+ {
+ bUseJPGCompression = sal_False;
+ }
+ else
+ {
+ aStrm.Seek( STREAM_SEEK_TO_END );
+
+ xSeekable->seek( 0 );
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[ 0 ].Name = ::rtl::OUString::createFromAscii( "InputStream" );
+ aArgs[ 0 ].Value <<= xStream;
+ Reference< XPropertySet > xPropSet( xGraphicProvider->queryGraphicDescriptor( aArgs ) );
+ if ( xPropSet.is() )
+ {
+ sal_Int16 nBitsPerPixel = 24;
+ if ( xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "BitsPerPixel" ) ) >>= nBitsPerPixel )
+ {
+ bTrueColorJPG = nBitsPerPixel != 8;
+ }
+ }
+ }
+ }
+ else
+ bUseJPGCompression = sal_False;
+ }
+ catch( uno::Exception& )
+ {
+ bUseJPGCompression = sal_False;
+ }
+ }
+ if ( bUseJPGCompression )
+ m_rOuterFace.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, Rectangle( aPoint, aSize ), aMask );
+ else if ( aBitmapEx.IsTransparent() )
+ m_rOuterFace.DrawBitmapEx( aPoint, aSize, aBitmapEx );
+ else
+ m_rOuterFace.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap() );
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
+void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevData* i_pOutDevData, const vcl::PDFWriter::PlayMetafileContext& i_rContext, VirtualDevice* pDummyVDev )
+{
+ bool bAssertionFired( false );
+
+ VirtualDevice* pPrivateDevice = NULL;
+ if( ! pDummyVDev )
+ {
+ pPrivateDevice = pDummyVDev = new VirtualDevice();
+ pDummyVDev->EnableOutput( sal_False );
+ pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() );
+ }
+ GDIMetaFile aMtf( i_rMtf );
+
+ for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; )
+ {
+ if ( !i_pOutDevData || !i_pOutDevData->PlaySyncPageAct( m_rOuterFace, i ) )
+ {
+ const MetaAction* pAction = aMtf.GetAction( i );
+ const USHORT nType = pAction->GetType();
+
+ switch( nType )
+ {
+ case( META_PIXEL_ACTION ):
+ {
+ const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
+ m_rOuterFace.DrawPixel( pA->GetPoint(), pA->GetColor() );
+ }
+ break;
+
+ case( META_POINT_ACTION ):
+ {
+ const MetaPointAction* pA = (const MetaPointAction*) pAction;
+ m_rOuterFace.DrawPixel( pA->GetPoint() );
+ }
+ break;
+
+ case( META_LINE_ACTION ):
+ {
+ const MetaLineAction* pA = (const MetaLineAction*) pAction;
+ if ( pA->GetLineInfo().IsDefault() )
+ m_rOuterFace.DrawLine( pA->GetStartPoint(), pA->GetEndPoint() );
+ else
+ m_rOuterFace.DrawLine( pA->GetStartPoint(), pA->GetEndPoint(), pA->GetLineInfo() );
+ }
+ break;
+
+ case( META_RECT_ACTION ):
+ {
+ const MetaRectAction* pA = (const MetaRectAction*) pAction;
+ m_rOuterFace.DrawRect( pA->GetRect() );
+ }
+ break;
+
+ case( META_ROUNDRECT_ACTION ):
+ {
+ const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
+ m_rOuterFace.DrawRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() );
+ }
+ break;
+
+ case( META_ELLIPSE_ACTION ):
+ {
+ const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
+ m_rOuterFace.DrawEllipse( pA->GetRect() );
+ }
+ break;
+
+ case( META_ARC_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ m_rOuterFace.DrawArc( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_PIE_ACTION ):
+ {
+ const MetaArcAction* pA = (const MetaArcAction*) pAction;
+ m_rOuterFace.DrawPie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_CHORD_ACTION ):
+ {
+ const MetaChordAction* pA = (const MetaChordAction*) pAction;
+ m_rOuterFace.DrawChord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() );
+ }
+ break;
+
+ case( META_POLYGON_ACTION ):
+ {
+ const MetaPolygonAction* pA = (const MetaPolygonAction*) pAction;
+ m_rOuterFace.DrawPolygon( pA->GetPolygon() );
+ }
+ break;
+
+ case( META_POLYLINE_ACTION ):
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ if ( pA->GetLineInfo().IsDefault() )
+ m_rOuterFace.DrawPolyLine( pA->GetPolygon() );
+ else
+ m_rOuterFace.DrawPolyLine( pA->GetPolygon(), pA->GetLineInfo() );
+ }
+ break;
+
+ case( META_POLYPOLYGON_ACTION ):
+ {
+ const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
+ m_rOuterFace.DrawPolyPolygon( pA->GetPolyPolygon() );
+ }
+ break;
+
+ case( META_GRADIENT_ACTION ):
+ {
+ const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
+ const PolyPolygon aPolyPoly( pA->GetRect() );
+
+ implWriteGradient( aPolyPoly, pA->GetGradient(), pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_GRADIENTEX_ACTION ):
+ {
+ const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
+ implWriteGradient( pA->GetPolyPolygon(), pA->GetGradient(), pDummyVDev, i_rContext );
+ }
+ break;
+
+ case META_HATCH_ACTION:
+ {
+ const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
+ m_rOuterFace.DrawHatch( pA->GetPolyPolygon(), pA->GetHatch() );
+ }
+ break;
+
+ case( META_TRANSPARENT_ACTION ):
+ {
+ const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
+ m_rOuterFace.DrawTransparent( pA->GetPolyPolygon(), pA->GetTransparence() );
+ }
+ break;
+
+ case( META_FLOATTRANSPARENT_ACTION ):
+ {
+ const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
+
+ GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
+ const Point& rPos = pA->GetPoint();
+ const Size& rSize= pA->GetSize();
+ const Gradient& rTransparenceGradient = pA->GetGradient();
+
+ // special case constant alpha value
+ if( rTransparenceGradient.GetStartColor() == rTransparenceGradient.GetEndColor() )
+ {
+ const Color aTransCol( rTransparenceGradient.GetStartColor() );
+ const USHORT nTransPercent = aTransCol.GetLuminance() * 100 / 255;
+ m_rOuterFace.BeginTransparencyGroup();
+ playMetafile( aTmpMtf, NULL, i_rContext, pDummyVDev );
+ m_rOuterFace.EndTransparencyGroup( Rectangle( rPos, rSize ), nTransPercent );
+ }
+ else
+ {
+ const Size aDstSizeTwip( pDummyVDev->PixelToLogic( pDummyVDev->LogicToPixel( rSize ), MAP_TWIP ) );
+ sal_Int32 nMaxBmpDPI = i_rContext.m_bOnlyLosslessCompression ? 300 : 72;
+ if( i_rContext.m_nMaxImageResolution > 50 )
+ {
+ if ( nMaxBmpDPI > i_rContext.m_nMaxImageResolution )
+ nMaxBmpDPI = i_rContext.m_nMaxImageResolution;
+ }
+ const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0);
+ const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0);
+ if ( nPixelX && nPixelY )
+ {
+ Size aDstSizePixel( nPixelX, nPixelY );
+ VirtualDevice* pVDev = new VirtualDevice;
+ if( pVDev->SetOutputSizePixel( aDstSizePixel ) )
+ {
+ Bitmap aPaint, aMask;
+ AlphaMask aAlpha;
+ Point aPoint;
+
+ MapMode aMapMode( pDummyVDev->GetMapMode() );
+ aMapMode.SetOrigin( aPoint );
+ pVDev->SetMapMode( aMapMode );
+ Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) );
+
+ Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() );
+ if ( aMtfOrigin.X() || aMtfOrigin.Y() )
+ aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() );
+ double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width();
+ double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height();
+ if( fScaleX != 1.0 || fScaleY != 1.0 )
+ aTmpMtf.Scale( fScaleX, fScaleY );
+ aTmpMtf.SetPrefMapMode( aMapMode );
+
+ // create paint bitmap
+ aTmpMtf.WindStart();
+ aTmpMtf.Play( pVDev, aPoint, aDstSize );
+ aTmpMtf.WindStart();
+
+ pVDev->EnableMapMode( FALSE );
+ aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ pVDev->EnableMapMode( TRUE );
+
+ // create mask bitmap
+ pVDev->SetLineColor( COL_BLACK );
+ pVDev->SetFillColor( COL_BLACK );
+ pVDev->DrawRect( Rectangle( aPoint, aDstSize ) );
+ pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT |
+ DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT );
+ aTmpMtf.WindStart();
+ aTmpMtf.Play( pVDev, aPoint, aDstSize );
+ aTmpMtf.WindStart();
+ pVDev->EnableMapMode( FALSE );
+ aMask = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ pVDev->EnableMapMode( TRUE );
+
+ // create alpha mask from gradient
+ pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT );
+ pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient );
+ pVDev->SetDrawMode( DRAWMODE_DEFAULT );
+ pVDev->EnableMapMode( FALSE );
+ pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) );
+ aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel );
+ implWriteBitmapEx( rPos, rSize, BitmapEx( aPaint, aAlpha ), pDummyVDev, i_rContext );
+ }
+ delete pVDev;
+ }
+ }
+ }
+ break;
+
+ case( META_EPS_ACTION ):
+ {
+ const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
+ const GDIMetaFile aSubstitute( pA->GetSubstitute() );
+
+ m_rOuterFace.Push();
+ pDummyVDev->Push();
+
+ MapMode aMapMode( aSubstitute.GetPrefMapMode() );
+ Size aOutSize( pDummyVDev->LogicToLogic( pA->GetSize(), pDummyVDev->GetMapMode(), aMapMode ) );
+ aMapMode.SetScaleX( Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) );
+ aMapMode.SetScaleY( Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) );
+ aMapMode.SetOrigin( pDummyVDev->LogicToLogic( pA->GetPoint(), pDummyVDev->GetMapMode(), aMapMode ) );
+
+ m_rOuterFace.SetMapMode( aMapMode );
+ pDummyVDev->SetMapMode( aMapMode );
+ playMetafile( aSubstitute, NULL, i_rContext, pDummyVDev );
+ pDummyVDev->Pop();
+ m_rOuterFace.Pop();
+ }
+ break;
+
+ case( META_COMMENT_ACTION ):
+ if( ! i_rContext.m_bTransparenciesWereRemoved )
+ {
+ const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
+ String aSkipComment;
+
+ if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
+ {
+ const MetaGradientExAction* pGradAction = NULL;
+ sal_Bool bDone = sal_False;
+
+ while( !bDone && ( ++i < nCount ) )
+ {
+ pAction = aMtf.GetAction( i );
+
+ if( pAction->GetType() == META_GRADIENTEX_ACTION )
+ pGradAction = (const MetaGradientExAction*) pAction;
+ else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
+ ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
+ {
+ bDone = sal_True;
+ }
+ }
+
+ if( pGradAction )
+ implWriteGradient( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pDummyVDev, i_rContext );
+ }
+ else
+ {
+ const BYTE* pData = pA->GetData();
+ if ( pData )
+ {
+ SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ );
+ sal_Bool bSkipSequence = sal_False;
+ ByteString sSeqEnd;
+
+ if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" );
+ SvtGraphicStroke aStroke;
+ aMemStm >> aStroke;
+
+ Polygon aPath;
+ aStroke.getPath( aPath );
+
+ PolyPolygon aStartArrow;
+ PolyPolygon aEndArrow;
+ double fTransparency( aStroke.getTransparency() );
+ double fStrokeWidth( aStroke.getStrokeWidth() );
+ SvtGraphicStroke::DashArray aDashArray;
+
+ aStroke.getStartArrow( aStartArrow );
+ aStroke.getEndArrow( aEndArrow );
+ aStroke.getDashArray( aDashArray );
+
+ bSkipSequence = sal_True;
+ if ( aStartArrow.Count() || aEndArrow.Count() )
+ bSkipSequence = sal_False;
+ if ( aDashArray.size() && ( fStrokeWidth != 0.0 ) && ( fTransparency == 0.0 ) )
+ bSkipSequence = sal_False;
+ if ( bSkipSequence )
+ {
+ PDFWriter::ExtLineInfo aInfo;
+ aInfo.m_fLineWidth = fStrokeWidth;
+ aInfo.m_fTransparency = fTransparency;
+ aInfo.m_fMiterLimit = aStroke.getMiterLimit();
+ switch( aStroke.getCapType() )
+ {
+ default:
+ case SvtGraphicStroke::capButt: aInfo.m_eCap = PDFWriter::capButt;break;
+ case SvtGraphicStroke::capRound: aInfo.m_eCap = PDFWriter::capRound;break;
+ case SvtGraphicStroke::capSquare: aInfo.m_eCap = PDFWriter::capSquare;break;
+ }
+ switch( aStroke.getJoinType() )
+ {
+ default:
+ case SvtGraphicStroke::joinMiter: aInfo.m_eJoin = PDFWriter::joinMiter;break;
+ case SvtGraphicStroke::joinRound: aInfo.m_eJoin = PDFWriter::joinRound;break;
+ case SvtGraphicStroke::joinBevel: aInfo.m_eJoin = PDFWriter::joinBevel;break;
+ case SvtGraphicStroke::joinNone:
+ aInfo.m_eJoin = PDFWriter::joinMiter;
+ aInfo.m_fMiterLimit = 0.0;
+ break;
+ }
+ aInfo.m_aDashArray = aDashArray;
+
+ if(SvtGraphicStroke::joinNone == aStroke.getJoinType()
+ && fStrokeWidth > 0.0)
+ {
+ // emulate no edge rounding by handling single edges
+ const sal_uInt16 nPoints(aPath.GetSize());
+ const bool bCurve(aPath.HasFlags());
+
+ for(sal_uInt16 a(0); a + 1 < nPoints; a++)
+ {
+ if(bCurve
+ && POLY_NORMAL != aPath.GetFlags(a + 1)
+ && a + 2 < nPoints
+ && POLY_NORMAL != aPath.GetFlags(a + 2)
+ && a + 3 < nPoints)
+ {
+ const Polygon aSnippet(4,
+ aPath.GetConstPointAry() + a,
+ aPath.GetConstFlagAry() + a);
+ m_rOuterFace.DrawPolyLine( aSnippet, aInfo );
+ a += 2;
+ }
+ else
+ {
+ const Polygon aSnippet(2,
+ aPath.GetConstPointAry() + a);
+ m_rOuterFace.DrawPolyLine( aSnippet, aInfo );
+ }
+ }
+ }
+ else
+ {
+ m_rOuterFace.DrawPolyLine( aPath, aInfo );
+ }
+ }
+ }
+ else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) )
+ {
+ sSeqEnd = ByteString( "XPATHFILL_SEQ_END" );
+ SvtGraphicFill aFill;
+ aMemStm >> aFill;
+
+ if ( ( aFill.getFillType() == SvtGraphicFill::fillSolid ) && ( aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ) )
+ {
+ double fTransparency = aFill.getTransparency();
+ if ( fTransparency == 0.0 )
+ {
+ PolyPolygon aPath;
+ aFill.getPath( aPath );
+
+ bSkipSequence = sal_True;
+ m_rOuterFace.DrawPolyPolygon( aPath );
+ }
+ else if ( fTransparency == 1.0 )
+ bSkipSequence = sal_True;
+ }
+/* #i81548# removing optimization for fill textures, because most of the texture settings are not
+ exported properly. In OpenOffice 3.1 the drawing layer will support graphic primitives, then it
+ will not be a problem to optimize the filltexture export. But for wysiwyg is more important than
+ filesize.
+ else if( aFill.getFillType() == SvtGraphicFill::fillTexture && aFill.isTiling() )
+ {
+ sal_Int32 nPattern = mnCachePatternId;
+ Graphic aPatternGraphic;
+ aFill.getGraphic( aPatternGraphic );
+ bool bUseCache = false;
+ SvtGraphicFill::Transform aPatTransform;
+ aFill.getTransform( aPatTransform );
+
+ if( mnCachePatternId >= 0 )
+ {
+ SvtGraphicFill::Transform aCacheTransform;
+ maCacheFill.getTransform( aCacheTransform );
+ if( aCacheTransform.matrix[0] == aPatTransform.matrix[0] &&
+ aCacheTransform.matrix[1] == aPatTransform.matrix[1] &&
+ aCacheTransform.matrix[2] == aPatTransform.matrix[2] &&
+ aCacheTransform.matrix[3] == aPatTransform.matrix[3] &&
+ aCacheTransform.matrix[4] == aPatTransform.matrix[4] &&
+ aCacheTransform.matrix[5] == aPatTransform.matrix[5]
+ )
+ {
+ Graphic aCacheGraphic;
+ maCacheFill.getGraphic( aCacheGraphic );
+ if( aCacheGraphic == aPatternGraphic )
+ bUseCache = true;
+ }
+ }
+
+ if( ! bUseCache )
+ {
+
+ // paint graphic to metafile
+ GDIMetaFile aPattern;
+ pDummyVDev->SetConnectMetaFile( &aPattern );
+ pDummyVDev->Push();
+ pDummyVDev->SetMapMode( aPatternGraphic.GetPrefMapMode() );
+
+ aPatternGraphic.Draw( &rDummyVDev, Point( 0, 0 ) );
+ pDummyVDev->Pop();
+ pDummyVDev->SetConnectMetaFile( NULL );
+ aPattern.WindStart();
+
+ MapMode aPatternMapMode( aPatternGraphic.GetPrefMapMode() );
+ // prepare pattern from metafile
+ Size aPrefSize( aPatternGraphic.GetPrefSize() );
+ // FIXME: this magic -1 shouldn't be necessary
+ aPrefSize.Width() -= 1;
+ aPrefSize.Height() -= 1;
+ aPrefSize = m_rOuterFace.GetReferenceDevice()->
+ LogicToLogic( aPrefSize,
+ &aPatternMapMode,
+ &m_rOuterFace.GetReferenceDevice()->GetMapMode() );
+ // build bounding rectangle of pattern
+ Rectangle aBound( Point( 0, 0 ), aPrefSize );
+ m_rOuterFace.BeginPattern( aBound );
+ m_rOuterFace.Push();
+ pDummyVDev->Push();
+ m_rOuterFace.SetMapMode( aPatternMapMode );
+ pDummyVDev->SetMapMode( aPatternMapMode );
+ ImplWriteActions( m_rOuterFace, NULL, aPattern, rDummyVDev );
+ pDummyVDev->Pop();
+ m_rOuterFace.Pop();
+
+ nPattern = m_rOuterFace.EndPattern( aPatTransform );
+
+ // try some caching and reuse pattern
+ mnCachePatternId = nPattern;
+ maCacheFill = aFill;
+ }
+
+ // draw polypolygon with pattern fill
+ PolyPolygon aPath;
+ aFill.getPath( aPath );
+ m_rOuterFace.DrawPolyPolygon( aPath, nPattern, aFill.getFillRule() == SvtGraphicFill::fillEvenOdd );
+
+ bSkipSequence = sal_True;
+ }
+*/
+ }
+ if ( bSkipSequence )
+ {
+ while( ++i < nCount )
+ {
+ pAction = aMtf.GetAction( i );
+ if ( pAction->GetType() == META_COMMENT_ACTION )
+ {
+ ByteString sComment( ((MetaCommentAction*)pAction)->GetComment() );
+ if ( sComment.Equals( sSeqEnd ) )
+ break;
+ }
+ // #i44496#
+ // the replacement action for stroke is a filled rectangle
+ // the set fillcolor of the replacement is part of the graphics
+ // state and must not be skipped
+ else if( pAction->GetType() == META_FILLCOLOR_ACTION )
+ {
+ const MetaFillColorAction* pMA = (const MetaFillColorAction*) pAction;
+ if( pMA->IsSetting() )
+ m_rOuterFace.SetFillColor( pMA->GetColor() );
+ else
+ m_rOuterFace.SetFillColor();
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case( META_BMP_ACTION ):
+ {
+ const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmap() );
+ Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
+ aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
+ if( ! ( aSize.Width() && aSize.Height() ) )
+ aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() );
+ implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_BMPSCALE_ACTION ):
+ {
+ const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
+ implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ), pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_BMPSCALEPART_ACTION ):
+ {
+ const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmap() );
+ aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_BMPEX_ACTION ):
+ {
+ const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmapEx() );
+ Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
+ aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
+ implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_BMPEXSCALE_ACTION ):
+ {
+ const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
+ implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx(), pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_BMPEXSCALEPART_ACTION ):
+ {
+ const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
+ BitmapEx aBitmapEx( pA->GetBitmapEx() );
+ aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
+ implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext );
+ }
+ break;
+
+ case( META_MASK_ACTION ):
+ case( META_MASKSCALE_ACTION ):
+ case( META_MASKSCALEPART_ACTION ):
+ {
+ DBG_ERROR( "MetaMask...Action not supported yet" );
+ }
+ break;
+
+ case( META_TEXT_ACTION ):
+ {
+ const MetaTextAction* pA = (const MetaTextAction*) pAction;
+ m_rOuterFace.DrawText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ) );
+ }
+ break;
+
+ case( META_TEXTRECT_ACTION ):
+ {
+ const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
+ m_rOuterFace.DrawText( pA->GetRect(), String( pA->GetText() ), pA->GetStyle() );
+ }
+ break;
+
+ case( META_TEXTARRAY_ACTION ):
+ {
+ const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
+ m_rOuterFace.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+ case( META_STRETCHTEXT_ACTION ):
+ {
+ const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
+ m_rOuterFace.DrawStretchText( pA->GetPoint(), pA->GetWidth(), pA->GetText(), pA->GetIndex(), pA->GetLen() );
+ }
+ break;
+
+
+ case( META_TEXTLINE_ACTION ):
+ {
+ const MetaTextLineAction* pA = (const MetaTextLineAction*) pAction;
+ m_rOuterFace.DrawTextLine( pA->GetStartPoint(), pA->GetWidth(), pA->GetStrikeout(), pA->GetUnderline(), pA->GetOverline() );
+
+ }
+ break;
+
+ case( META_CLIPREGION_ACTION ):
+ {
+ const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction;
+
+ if( pA->IsClipping() )
+ {
+ if( pA->GetRegion().IsEmpty() )
+ m_rOuterFace.SetClipRegion( basegfx::B2DPolyPolygon() );
+ else
+ {
+ Region aReg( pA->GetRegion() );
+ m_rOuterFace.SetClipRegion( aReg.ConvertToB2DPolyPolygon() );
+ }
+ }
+ else
+ m_rOuterFace.SetClipRegion();
+ }
+ break;
+
+ case( META_ISECTRECTCLIPREGION_ACTION ):
+ {
+ const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction;
+ m_rOuterFace.IntersectClipRegion( pA->GetRect() );
+ }
+ break;
+
+ case( META_ISECTREGIONCLIPREGION_ACTION ):
+ {
+ const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction;
+ Region aReg( pA->GetRegion() );
+ m_rOuterFace.IntersectClipRegion( aReg.ConvertToB2DPolyPolygon() );
+ }
+ break;
+
+ case( META_MOVECLIPREGION_ACTION ):
+ {
+ const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pAction;
+ m_rOuterFace.MoveClipRegion( pA->GetHorzMove(), pA->GetVertMove() );
+ }
+ break;
+
+ case( META_MAPMODE_ACTION ):
+ {
+ const_cast< MetaAction* >( pAction )->Execute( pDummyVDev );
+ m_rOuterFace.SetMapMode( pDummyVDev->GetMapMode() );
+ }
+ break;
+
+ case( META_LINECOLOR_ACTION ):
+ {
+ const MetaLineColorAction* pA = (const MetaLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ m_rOuterFace.SetLineColor( pA->GetColor() );
+ else
+ m_rOuterFace.SetLineColor();
+ }
+ break;
+
+ case( META_FILLCOLOR_ACTION ):
+ {
+ const MetaFillColorAction* pA = (const MetaFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ m_rOuterFace.SetFillColor( pA->GetColor() );
+ else
+ m_rOuterFace.SetFillColor();
+ }
+ break;
+
+ case( META_TEXTLINECOLOR_ACTION ):
+ {
+ const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ m_rOuterFace.SetTextLineColor( pA->GetColor() );
+ else
+ m_rOuterFace.SetTextLineColor();
+ }
+ break;
+
+ case( META_OVERLINECOLOR_ACTION ):
+ {
+ const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ m_rOuterFace.SetOverlineColor( pA->GetColor() );
+ else
+ m_rOuterFace.SetOverlineColor();
+ }
+ break;
+
+ case( META_TEXTFILLCOLOR_ACTION ):
+ {
+ const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pAction;
+
+ if( pA->IsSetting() )
+ m_rOuterFace.SetTextFillColor( pA->GetColor() );
+ else
+ m_rOuterFace.SetTextFillColor();
+ }
+ break;
+
+ case( META_TEXTCOLOR_ACTION ):
+ {
+ const MetaTextColorAction* pA = (const MetaTextColorAction*) pAction;
+ m_rOuterFace.SetTextColor( pA->GetColor() );
+ }
+ break;
+
+ case( META_TEXTALIGN_ACTION ):
+ {
+ const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pAction;
+ m_rOuterFace.SetTextAlign( pA->GetTextAlign() );
+ }
+ break;
+
+ case( META_FONT_ACTION ):
+ {
+ const MetaFontAction* pA = (const MetaFontAction*) pAction;
+ m_rOuterFace.SetFont( pA->GetFont() );
+ }
+ break;
+
+ case( META_PUSH_ACTION ):
+ {
+ const MetaPushAction* pA = (const MetaPushAction*) pAction;
+
+ pDummyVDev->Push( pA->GetFlags() );
+ m_rOuterFace.Push( pA->GetFlags() );
+ }
+ break;
+
+ case( META_POP_ACTION ):
+ {
+ pDummyVDev->Pop();
+ m_rOuterFace.Pop();
+ }
+ break;
+
+ case( META_LAYOUTMODE_ACTION ):
+ {
+ const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*) pAction;
+ m_rOuterFace.SetLayoutMode( pA->GetLayoutMode() );
+ }
+ break;
+
+ case META_TEXTLANGUAGE_ACTION:
+ {
+ const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*) pAction;
+ m_rOuterFace.SetDigitLanguage( pA->GetTextLanguage() );
+ }
+ break;
+
+ case( META_WALLPAPER_ACTION ):
+ {
+ const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pAction;
+ m_rOuterFace.DrawWallpaper( pA->GetRect(), pA->GetWallpaper() );
+ }
+ break;
+
+ case( META_RASTEROP_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ case( META_REFPOINT_ACTION ):
+ {
+ // !!! >>> we don't want to support this actions
+ }
+ break;
+
+ default:
+ // #i24604# Made assertion fire only once per
+ // metafile. The asserted actions here are all
+ // deprecated
+ if( !bAssertionFired )
+ {
+ bAssertionFired = true;
+ DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" );
+ }
+ break;
+ }
+ i++;
+ }
+ }
+
+ delete pPrivateDevice;
+}
+
+// Encryption methods
+
+/* a crutch to transport an rtlDigest safely though UNO API
+ this is needed for the PDF export dialog, which otherwise would have to pass
+ clear text passwords down till they can be used in PDFWriter. Unfortunately
+ the MD5 sum of the password (which is needed to create the PDF encryption key)
+ is not sufficient, since an rtl MD5 digest cannot be created in an arbitrary state
+ which would be needed in PDFWriterImpl::computeEncryptionKey.
+*/
+class EncHashTransporter : public cppu::WeakImplHelper1 < com::sun::star::beans::XMaterialHolder >
+{
+ rtlDigest maUDigest;
+ sal_IntPtr maID;
+ std::vector< sal_uInt8 > maOValue;
+
+ static std::map< sal_IntPtr, EncHashTransporter* > sTransporters;
+public:
+ EncHashTransporter()
+ : maUDigest( rtl_digest_createMD5() )
+ {
+ maID = reinterpret_cast< sal_IntPtr >(this);
+ while( sTransporters.find( maID ) != sTransporters.end() ) // paranoia mode
+ maID++;
+ sTransporters[ maID ] = this;
+ }
+
+ virtual ~EncHashTransporter()
+ {
+ sTransporters.erase( maID );
+ if( maUDigest )
+ rtl_digest_destroyMD5( maUDigest );
+ OSL_TRACE( "EncHashTransporter freed\n" );
+ }
+
+ rtlDigest getUDigest() const { return maUDigest; };
+ std::vector< sal_uInt8 >& getOValue() { return maOValue; }
+ void invalidate()
+ {
+ if( maUDigest )
+ {
+ rtl_digest_destroyMD5( maUDigest );
+ maUDigest = NULL;
+ }
+ }
+
+ // XMaterialHolder
+ virtual uno::Any SAL_CALL getMaterial() throw()
+ {
+ return uno::makeAny( sal_Int64(maID) );
+ }
+
+ static EncHashTransporter* getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& );
+
+};
+
+std::map< sal_IntPtr, EncHashTransporter* > EncHashTransporter::sTransporters;
+
+EncHashTransporter* EncHashTransporter::getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& xRef )
+{
+ EncHashTransporter* pResult = NULL;
+ if( xRef.is() )
+ {
+ uno::Any aMat( xRef->getMaterial() );
+ sal_Int64 nMat = 0;
+ if( aMat >>= nMat )
+ {
+ std::map< sal_IntPtr, EncHashTransporter* >::iterator it = sTransporters.find( static_cast<sal_IntPtr>(nMat) );
+ if( it != sTransporters.end() )
+ pResult = it->second;
+ }
+ }
+ return pResult;
+}
+
+sal_Bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize )
+{
+ if( m_nEncryptionBufferSize < newSize )
+ {
+ /* reallocate the buffer, the used function allocate as rtl_allocateMemory
+ if the pointer parameter is NULL */
+ m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize );
+ if( m_pEncryptionBuffer )
+ m_nEncryptionBufferSize = newSize;
+ else
+ m_nEncryptionBufferSize = 0;
+ }
+ return ( m_nEncryptionBufferSize != 0 );
+}
+
+void PDFWriterImpl::checkAndEnableStreamEncryption( register sal_Int32 nObject )
+{
+ if( m_aContext.Encryption.Encrypt() )
+ {
+ m_bEncryptThisStream = true;
+ sal_Int32 i = m_nKeyLength;
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject;
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 );
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 );
+ //the other location of m_nEncryptionKey are already set to 0, our fixed generation number
+ // do the MD5 hash
+ sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
+ // the i+2 to take into account the generation number, always zero
+ rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) );
+ // initialize the RC4 with the key
+ // key legth: see algoritm 3.1, step 4: (N+5) max 16
+ rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 );
+ }
+}
+
+void PDFWriterImpl::enableStringEncryption( register sal_Int32 nObject )
+{
+ if( m_aContext.Encryption.Encrypt() )
+ {
+ sal_Int32 i = m_nKeyLength;
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject;
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 );
+ m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 );
+ //the other location of m_nEncryptionKey are already set to 0, our fixed generation number
+ // do the MD5 hash
+ sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
+ // the i+2 to take into account the generation number, always zero
+ rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) );
+ // initialize the RC4 with the key
+ // key legth: see algoritm 3.1, step 4: (N+5) max 16
+ rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 );
+ }
+}
+
+/* init the encryption engine
+1. init the document id, used both for building the document id and for building the encryption key(s)
+2. build the encryption key following algorithms described in the PDF specification
+ */
+uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const rtl::OUString& i_rOwnerPassword,
+ const rtl::OUString& i_rUserPassword,
+ bool b128Bit
+ )
+{
+ uno::Reference< beans::XMaterialHolder > xResult;
+ if( i_rOwnerPassword.getLength() || i_rUserPassword.getLength() )
+ {
+ EncHashTransporter* pTransporter = new EncHashTransporter;
+ xResult = pTransporter;
+
+ // get padded passwords
+ sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE];
+ padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW );
+ padPassword( i_rUserPassword, aPadUPW );
+ sal_Int32 nKeyLength = SECUR_40BIT_KEY;
+ if( b128Bit )
+ nKeyLength = SECUR_128BIT_KEY;
+
+ if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), nKeyLength ) )
+ {
+ rtlDigest aDig = pTransporter->getUDigest();
+ if( rtl_digest_updateMD5( aDig, aPadUPW, ENCRYPTED_PWD_SIZE ) != rtl_Digest_E_None )
+ xResult.clear();
+ }
+ else
+ xResult.clear();
+
+ // trash temporary padded cleartext PWDs
+ rtl_zeroMemory( aPadOPW, sizeof(aPadOPW) );
+ rtl_zeroMemory( aPadUPW, sizeof(aPadUPW) );
+
+ }
+ return xResult;
+}
+
+bool PDFWriterImpl::prepareEncryption( const uno::Reference< beans::XMaterialHolder >& xEnc )
+{
+ bool bSuccess = false;
+ EncHashTransporter* pTransporter = EncHashTransporter::getEncHashTransporter( xEnc );
+ if( pTransporter )
+ {
+ sal_Int32 nKeyLength = 0, nRC4KeyLength = 0;
+ sal_Int32 nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, nKeyLength, nRC4KeyLength );
+ m_aContext.Encryption.OValue = pTransporter->getOValue();
+ bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nAccessPermissions );
+ }
+ if( ! bSuccess )
+ {
+ m_aContext.Encryption.OValue.clear();
+ m_aContext.Encryption.UValue.clear();
+ m_aContext.Encryption.EncryptionKey.clear();
+ }
+ return bSuccess;
+}
+
+sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties,
+ sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength )
+{
+ /*
+ 2) compute the access permissions, in numerical form
+
+ the default value depends on the revision 2 (40 bit) or 3 (128 bit security):
+ - for 40 bit security the unused bit must be set to 1, since they are not used
+ - for 128 bit security the same bit must be preset to 0 and set later if needed
+ according to the table 3.15, pdf v 1.4 */
+ sal_Int32 nAccessPermissions = ( i_rProperties.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ;
+
+ /* check permissions for 40 bit security case */
+ nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0;
+ nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0;
+ nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0;
+ nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0;
+ o_rKeyLength = SECUR_40BIT_KEY;
+ o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5
+
+ if( i_rProperties.Security128bit )
+ {
+ o_rKeyLength = SECUR_128BIT_KEY;
+ o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum
+ // permitted value is 16
+ nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0;
+ nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0;
+ nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0;
+ nAccessPermissions |= ( i_rProperties.CanPrintFull ) ? 1 << 11 : 0;
+ }
+ return nAccessPermissions;
+}
+
+/*************************************************************
+begin i12626 methods
+
+Implements Algorithm 3.2, step 1 only
+*/
+void PDFWriterImpl::padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW )
+{
+ // get ansi-1252 version of the password string CHECKIT ! i12626
+ rtl::OString aString( rtl::OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) );
+
+ //copy the string to the target
+ sal_Int32 nToCopy = ( aString.getLength() < ENCRYPTED_PWD_SIZE ) ? aString.getLength() : ENCRYPTED_PWD_SIZE;
+ sal_Int32 nCurrentChar;
+
+ for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ )
+ o_pPaddedPW[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] );
+
+ //pad it with standard byte string
+ sal_Int32 i,y;
+ for( i = nCurrentChar, y = 0 ; i < ENCRYPTED_PWD_SIZE; i++, y++ )
+ o_pPaddedPW[i] = s_nPadString[y];
+
+ // trash memory of temporary clear text password
+ rtl_zeroMemory( (sal_Char*)aString.getStr(), aString.getLength() );
+}
+
+/**********************************
+Algorithm 3.2 Compute the encryption key used
+
+step 1 should already be done before calling, the paThePaddedPassword parameter should contain
+the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter,
+it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used
+
+TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec.
+
+*/
+bool PDFWriterImpl::computeEncryptionKey( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions )
+{
+ bool bSuccess = true;
+ sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
+
+ // transporter contains an MD5 digest with the padded user password already
+ rtlDigest aDigest = i_pTransporter->getUDigest();
+ rtlDigestError nError = rtl_Digest_E_None;
+ if( aDigest )
+ {
+ //step 3
+ if( ! io_rProperties.OValue.empty() )
+ nError = rtl_digest_updateMD5( aDigest, &io_rProperties.OValue[0] , sal_Int32(io_rProperties.OValue.size()) );
+ else
+ bSuccess = false;
+ //Step 4
+ sal_uInt8 nPerm[4];
+
+ nPerm[0] = (sal_uInt8)i_nAccessPermissions;
+ nPerm[1] = (sal_uInt8)( i_nAccessPermissions >> 8 );
+ nPerm[2] = (sal_uInt8)( i_nAccessPermissions >> 16 );
+ nPerm[3] = (sal_uInt8)( i_nAccessPermissions >> 24 );
+
+ if( nError == rtl_Digest_E_None )
+ nError = rtl_digest_updateMD5( aDigest, nPerm , sizeof( nPerm ) );
+
+ //step 5, get the document ID, binary form
+ if( nError == rtl_Digest_E_None )
+ nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) );
+ //get the digest
+ if( nError == rtl_Digest_E_None )
+ {
+ rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) );
+
+ //step 6, only if 128 bit
+ if( io_rProperties.Security128bit )
+ {
+ for( sal_Int32 i = 0; i < 50; i++ )
+ {
+ nError = rtl_digest_updateMD5( aDigest, &nMD5Sum, sizeof( nMD5Sum ) );
+ if( nError != rtl_Digest_E_None )
+ {
+ bSuccess = false;
+ break;
+ }
+ rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) );
+ }
+ }
+ }
+ }
+ else
+ bSuccess = false;
+
+ i_pTransporter->invalidate();
+
+ //Step 7
+ if( bSuccess )
+ {
+ io_rProperties.EncryptionKey.resize( MAXIMUM_RC4_KEY_LENGTH );
+ for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ )
+ io_rProperties.EncryptionKey[i] = nMD5Sum[i];
+ }
+ else
+ io_rProperties.EncryptionKey.clear();
+
+ return bSuccess;
+}
+
+/**********************************
+Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member
+the step numbers down here correspond to the ones in PDF v.1.4 specfication
+*/
+bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword,
+ const sal_uInt8* i_pPaddedUserPassword,
+ std::vector< sal_uInt8 >& io_rOValue,
+ sal_Int32 i_nKeyLength
+ )
+{
+ bool bSuccess = true;
+
+ io_rOValue.resize( ENCRYPTED_PWD_SIZE );
+
+ rtlDigest aDigest = rtl_digest_createMD5();
+ rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream );
+ if( aDigest && aCipher)
+ {
+ //step 1 already done, data is in i_pPaddedOwnerPassword
+ //step 2
+
+ rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pPaddedOwnerPassword, ENCRYPTED_PWD_SIZE );
+ if( nError == rtl_Digest_E_None )
+ {
+ sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
+
+ rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) );
+//step 3, only if 128 bit
+ if( i_nKeyLength == SECUR_128BIT_KEY )
+ {
+ sal_Int32 i;
+ for( i = 0; i < 50; i++ )
+ {
+ nError = rtl_digest_updateMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) );
+ if( nError != rtl_Digest_E_None )
+ {
+ bSuccess = false;
+ break;
+ }
+ rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) );
+ }
+ }
+ //Step 4, the key is in nMD5Sum
+ //step 5 already done, data is in i_pPaddedUserPassword
+ //step 6
+ rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode,
+ nMD5Sum, i_nKeyLength , NULL, 0 );
+ // encrypt the user password using the key set above
+ rtl_cipher_encodeARCFOUR( aCipher, i_pPaddedUserPassword, ENCRYPTED_PWD_SIZE, // the data to be encrypted
+ &io_rOValue[0], sal_Int32(io_rOValue.size()) ); //encrypted data
+ //Step 7, only if 128 bit
+ if( i_nKeyLength == SECUR_128BIT_KEY )
+ {
+ sal_uInt32 i, y;
+ sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key
+
+ for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1
+ {
+ for( y = 0; y < sizeof( nLocalKey ); y++ )
+ nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i );
+
+ rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode,
+ nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL
+ rtl_cipher_encodeARCFOUR( aCipher, &io_rOValue[0], sal_Int32(io_rOValue.size()), // the data to be encrypted
+ &io_rOValue[0], sal_Int32(io_rOValue.size()) ); // encrypted data, can be the same as the input, encrypt "in place"
+ //step 8, store in class data member
+ }
+ }
+ }
+ else
+ bSuccess = false;
+ }
+ else
+ bSuccess = false;
+
+ if( aDigest )
+ rtl_digest_destroyMD5( aDigest );
+ if( aCipher )
+ rtl_cipher_destroyARCFOUR( aCipher );
+
+ if( ! bSuccess )
+ io_rOValue.clear();
+ return bSuccess;
+}
+
+/**********************************
+Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit)
+*/
+bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter,
+ vcl::PDFWriter::PDFEncryptionProperties& io_rProperties,
+ sal_Int32 i_nKeyLength,
+ sal_Int32 i_nAccessPermissions
+ )
+{
+ bool bSuccess = true;
+
+ io_rProperties.UValue.resize( ENCRYPTED_PWD_SIZE );
+
+ rtlDigest aDigest = rtl_digest_createMD5();
+ rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream );
+ if( aDigest && aCipher )
+ {
+ //step 1, common to both 3.4 and 3.5
+ if( computeEncryptionKey( i_pTransporter, io_rProperties, i_nAccessPermissions ) )
+ {
+ // prepare encryption key for object
+ for( sal_Int32 i = i_nKeyLength, y = 0; y < 5 ; y++ )
+ io_rProperties.EncryptionKey[i++] = 0;
+
+ if( io_rProperties.Security128bit == false )
+ {
+ //3.4
+ //step 2 and 3
+ rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode,
+ &io_rProperties.EncryptionKey[0], 5 , // key and key length
+ NULL, 0 ); //destination data area
+ // encrypt the user password using the key set above, save for later use
+ rtl_cipher_encodeARCFOUR( aCipher, s_nPadString, sizeof( s_nPadString ), // the data to be encrypted
+ &io_rProperties.UValue[0], sal_Int32(io_rProperties.UValue.size()) ); //encrypted data, stored in class data member
+ }
+ else
+ {
+ //or 3.5, for 128 bit security
+ //step6, initilize the last 16 bytes of the encrypted user password to 0
+ for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++)
+ io_rProperties.UValue[i] = 0;
+ //step 2
+ rtlDigestError nError = rtl_digest_updateMD5( aDigest, s_nPadString, sizeof( s_nPadString ) );
+ //step 3
+ if( nError == rtl_Digest_E_None )
+ nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) );
+ else
+ bSuccess = false;
+
+ sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
+ rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) );
+ //Step 4
+ rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode,
+ &io_rProperties.EncryptionKey[0], SECUR_128BIT_KEY, NULL, 0 ); //destination data area
+ rtl_cipher_encodeARCFOUR( aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted
+ &io_rProperties.UValue[0], sizeof( nMD5Sum ) ); //encrypted data, stored in class data member
+ //step 5
+ sal_uInt32 i, y;
+ sal_uInt8 nLocalKey[SECUR_128BIT_KEY];
+
+ for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1
+ {
+ for( y = 0; y < sizeof( nLocalKey ) ; y++ )
+ nLocalKey[y] = (sal_uInt8)( io_rProperties.EncryptionKey[y] ^ i );
+
+ rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode,
+ nLocalKey, SECUR_128BIT_KEY, // key and key length
+ NULL, 0 ); //destination data area, on init can be NULL
+ rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.UValue[0], SECUR_128BIT_KEY, // the data to be encrypted
+ &io_rProperties.UValue[0], SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place"
+ }
+ }
+ }
+ else
+ bSuccess = false;
+ }
+ else
+ bSuccess = false;
+
+ if( aDigest )
+ rtl_digest_destroyMD5( aDigest );
+ if( aCipher )
+ rtl_cipher_destroyARCFOUR( aCipher );
+
+ if( ! bSuccess )
+ io_rProperties.UValue.clear();
+ return bSuccess;
+}
+
+/* end i12626 methods */
+
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index d560b0b6e7cc..5c2a742a10ba 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -404,9 +404,21 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
break;
case META_LINE_ACTION:
- aActionBounds = Rectangle( static_cast<const MetaLineAction&>(rAct).GetStartPoint(),
- static_cast<const MetaLineAction&>(rAct).GetEndPoint() );
+ {
+ const MetaLineAction& rMetaLineAction = static_cast<const MetaLineAction&>(rAct);
+ aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() );
+ aActionBounds.Justify();
+ const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth());
+ if(nLineWidth)
+ {
+ const long nHalfLineWidth((nLineWidth + 1) / 2);
+ aActionBounds.Left() -= nHalfLineWidth;
+ aActionBounds.Top() -= nHalfLineWidth;
+ aActionBounds.Right() += nHalfLineWidth;
+ aActionBounds.Bottom() += nHalfLineWidth;
+ }
break;
+ }
case META_RECT_ACTION:
aActionBounds = static_cast<const MetaRectAction&>(rAct).GetRect();
@@ -446,8 +458,20 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic
break;
case META_POLYLINE_ACTION:
- aActionBounds = static_cast<const MetaPolyLineAction&>(rAct).GetPolygon().GetBoundRect();
+ {
+ const MetaPolyLineAction& rMetaPolyLineAction = static_cast<const MetaPolyLineAction&>(rAct);
+ aActionBounds = rMetaPolyLineAction.GetPolygon().GetBoundRect();
+ const long nLineWidth(rMetaPolyLineAction.GetLineInfo().GetWidth());
+ if(nLineWidth)
+ {
+ const long nHalfLineWidth((nLineWidth + 1) / 2);
+ aActionBounds.Left() -= nHalfLineWidth;
+ aActionBounds.Top() -= nHalfLineWidth;
+ aActionBounds.Right() += nHalfLineWidth;
+ aActionBounds.Bottom() += nHalfLineWidth;
+ }
break;
+ }
case META_POLYGON_ACTION:
aActionBounds = static_cast<const MetaPolygonAction&>(rAct).GetPolygon().GetBoundRect();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 51f33ed17f6c..98eac5e982d3 100755
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -150,6 +150,7 @@ public:
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;
boost::shared_ptr<Printer> mpPrinter;
Sequence< PropertyValue > maUIOptions;
@@ -158,6 +159,7 @@ public:
PropertyToIndexMap maPropertyToIndex;
Link maOptionChangeHdl;
ControlDependencyMap maControlDependencies;
+ ChoiceDisableMap maChoiceDisableMap;
sal_Bool mbFirstPage;
sal_Bool mbLastPage;
sal_Bool mbReversePageOrder;
@@ -186,17 +188,17 @@ public:
{}
~ImplPrinterControllerData() { delete mpProgress; }
- Size getRealPaperSize( const Size& i_rPageSize ) const
+ Size getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const
{
if( maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0 )
return maFixedPageSize;
- if( maMultiPage.nRows * maMultiPage.nColumns > 1 )
+ if( maMultiPage.nRows * maMultiPage.nColumns > 1 && ! bNoNUP )
return maMultiPage.aPaperSize;
return i_rPageSize;
}
bool isFixedPageSize() const
{ return maFixedPageSize.Width() != 0 && maFixedPageSize.Height() != 0; }
- PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps );
+ PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP );
};
PrinterController::PrinterController()
@@ -556,7 +558,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::
mnCurPage = 1;
mnCurPrintPage = 1;
mbPrinting = TRUE;
- if( ImplGetSVData()->maGDIData.mbPrinterPullModel )
+ if( GetCapabilities( PRINTER_CAPABILITIES_USEPULLMODEL ) )
{
mbJobActive = TRUE;
// sallayer does all necessary page printing
@@ -765,7 +767,7 @@ bool PrinterController::setupPrinter( Window* i_pParent )
return bRet;
}
-PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps )
+PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP )
{
PrinterController::PageSize aPageSize;
aPageSize.aSize = mpPrinter->GetPaperSize();
@@ -800,7 +802,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
if( aSetSize.Width && aSetSize.Height )
{
Size aSetPaperSize( aSetSize.Width, aSetSize.Height );
- Size aRealPaperSize( getRealPaperSize( aSetPaperSize ) );
+ Size aRealPaperSize( getRealPaperSize( aSetPaperSize, bNoNUP ) );
if( aRealPaperSize != aCurSize )
aIsSize = aSetSize;
}
@@ -810,7 +812,7 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
aPageSize.aSize.Width() = aIsSize.Width;
aPageSize.aSize.Height() = aIsSize.Height;
- Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) );
+ Size aRealPaperSize( getRealPaperSize( aPageSize.aSize, bNoNUP ) );
if( aRealPaperSize != aCurSize )
mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() );
}
@@ -876,7 +878,7 @@ PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPag
mpImplData->mpPrinter->SetMapMode( aMapMode );
// modify job setup if necessary
- PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm );
+ PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm, true );
o_rMtf.SetPrefSize( aPageSize.aSize );
o_rMtf.SetPrefMapMode( aMapMode );
@@ -958,7 +960,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte
rMPS.nTopMargin == 0 && rMPS.nBottomMargin == 0 )
{
PrinterController::PageSize aPageSize = getPageFile( i_nFilteredPage, o_rMtf, i_bMayUseCache );
- Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize );
+ Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize, true );
mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() );
if( aPaperSize != aPageSize.aSize )
@@ -980,7 +982,7 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte
sal_Bool bIsLastPage = mpImplData->mbLastPage;
mpImplData->mbLastPage = sal_False;
- Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize ) );
+ Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize, false ) );
// multi page area: page size minus margins + one time spacing right and down
// the added spacing is so each subpage can be calculated including its spacing
@@ -1029,6 +1031,14 @@ PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilte
nCellX = (nSubPage / rMPS.nRows);
nCellY = (nSubPage % rMPS.nRows);
break;
+ case PrinterController::RLTB:
+ nCellX = rMPS.nColumns - 1 - (nSubPage % rMPS.nColumns);
+ nCellY = (nSubPage / rMPS.nColumns);
+ break;
+ case PrinterController::TBRL:
+ nCellX = rMPS.nColumns - 1 - (nSubPage / rMPS.nRows);
+ nCellY = (nSubPage % rMPS.nRows);
+ break;
}
// scale the metafile down to a sub page size
double fScaleX = double(aSubPageSize.Width())/double(aPageSize.aSize.Width());
@@ -1338,6 +1348,7 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
bool bHaveProperty = false;
rtl::OUString aPropName;
vcl::ImplPrinterControllerData::ControlDependency aDep;
+ Sequence< sal_Bool > aChoicesDisabled;
for( int n = 0; n < aOptProp.getLength(); n++ )
{
const beans::PropertyValue& rEntry( aOptProp[ n ] );
@@ -1365,6 +1376,10 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
{
rEntry.Value >>= aDep.mnDependsOnEntry;
}
+ else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) )
+ {
+ rEntry.Value >>= aChoicesDisabled;
+ }
}
if( bHaveProperty )
{
@@ -1377,6 +1392,8 @@ void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_
}
if( aDep.maDependsOnName.getLength() > 0 )
mpImplData->maControlDependencies[ aPropName ] = aDep;
+ if( aChoicesDisabled.getLength() > 0 )
+ mpImplData->maChoiceDisableMap[ aPropName ] = aChoicesDisabled;
}
}
}
@@ -1452,6 +1469,20 @@ bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) co
return bEnabled;
}
+bool PrinterController::isUIChoiceEnabled( const rtl::OUString& i_rProperty, sal_Int32 i_nValue ) const
+{
+ bool bEnabled = true;
+ ImplPrinterControllerData::ChoiceDisableMap::const_iterator it =
+ mpImplData->maChoiceDisableMap.find( i_rProperty );
+ if(it != mpImplData->maChoiceDisableMap.end() )
+ {
+ const Sequence< sal_Bool >& rDisabled( it->second );
+ if( i_nValue >= 0 && i_nValue < rDisabled.getLength() )
+ bEnabled = ! rDisabled[i_nValue];
+ }
+ return bEnabled;
+}
+
rtl::OUString PrinterController::getDependency( const rtl::OUString& i_rProperty ) const
{
rtl::OUString aDependency;
@@ -1833,14 +1864,20 @@ Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle,
const Sequence< rtl::OUString >& i_rChoices,
sal_Int32 i_nValue,
const rtl::OUString& i_rType,
+ const Sequence< sal_Bool >& i_rDisabledChoices,
const PrinterOptionsHelper::UIControlOptions& i_rControlOptions
)
{
UIControlOptions aOpt( i_rControlOptions );
sal_Int32 nUsed = aOpt.maAddProps.getLength();
- aOpt.maAddProps.realloc( nUsed + 1 );
+ aOpt.maAddProps.realloc( nUsed + 1 + (i_rDisabledChoices.getLength() ? 1 : 0) );
aOpt.maAddProps[nUsed].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) );
aOpt.maAddProps[nUsed].Value = makeAny( i_rChoices );
+ if( i_rDisabledChoices.getLength() )
+ {
+ aOpt.maAddProps[nUsed+1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChoicesDisabled" ) );
+ aOpt.maAddProps[nUsed+1].Value = makeAny( i_rDisabledChoices );
+ }
PropertyValue aVal;
aVal.Name = i_rProperty;
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index ebdd59f517af..601e46411cd8 100644
--- a/vcl/source/glyphs/gcach_ftyp.cxx
+++ b/vcl/source/glyphs/gcach_ftyp.cxx
@@ -301,6 +301,7 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
mnSynthetic( nSynthetic ),
mnFontId( nFontId ),
maDevFontAttributes( rDevFontAttributes ),
+ mpFontCharMap( NULL ),
mpChar2Glyph( NULL ),
mpGlyph2Char( NULL ),
mpExtraKernInfo( pExtraKernInfo )
@@ -318,6 +319,8 @@ FtFontInfo::FtFontInfo( const ImplDevFontAttributes& rDevFontAttributes,
FtFontInfo::~FtFontInfo()
{
+ if( mpFontCharMap )
+ mpFontCharMap->DeReference();
delete mpExtraKernInfo;
delete mpChar2Glyph;
delete mpGlyph2Char;
@@ -520,10 +523,25 @@ void* FreetypeServerFont::GetFtFace() const
FreetypeManager::~FreetypeManager()
{
-// This crashes on Solaris 10
-// TODO: check which versions have this problem
-//
-// FT_Error rcFT = FT_Done_FreeType( aLibFT );
+ // 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
+ }
}
// -----------------------------------------------------------------------
@@ -895,6 +913,9 @@ void FreetypeServerFont::SetFontOptions( const ImplFontOptions& rFontOptions)
}
}
#endif
+
+ if( mnPrioEmbedded <= 0 )
+ mnLoadFlags |= FT_LOAD_NO_BITMAP;
}
// -----------------------------------------------------------------------
@@ -1730,16 +1751,39 @@ bool FreetypeServerFont::GetGlyphBitmap8( int nGlyphIndex, RawBitmap& rRawBitmap
// determine unicode ranges in font
// -----------------------------------------------------------------------
-// TODO: replace with GetFontCharMap()
-bool FreetypeServerFont::GetFontCodeRanges( CmapResult& rResult ) const
+const ImplFontCharMap* FreetypeServerFont::GetImplFontCharMap( void ) const
+{
+ const ImplFontCharMap* pIFCMap = mpFontInfo->GetImplFontCharMap();
+ return pIFCMap;
+}
+
+const ImplFontCharMap* FtFontInfo::GetImplFontCharMap( void )
+{
+ // check if the charmap is already cached
+ if( mpFontCharMap )
+ return mpFontCharMap;
+
+ // get the charmap and cache it
+ CmapResult aCmapResult;
+ bool bOK = GetFontCodeRanges( aCmapResult );
+ if( bOK )
+ mpFontCharMap = new ImplFontCharMap( aCmapResult );
+ else
+ mpFontCharMap = ImplFontCharMap::GetDefaultMap();
+ mpFontCharMap->AddReference();
+ return mpFontCharMap;
+}
+
+// TODO: merge into method GetFontCharMap()
+bool FtFontInfo::GetFontCodeRanges( CmapResult& rResult ) const
{
- rResult.mbSymbolic = mpFontInfo->IsSymbolFont();
+ rResult.mbSymbolic = IsSymbolFont();
// TODO: is the full CmapResult needed on platforms calling this?
if( FT_IS_SFNT( maFaceFT ) )
{
ULONG nLength = 0;
- const unsigned char* pCmap = mpFontInfo->GetTable( "cmap", &nLength );
+ const unsigned char* pCmap = GetTable( "cmap", &nLength );
if( pCmap && (nLength > 0) )
if( ParseCMAP( pCmap, nLength, rResult ) )
return true;
diff --git a/vcl/source/glyphs/gcach_ftyp.hxx b/vcl/source/glyphs/gcach_ftyp.hxx
index 5ebe70bcbdf9..d760ce1d1fed 100644
--- a/vcl/source/glyphs/gcach_ftyp.hxx
+++ b/vcl/source/glyphs/gcach_ftyp.hxx
@@ -94,6 +94,9 @@ public:
int GetGlyphIndex( sal_UCS4 cChar ) const;
void CacheGlyphIndex( sal_UCS4 cChar, int nGI ) const;
+ bool GetFontCodeRanges( CmapResult& ) const;
+ const ImplFontCharMap* GetImplFontCharMap( void );
+
bool HasExtraKerning() const;
int GetExtraKernPairs( ImplKernPairData** ) const;
int GetExtraGlyphKernValue( int nLeftGlyph, int nRightGlyph ) const;
@@ -108,6 +111,8 @@ private:
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;
@@ -181,6 +186,7 @@ public:
virtual bool NeedsArtificialItalic() const { return mbArtItalic; }
virtual void FetchFontMetric( ImplFontMetricData&, long& rFactor ) const;
+ virtual const ImplFontCharMap* GetImplFontCharMap( void ) const;
virtual int GetGlyphIndex( sal_UCS4 ) const;
int GetRawGlyphIndex( sal_UCS4 ) const;
@@ -203,7 +209,6 @@ protected:
int ApplyGlyphTransform( int nGlyphFlags, FT_GlyphRec_*, bool ) const;
virtual void InitGlyphData( int nGlyphIndex, GlyphData& ) const;
- virtual bool GetFontCodeRanges( CmapResult& ) const;
bool ApplyGSUB( const ImplFontSelectData& );
virtual ServerFontLayoutEngine* GetLayoutEngine();
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 1953ecf553c4..7181db56dd4d 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -78,12 +78,18 @@ GlyphCache::~GlyphCache()
void GlyphCache::InvalidateAllGlyphs()
{
-#if 0 // TODO: implement uncaching of all glyph shapes and metrics
- for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it )
- delete const_cast<ServerFont*>( it->second );
- maFontList.clear();
- mpCurrentGCFont = NULL;
-#endif
+ // 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') )
+ {
+ // uncache of all glyph shapes and metrics
+ for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it )
+ delete const_cast<ServerFont*>( it->second );
+ maFontList.clear();
+ mpCurrentGCFont = NULL;
+ }
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/glyphs/graphite_cache.cxx b/vcl/source/glyphs/graphite_cache.cxx
index 389accd631f0..7682cdb6c8ba 100644
--- a/vcl/source/glyphs/graphite_cache.cxx
+++ b/vcl/source/glyphs/graphite_cache.cxx
@@ -36,10 +36,10 @@
#include <tools/debug.hxx>
#include <vcl/sallayout.hxx>
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Segment.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
#include <rtl/ustring.hxx>
#include <vcl/graphite_layout.hxx>
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 0f7d2f5f3005..8a011606ab41 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -67,13 +67,13 @@
#include <unicode/uscript.h>
// Graphite Libraries (must be after vcl headers on windows)
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
#include <graphite/Segment.h>
#include <graphite/SegmentPainter.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
#include <vcl/graphite_layout.hxx>
#include <vcl/graphite_features.hxx>
@@ -1048,13 +1048,13 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
{
if (mvGlyphs[i].IsClusterStart())
{
- nOffset = fExtraPerCluster * nCluster;
+ nOffset = FRound( fExtraPerCluster * nCluster );
size_t nCharIndex = mvGlyph2Char[i];
mvCharDxs[nCharIndex] += nOffset;
// adjust char dxs for rest of characters in cluster
while (++nCharIndex < mvGlyph2Char.size())
{
- int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK;
+ int nChar2Base = (mvChar2BaseGlyph[nCharIndex] == -1)? -1 : (int)(mvChar2BaseGlyph[nCharIndex] & GLYPH_INDEX_MASK);
if (nChar2Base == -1 || nChar2Base == static_cast<int>(i))
mvCharDxs[nCharIndex] += nOffset;
}
@@ -1077,14 +1077,15 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
Glyphs::iterator iGlyph = mvGlyphs.begin();
while (iGlyph != iLastGlyph)
{
- iGlyph->maLinearPos.X() = static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor;
+ iGlyph->maLinearPos.X() = FRound( fXFactor * iGlyph->maLinearPos.X() );
++iGlyph;
}
for (size_t i = 0; i < mvCharDxs.size(); i++)
{
- mvCharDxs[i] = fXFactor * static_cast<float>(mvCharDxs[i]);
+ mvCharDxs[i] = FRound( fXFactor * mvCharDxs[i] );
}
}
+ mnWidth = rArgs.mnLayoutWidth;
}
void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth)
@@ -1107,7 +1108,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 : mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK;
+ int nChar2Base = (mvChar2BaseGlyph[i] == -1)? -1 : (int)(mvChar2BaseGlyph[i] & GLYPH_INDEX_MASK);
if ((nChar2Base > -1) && (nChar2Base != nPrevClusterGlyph))
{
assert((nChar2Base > -1) && (nChar2Base < (signed)mvGlyphs.size()));
@@ -1121,11 +1122,11 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
int nLastGlyph = nChar2Base;
for (; j < nChars; j++)
{
- int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK;
+ int nChar2BaseJ = (mvChar2BaseGlyph[j] == -1)? -1 : (int)(mvChar2BaseGlyph[j] & GLYPH_INDEX_MASK);
assert((nChar2BaseJ >= -1) && (nChar2BaseJ < (signed)mvGlyphs.size()));
if (nChar2BaseJ != -1 && mvGlyphs[nChar2BaseJ].IsClusterStart())
{
- nLastGlyph = nChar2BaseJ + ((bRtl)? 1 : -1);
+ nLastGlyph = nChar2BaseJ + ((bRtl)? +1 : -1);
nLastChar = j - 1;
break;
}
diff --git a/vcl/source/glyphs/graphite_textsrc.hxx b/vcl/source/glyphs/graphite_textsrc.hxx
index 3912977cc9be..388f8a631b49 100644
--- a/vcl/source/glyphs/graphite_textsrc.hxx
+++ b/vcl/source/glyphs/graphite_textsrc.hxx
@@ -59,11 +59,11 @@
#include "vcl/dllapi.h"
// Libraries
-#include <tools/preextstl.h>
+#include <preextstl.h>
#include <graphite/GrClient.h>
#include <graphite/Font.h>
#include <graphite/ITextSource.h>
-#include <tools/postextstl.h>
+#include <postextstl.h>
// Module type definitions and forward declarations.
//
diff --git a/vcl/source/helper/makefile.mk b/vcl/source/helper/makefile.mk
index e708bdec9eaa..1a417417dbe4 100644
--- a/vcl/source/helper/makefile.mk
+++ b/vcl/source/helper/makefile.mk
@@ -46,7 +46,6 @@ SLOFILES=\
$(SLO)$/canvastools.obj \
$(SLO)$/xconnection.obj \
$(SLO)$/threadex.obj \
- $(SLO)$/smartid.obj \
$(SLO)$/lazydelete.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/source/helper/smartid.cxx b/vcl/source/helper/smartid.cxx
deleted file mode 100755
index c367aeb2bce5..000000000000
--- a/vcl/source/helper/smartid.cxx
+++ /dev/null
@@ -1,264 +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"
-#include <vcl/smartid.hxx>
-
-struct ImplSmartIdData
-{
- String aUId;
- ULONG nUId;
- BOOL bHasStringId;
- BOOL bHasNumericId;
-};
-
-
-ImplSmartIdData* SmartId::GetSmartIdData()
-{
- if ( !mpData )
- {
- mpData = new ImplSmartIdData;
-// mpData->aUId = "";
- mpData->nUId = 0;
- mpData->bHasStringId = FALSE;
- mpData->bHasNumericId = FALSE;
- }
- return mpData;
-}
-
-
-SmartId::SmartId( const String& rId )
-: mpData( NULL )
-{
- GetSmartIdData()->aUId = rId;
- GetSmartIdData()->bHasStringId = TRUE;
-}
-
-SmartId::SmartId( ULONG nId )
-: mpData( NULL )
-{
- GetSmartIdData()->nUId = nId;
- GetSmartIdData()->bHasNumericId = TRUE;
-}
-
-SmartId::SmartId( const String& rId, ULONG nId )
-: mpData( NULL )
-{
- GetSmartIdData()->aUId = rId;
- GetSmartIdData()->bHasStringId = TRUE;
- GetSmartIdData()->nUId = nId;
- GetSmartIdData()->bHasNumericId = TRUE;
-}
-
-SmartId::SmartId()
-: mpData( NULL )
-{}
-
-SmartId::SmartId( const SmartId& rId )
-: mpData( NULL )
-{
- if ( rId.mpData )
- {
- GetSmartIdData();
- mpData->aUId = rId.mpData->aUId;
- mpData->bHasStringId = rId.mpData->bHasStringId;
- mpData->nUId = rId.mpData->nUId;
- mpData->bHasNumericId = rId.mpData->bHasNumericId;
- }
-}
-
-SmartId& SmartId::operator = ( const SmartId& rId )
-{
- if ( rId.mpData )
- GetSmartIdData();
- else
- {
- delete mpData;
- mpData = NULL;
- }
- if ( mpData && rId.mpData )
- {
- mpData->aUId = rId.mpData->aUId;
- mpData->bHasStringId = rId.mpData->bHasStringId;
- mpData->nUId = rId.mpData->nUId;
- mpData->bHasNumericId = rId.mpData->bHasNumericId;
- }
- return *this;
-}
-
-SmartId::~SmartId()
-{
- if ( mpData )
- delete mpData;
-#ifdef DBG_UTIL
- if ( mpData )
- mpData = (ImplSmartIdData*)0xDeadBeef;
-#endif
-}
-
-void SmartId::UpdateId( const SmartId& rId, SmartIdUpdateMode aMode )
-{
- // Check if ImplData is needed
- if ( aMode != SMART_SET_SMART || ( rId.HasString() || rId.HasNumeric() ) )
- GetSmartIdData();
-
- if ( aMode == SMART_SET_STR || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasString() ) )
- {
- GetSmartIdData()->aUId = rId.GetStr();
- GetSmartIdData()->bHasStringId = rId.HasString();
- }
- if ( aMode == SMART_SET_NUM || aMode == SMART_SET_ALL || ( aMode == SMART_SET_SMART && rId.HasNumeric() ) )
- {
- GetSmartIdData()->nUId = rId.GetNum();
- GetSmartIdData()->bHasNumericId = rId.HasNumeric();
- }
-
- // remove ImplData when no IDs are set. This is Important because Implementation of Equals() Matches and HasAny relies on it
- if ( mpData && !mpData->bHasStringId && !mpData->bHasNumericId )
- {
- delete mpData;
- mpData = NULL;
- }
-}
-
-BOOL SmartId::HasNumeric() const
-{
- if ( !mpData )
- return FALSE;
- else
- return mpData->bHasNumericId;
-}
-
-BOOL SmartId::HasString() const
-{
- if ( !mpData )
- return FALSE;
- else
- return mpData->bHasStringId;
-}
-
-BOOL SmartId::HasAny() const
-{
- return mpData != NULL;
-}
-
-ULONG SmartId::GetNum() const
-{
- if ( !mpData )
- return 0;
- else
- return mpData->nUId;
-}
-
-String SmartId::GetStr() const
-{
- if ( !mpData )
- return String();
- else
- return mpData->aUId;
-}
-
-
-String SmartId::GetText() const // return String for UI usage
-{
- String aRes;
- if ( HasNumeric() )
- aRes = String::CreateFromInt64( GetNum() );
- if ( HasString() )
- {
- if ( HasNumeric() )
- aRes.AppendAscii( "/" );
- aRes.Append( GetStr() );
- }
- return aRes;
-}
-
-BOOL SmartId::Matches( const String &rId )const
-{
- if ( HasString() )
- return GetStr().EqualsIgnoreCaseAscii( rId );
- else
- return FALSE;
-}
-
-BOOL SmartId::Matches( const ULONG nId ) const
-{
- if ( HasNumeric() )
- return GetNum() == nId;
- else
- return FALSE;
-}
-
-/******************************************************************************
-If Both Ids have nither Strings nor Numbers they don't match
-If both Ids have Strings the result of Matching these is returned.
-Numbers are then Ignored.
-Else Matching Numbers is attempted.
-******************************************************************************/
-BOOL SmartId::Matches( const SmartId &rId ) const
-{
- if ( !mpData || !rId.mpData )
- return FALSE;
- else if ( HasString() && rId.HasString() )
- return Matches( rId.GetStr() );
- else
- return rId.HasNumeric() && Matches( rId.GetNum() );
-}
-
-BOOL SmartId::Equals( const SmartId &rId ) const
-{
- if ( mpData && rId.mpData )
- return mpData->aUId.EqualsIgnoreCaseAscii( rId.mpData->aUId )
- && mpData->bHasStringId == rId.mpData->bHasStringId
- && mpData->nUId == rId.mpData->nUId
- && mpData->bHasNumericId == rId.mpData->bHasNumericId;
- else if ( !mpData && !rId.mpData )
- return TRUE;
- else
- return FALSE;
-}
-
-BOOL SmartId::operator == ( const SmartId& rRight ) const
-{
- return Equals( rRight );
-}
-
-BOOL SmartId::operator < ( const SmartId& rRight ) const
-{
- if ( HasString() && rRight.HasString() && GetStr() != rRight.GetStr() )
- return GetStr() < rRight.GetStr();
- else if ( HasNumeric() && rRight.HasNumeric() && GetNum() != rRight.GetNum() )
- return GetNum() < rRight.GetNum();
- else
- { // Sort Strings to Front
- if ( HasString() )
- return rRight.HasString() && rRight.HasNumeric();
- else
- return rRight.HasString() || (!HasNumeric() && rRight.HasNumeric());
- }
-}
diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index db622073cea9..67f50b69a182 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -365,8 +365,8 @@ String WhitespaceToSpace( const String& rLine, BOOL bProtect )
else
{
*pLeap = *pRun;
- *pLeap++;
- *pRun++;
+ ++pLeap;
+ ++pRun;
}
}
}
@@ -422,8 +422,8 @@ ByteString WhitespaceToSpace( const ByteString& rLine, BOOL bProtect )
else
{
*pLeap = *pRun;
- *pLeap++;
- *pRun++;
+ ++pLeap;
+ ++pRun;
}
}
}
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
index 58f0a477c848..436ab40bdc5f 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -29,6 +29,7 @@
ModalDialog SV_DLG_PRINT
{
+ HelpID = "vcl:ModalDialog:SV_DLG_PRINT";
Text [en-US] = "Print";
Closeable = TRUE;
Sizeable = TRUE;
@@ -64,6 +65,7 @@ ModalDialog SV_DLG_PRINT
};
NumericField SV_PRINT_PAGE_EDIT
{
+ HelpID = "vcl:NumericField:SV_DLG_PRINT:SV_PRINT_PAGE_EDIT";
Pos = MAP_APPFONT( 5, 140 );
Size = MAP_APPFONT( 30, 12 );
SVLook = TRUE;
@@ -80,18 +82,21 @@ ModalDialog SV_DLG_PRINT
};
PushButton SV_PRINT_PAGE_FORWARD
{
+ HelpID = "vcl:PushButton:SV_DLG_PRINT:SV_PRINT_PAGE_FORWARD";
Pos = MAP_APPFONT( 95, 140 );
Size = MAP_APPFONT( 15, 12 );
HelpText [en-US] = "Scroll one page forward.";
};
PushButton SV_PRINT_PAGE_BACKWARD
{
+ HelpID = "vcl:PushButton:SV_DLG_PRINT:SV_PRINT_PAGE_BACKWARD";
Pos = MAP_APPFONT( 80, 140 );
Size = MAP_APPFONT( 15, 12 );
HelpText [en-US] = "Scroll one page backward.";
};
TabControl SV_PRINT_TABCTRL
{
+ HelpID = "vcl:TabControl:SV_DLG_PRINT:SV_PRINT_TABCTRL";
Pos = MAP_APPFONT( 140, 5 );
Size = MAP_APPFONT( 205, 175 );
};
@@ -123,6 +128,7 @@ ModalDialog SV_DLG_PRINT
TabPage SV_PRINT_TAB_NUP
{
+ HelpID = "vcl:TabPage:SV_PRINT_TAB_NUP";
Text [en-US] = "Page Layout";
Hide = TRUE;
@@ -134,6 +140,7 @@ ModalDialog SV_DLG_PRINT
};
RadioButton SV_PRINT_PRT_NUP_DEFAULT_BTN
{
+ HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_DEFAULT_BTN";
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 10, 10 );
Text [en-US] = "~Default";
@@ -141,12 +148,14 @@ ModalDialog SV_DLG_PRINT
};
RadioButton SV_PRINT_PRT_NUP_BROCHURE_BTN
{
+ HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_BROCHURE_BTN";
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 10, 10 );
Text = "";
};
RadioButton SV_PRINT_PRT_NUP_PAGES_BTN
{
+ HelpID = "vcl:RadioButton:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_PAGES_BTN";
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 10, 10 );
Text [en-US] = "Pa~ges per sheet";
@@ -154,6 +163,7 @@ ModalDialog SV_DLG_PRINT
};
ListBox SV_PRINT_PRT_NUP_PAGES_BOX
{
+ HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_PAGES_BOX";
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 10, 80 );
Border = TRUE;
@@ -180,6 +190,7 @@ ModalDialog SV_DLG_PRINT
};
NumericField SV_PRINT_PRT_NUP_COLS_EDT
{
+ HelpID = "vcl:NumericField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_COLS_EDT";
Pos = MAP_APPFONT( 55, 20 );
Size = MAP_APPFONT( 40, 12 );
Border = TRUE;
@@ -198,6 +209,7 @@ ModalDialog SV_DLG_PRINT
};
NumericField SV_PRINT_PRT_NUP_ROWS_EDT
{
+ HelpID = "vcl:NumericField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ROWS_EDT";
Pos = MAP_APPFONT( 55, 35 );
Size = MAP_APPFONT( 40, 12 );
Border = TRUE;
@@ -215,6 +227,7 @@ ModalDialog SV_DLG_PRINT
};
MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT
{
+ HelpID = "vcl:MetricField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT";
Pos = MAP_APPFONT( 55, 95 );
Size = MAP_APPFONT( 40, 12 );
Spin = TRUE;
@@ -237,6 +250,7 @@ ModalDialog SV_DLG_PRINT
};
MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT
{
+ HelpID = "vcl:MetricField:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT";
Pos = MAP_APPFONT( 155, 95 );
Size = MAP_APPFONT( 40, 12 );
Spin = TRUE;
@@ -259,6 +273,7 @@ ModalDialog SV_DLG_PRINT
};
ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX
{
+ HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ORIENTATION_BOX";
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 10, 40 );
Border = TRUE;
@@ -280,20 +295,24 @@ ModalDialog SV_DLG_PRINT
};
ListBox SV_PRINT_PRT_NUP_ORDER_BOX
{
+ HelpID = "vcl:ListBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_ORDER_BOX";
Pos = MAP_APPFONT( 0, 0 );
- Size = MAP_APPFONT( 10, 20 );
+ Size = MAP_APPFONT( 10, 50 );
DropDown = TRUE;
Border = TRUE;
CurPos = 0;
StringList [en-US] =
{
- < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >;
- < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >;
+ < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTB; >;
+ < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TBLR; >;
+ < "top to bottom, then left"; SV_PRINT_PRT_NUP_ORDER_TBRL; >;
+ < "right to left, then down"; SV_PRINT_PRT_NUP_ORDER_RLTB; >;
};
HelpText [en-US] = "Select order in which pages are to be printed.";
};
CheckBox SV_PRINT_PRT_NUP_BORDER_CB
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_NUP:SV_PRINT_PRT_NUP_BORDER_CB";
Pos = MAP_APPFONT( 10, 65 );
Size = MAP_APPFONT( 150, 12 );
Text [en-US] = "Draw a border around each page";
@@ -303,6 +322,7 @@ ModalDialog SV_DLG_PRINT
TabPage SV_PRINT_TAB_JOB
{
+ HelpID = "vcl:TabPage:SV_PRINT_TAB_JOB";
Text [en-US] = "General";
Hide = TRUE;
@@ -314,6 +334,7 @@ ModalDialog SV_DLG_PRINT
};
ListBox SV_PRINT_PRINTERS
{
+ HelpID = "vcl:ListBox:SV_PRINT_TAB_JOB:SV_PRINT_PRINTERS";
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 100, 80 );
Border = TRUE;
@@ -322,6 +343,7 @@ ModalDialog SV_DLG_PRINT
};
CheckBox SV_PRINT_DETAILS_BTN
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_JOB:SV_PRINT_DETAILS_BTN";
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 5, 5 );
Text [en-US] = "Details";
@@ -347,6 +369,7 @@ ModalDialog SV_DLG_PRINT
};
PushButton SV_PRINT_PRT_SETUP
{
+ HelpID = "vcl:PushButton:SV_PRINT_TAB_JOB:SV_PRINT_PRT_SETUP";
Pos = MAP_APPFONT( 115, 5 );
Size = MAP_APPFONT( 50, 15 );
Text [en-US] = "Properties...";
@@ -366,6 +389,7 @@ ModalDialog SV_DLG_PRINT
};
NumericField SV_PRINT_COPYCOUNT_FIELD
{
+ HelpID = "vcl:NumericField:SV_PRINT_TAB_JOB:SV_PRINT_COPYCOUNT_FIELD";
Pos = MAP_APPFONT( 10, 56 );
Size = MAP_APPFONT( 40, 12 );
Border = TRUE;
@@ -382,6 +406,7 @@ ModalDialog SV_DLG_PRINT
};
CheckBox SV_PRINT_COLLATE
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_JOB:SV_PRINT_COLLATE";
Pos = MAP_APPFONT( 95, 45 );
Size = MAP_APPFONT( 70, 10 );
Text [en-US] = "Collate";
@@ -411,6 +436,7 @@ ModalDialog SV_DLG_PRINT
TabPage SV_PRINT_TAB_OPT
{
+ HelpID = "vcl:TabPage:SV_PRINT_TAB_OPT";
Text [en-US] = "Options";
Hide = TRUE;
@@ -422,6 +448,7 @@ ModalDialog SV_DLG_PRINT
};
CheckBox SV_PRINT_OPT_TOFILE
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_TOFILE";
Pos = MAP_APPFONT( 10, 20 );
Size = MAP_APPFONT( 200, 12 );
Text [en-US] = "Print to ~file";
@@ -429,6 +456,7 @@ ModalDialog SV_DLG_PRINT
};
CheckBox SV_PRINT_OPT_SINGLEJOBS
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_SINGLEJOBS";
Pos = MAP_APPFONT( 10, 35 );
Size = MAP_APPFONT( 200, 12 );
Text [en-US] = "~Create single print jobs for collated output";
@@ -436,6 +464,7 @@ ModalDialog SV_DLG_PRINT
};
CheckBox SV_PRINT_OPT_REVERSE
{
+ HelpID = "vcl:CheckBox:SV_PRINT_TAB_OPT:SV_PRINT_OPT_REVERSE";
Pos = MAP_APPFONT( 10, 50 );
Size = MAP_APPFONT( 200, 12 );
Text [en-US] = "Print in ~reverse page order";
@@ -446,6 +475,7 @@ ModalDialog SV_DLG_PRINT
ModelessDialog SV_DLG_PRINT_PROGRESS
{
+ HelpID = "vcl:ModelessDialog:SV_DLG_PRINT_PROGRESS";
Text [en-US] = "Printing";
Closeable = FALSE;
Sizeable = FALSE;
@@ -488,5 +518,6 @@ StringArray SV_PRINT_NATIVE_STRINGS
< "Page number"; >;
< "Number of pages"; >;
< "More"; >;
+ < "Print selection only"; >;
};
};
diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src
index 2c6574220a5f..1b95f7bb1d72 100644
--- a/vcl/source/src/stdtext.src
+++ b/vcl/source/src/stdtext.src
@@ -101,6 +101,11 @@ String SV_ACCESSERROR_TURNAROUND_MSG
Text [ en-US ] = "The Java Access Bridge could not be started.";
};
+String SV_ACCESSERROR_NO_FONTS
+{
+ Text [ en-US ] = "No fonts could be found on the system.";
+};
+
String SV_STDTEXT_ABOUT
{
Text [ en-US ] = "About %PRODUCTNAME";
diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx
index dad48235f8fb..f016ef2c053b 100644
--- a/vcl/source/window/arrange.cxx
+++ b/vcl/source/window/arrange.cxx
@@ -29,15 +29,37 @@
#include "vcl/arrange.hxx"
#include "vcl/edit.hxx"
+#include "vcl/svdata.hxx"
+#include "vcl/svapp.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/awt/Rectangle.hpp"
#include "osl/diagnose.h"
using namespace vcl;
+using namespace com::sun::star;
// ----------------------------------------
// vcl::WindowArranger
//-----------------------------------------
+long WindowArranger::getDefaultBorder()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ long nResult = pSVData->maAppData.mnDefaultLayoutBorder;
+ if( nResult < 0 )
+ {
+ OutputDevice* pDefDev = Application::GetDefaultDevice();
+ if( pDefDev )
+ {
+ Size aBorder( pDefDev->LogicToPixel( Size( 3, 3 ), MapMode( MAP_APPFONT ) ) );
+ nResult = pSVData->maAppData.mnDefaultLayoutBorder = aBorder.Height();
+ }
+ }
+ return nResult > 0 ? nResult : 0;
+}
+
WindowArranger::~WindowArranger()
{}
@@ -156,16 +178,26 @@ Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const
Size aResult;
if( ! m_bHidden )
{
+ bool bVisible = false;
if( m_pElement && m_pElement->IsVisible() )
+ {
aResult = m_pElement->GetOptimalSize( i_eType );
- else if( m_pChild )
+ bVisible = true;
+ }
+ else if( m_pChild && m_pChild->isVisible() )
+ {
aResult = m_pChild->getOptimalSize( i_eType );
- if( aResult.Width() < m_aMinSize.Width() )
- aResult.Width() = m_aMinSize.Width();
- if( aResult.Height() < m_aMinSize.Height() )
- aResult.Height() = m_aMinSize.Height();
- aResult.Width() += m_nLeftBorder + m_nRightBorder;
- aResult.Height() += m_nTopBorder + m_nBottomBorder;
+ bVisible = true;
+ }
+ if( bVisible )
+ {
+ if( aResult.Width() < m_aMinSize.Width() )
+ aResult.Width() = m_aMinSize.Width();
+ if( aResult.Height() < m_aMinSize.Height() )
+ aResult.Height() = m_aMinSize.Height();
+ aResult.Width() += getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder );
+ aResult.Height() += getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder );
+ }
}
return aResult;
@@ -175,16 +207,74 @@ void WindowArranger::Element::setPosSize( const Point& i_rPos, const Size& i_rSi
{
Point aPoint( i_rPos );
Size aSize( i_rSize );
- aPoint.X() += m_nLeftBorder;
- aPoint.Y() += m_nTopBorder;
- aSize.Width() -= m_nLeftBorder + m_nRightBorder;
- aSize.Height() -= m_nTopBorder + m_nBottomBorder;
+ aPoint.X() += getBorderValue( m_nLeftBorder );
+ aPoint.Y() += getBorderValue( m_nTopBorder );
+ aSize.Width() -= getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder );
+ aSize.Height() -= getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder );
if( m_pElement )
m_pElement->SetPosSizePixel( aPoint, aSize );
else if( m_pChild )
m_pChild->setManagedArea( Rectangle( aPoint, aSize ) );
}
+uno::Sequence< beans::PropertyValue > WindowArranger::getProperties() const
+{
+ uno::Sequence< beans::PropertyValue > aRet( 3 );
+ aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OuterBorder" ) );
+ aRet[0].Value = uno::makeAny( sal_Int32( getBorderValue( m_nOuterBorder ) ) );
+ aRet[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ManagedArea" ) );
+ awt::Rectangle aArea( m_aManagedArea.getX(), m_aManagedArea.getY(), m_aManagedArea.getWidth(), m_aManagedArea.getHeight() );
+ aRet[1].Value = uno::makeAny( aArea );
+ aRet[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
+ aRet[2].Value = uno::makeAny( sal_Bool( isVisible() ) );
+ return aRet;
+}
+
+void WindowArranger::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps )
+{
+ const beans::PropertyValue* pProps = i_rProps.getConstArray();
+ bool bResize = false;
+ for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ )
+ {
+ if( pProps[i].Name.equalsAscii( "OuterBorder" ) )
+ {
+ sal_Int32 nVal = 0;
+ if( pProps[i].Value >>= nVal )
+ {
+ if( getBorderValue( m_nOuterBorder ) != nVal )
+ {
+ m_nOuterBorder = nVal;
+ bResize = true;
+ }
+ }
+ }
+ else if( pProps[i].Name.equalsAscii( "ManagedArea" ) )
+ {
+ awt::Rectangle aArea( 0, 0, 0, 0 );
+ if( pProps[i].Value >>= aArea )
+ {
+ m_aManagedArea.setX( aArea.X );
+ m_aManagedArea.setY( aArea.Y );
+ m_aManagedArea.setWidth( aArea.Width );
+ m_aManagedArea.setHeight( aArea.Height );
+ bResize = true;
+ }
+ }
+ else if( pProps[i].Name.equalsAscii( "Visible" ) )
+ {
+ sal_Bool bVal = sal_False;
+ if( pProps[i].Value >>= bVal )
+ {
+ show( bVal, false );
+ bResize = true;
+ }
+ }
+ }
+ if( bResize )
+ resize();
+}
+
+
// ----------------------------------------
// vcl::RowOrColumn
//-----------------------------------------
@@ -201,6 +291,7 @@ RowOrColumn::~RowOrColumn()
Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
{
Size aRet( 0, 0 );
+ long nDistance = getBorderValue( m_nBorderWidth );
for( std::vector< WindowArranger::Element >::const_iterator it = m_aElements.begin();
it != m_aElements.end(); ++it )
{
@@ -211,7 +302,7 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
if( m_bColumn )
{
// add the distance between elements
- aRet.Height() += m_nBorderWidth;
+ aRet.Height() += nDistance;
// check if the width needs adjustment
if( aRet.Width() < aElementSize.Width() )
aRet.Width() = aElementSize.Width();
@@ -220,7 +311,7 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
else
{
// add the distance between elements
- aRet.Width() += m_nBorderWidth;
+ aRet.Width() += nDistance;
// check if the height needs adjustment
if( aRet.Height() < aElementSize.Height() )
aRet.Height() = aElementSize.Height();
@@ -233,13 +324,14 @@ Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const
{
// subtract the border for the first element
if( m_bColumn )
- aRet.Height() -= m_nBorderWidth;
+ aRet.Height() -= nDistance;
else
- aRet.Width() -= m_nBorderWidth;
+ aRet.Width() -= nDistance;
// add the outer border
- aRet.Width() += 2*m_nOuterBorder;
- aRet.Height() += 2*m_nOuterBorder;
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ aRet.Width() += 2*nOuterBorder;
+ aRet.Height() += 2*nOuterBorder;
}
return aRet;
@@ -344,7 +436,9 @@ void RowOrColumn::resize()
size_t nElements = m_aElements.size();
// get all element sizes for sizing
std::vector<Size> aElementSizes( nElements );
- long nUsedWidth = 2*m_nOuterBorder - (nElements ? m_nBorderWidth : 0);
+ long nDistance = getBorderValue( m_nBorderWidth );
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ long nUsedWidth = 2*nOuterBorder - (nElements ? nDistance : 0);
for( size_t i = 0; i < nElements; i++ )
{
if( m_aElements[i].isVisible() )
@@ -352,13 +446,13 @@ void RowOrColumn::resize()
aElementSizes[i] = m_aElements[i].getOptimalSize( eType );
if( m_bColumn )
{
- aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2* m_nOuterBorder;
- nUsedWidth += aElementSizes[i].Height() + m_nBorderWidth;
+ aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2 * nOuterBorder;
+ nUsedWidth += aElementSizes[i].Height() + nDistance;
}
else
{
- aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2* m_nOuterBorder;
- nUsedWidth += aElementSizes[i].Width() + m_nBorderWidth;
+ aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2 * nOuterBorder;
+ nUsedWidth += aElementSizes[i].Width() + nDistance;
}
}
}
@@ -375,8 +469,8 @@ void RowOrColumn::resize()
// get starting position
Point aElementPos( m_aManagedArea.TopLeft() );
// outer border
- aElementPos.X() += m_nOuterBorder;
- aElementPos.Y() += m_nOuterBorder;
+ aElementPos.X() += nOuterBorder;
+ aElementPos.Y() += nOuterBorder;
// position managed windows
for( size_t i = 0; i < nElements; i++ )
@@ -386,27 +480,27 @@ void RowOrColumn::resize()
{
m_aElements[i].setPosSize( aElementPos, aElementSizes[i] );
if( m_bColumn )
- aElementPos.Y() += m_nBorderWidth + aElementSizes[i].Height();
+ aElementPos.Y() += nDistance + aElementSizes[i].Height();
else
- aElementPos.X() += m_nBorderWidth + aElementSizes[i].Width();
+ aElementPos.X() += nDistance + aElementSizes[i].Width();
}
}
}
-size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, size_t i_nIndex )
+size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, const Size& i_rMinSize, size_t i_nIndex )
{
size_t nIndex = i_nIndex;
if( i_nIndex >= m_aElements.size() )
{
nIndex = m_aElements.size();
- m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) );
}
else
{
std::vector< WindowArranger::Element >::iterator it = m_aElements.begin();
while( i_nIndex-- )
++it;
- m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) );
}
return nIndex;
}
@@ -479,14 +573,14 @@ Size LabeledElement::getOptimalSize( WindowSizeType i_eType ) const
if( m_nLabelColumnWidth != 0 )
aRet.Width() = m_nLabelColumnWidth;
else
- aRet.Width() += m_nDistance;
+ aRet.Width() += getBorderValue( m_nDistance );
}
Size aElementSize( m_aElement.getOptimalSize( i_eType ) );
aRet.Width() += aElementSize.Width();
if( aElementSize.Height() > aRet.Height() )
aRet.Height() = aElementSize.Height();
if( aRet.Height() != 0 )
- aRet.Height() += 2*m_nOuterBorder;
+ aRet.Height() += 2 * getBorderValue( m_nOuterBorder );
return aRet;
}
@@ -495,23 +589,25 @@ void LabeledElement::resize()
{
Size aLabelSize( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) );
Size aElementSize( m_aElement.getOptimalSize( WINDOWSIZE_PREFERRED ) );
- if( m_nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() )
+ long nDistance = getBorderValue( m_nDistance );
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ if( nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() )
aElementSize = m_aElement.getOptimalSize( WINDOWSIZE_MINIMUM );
// align label and element vertically in LabeledElement
- long nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aLabelSize.Height()) / 2;
+ long nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aLabelSize.Height()) / 2;
Point aPos( m_aManagedArea.Left(),
- m_aManagedArea.Top() + m_nOuterBorder + nYOff );
+ m_aManagedArea.Top() + nOuterBorder + nYOff );
Size aSize( aLabelSize );
if( m_nLabelColumnWidth != 0 )
aSize.Width() = m_nLabelColumnWidth;
m_aLabel.setPosSize( aPos, aSize );
- aPos.X() += aSize.Width() + m_nDistance;
- nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aElementSize.Height()) / 2;
- aPos.Y() = m_aManagedArea.Top() + m_nOuterBorder + nYOff;
+ aPos.X() += aSize.Width() + nDistance;
+ nYOff = (m_aManagedArea.GetHeight() - 2*nOuterBorder - aElementSize.Height()) / 2;
+ aPos.Y() = m_aManagedArea.Top() + nOuterBorder + nYOff;
aSize.Width() = aElementSize.Width();
- aSize.Height() = m_aManagedArea.GetHeight() - 2*m_nOuterBorder;
+ aSize.Height() = m_aManagedArea.GetHeight() - 2*nOuterBorder;
// label style
// 0: position left and right
@@ -578,18 +674,22 @@ long LabelColumn::getLabelWidth() const
if( pLW )
{
Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) );
+ long nLB = 0;
+ pLabel->getBorders(0, &nLB);
+ aLabSize.Width() += getBorderValue( nLB );
if( aLabSize.Width() > nWidth )
nWidth = aLabSize.Width();
}
}
}
}
- return nWidth + getBorderWidth();
+ return nWidth + getBorderValue( getBorderWidth() );
}
Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const
{
long nWidth = getLabelWidth();
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
Size aColumnSize;
// every child is a LabeledElement
@@ -622,19 +722,19 @@ Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const
}
if( aElementSize.Width() )
{
- aElementSize.Width() += 2*m_nOuterBorder;
+ aElementSize.Width() += 2*nOuterBorder;
if( aElementSize.Width() > aColumnSize.Width() )
aColumnSize.Width() = aElementSize.Width();
}
if( aElementSize.Height() )
{
- aColumnSize.Height() += getBorderWidth() + aElementSize.Height();
+ aColumnSize.Height() += getBorderValue( getBorderWidth() ) + aElementSize.Height();
}
}
if( nEle > 0 && aColumnSize.Height() )
{
- aColumnSize.Height() -= getBorderWidth(); // for the first element
- aColumnSize.Height() += 2*m_nOuterBorder;
+ aColumnSize.Height() -= getBorderValue( getBorderWidth() ); // for the first element
+ aColumnSize.Height() += 2*nOuterBorder;
}
return aColumnSize;
}
@@ -667,12 +767,13 @@ size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger>
return nIndex;
}
-size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent )
+size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent, const Size& i_rElementMinSize )
{
boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) );
xLabel->setLabel( i_pLabel );
xLabel->setBorders( 0, i_nIndent, 0, 0, 0 );
xLabel->setElement( i_pElement );
+ xLabel->setMinimumSize( 1, i_rElementMinSize );
size_t nIndex = addChild( xLabel );
resize();
return nIndex;
@@ -690,19 +791,23 @@ Indenter::~Indenter()
Size Indenter::getOptimalSize( WindowSizeType i_eType ) const
{
Size aSize( m_aElement.getOptimalSize( i_eType ) );
- aSize.Width() += 2*m_nOuterBorder + m_nIndent;
- aSize.Height() += 2*m_nOuterBorder;
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ long nIndent = getBorderValue( m_nIndent );
+ aSize.Width() += 2*nOuterBorder + nIndent;
+ aSize.Height() += 2*nOuterBorder;
return aSize;
}
void Indenter::resize()
{
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ long nIndent = getBorderValue( m_nIndent );
Point aPt( m_aManagedArea.TopLeft() );
- aPt.X() += m_nOuterBorder + m_nIndent;
- aPt.Y() += m_nOuterBorder;
+ aPt.X() += nOuterBorder + nIndent;
+ aPt.Y() += nOuterBorder;
Size aSz( m_aManagedArea.GetSize() );
- aSz.Width() -= 2*m_nOuterBorder + m_nIndent;
- aSz.Height() -= 2*m_nOuterBorder;
+ aSz.Width() -= 2*nOuterBorder + nIndent;
+ aSz.Height() -= 2*nOuterBorder;
m_aElement.setPosSize( aPt, aSz );
}
@@ -728,9 +833,13 @@ MatrixArranger::~MatrixArranger()
{
}
-Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const
+Size MatrixArranger::getOptimalSize( WindowSizeType i_eType,
+ std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights,
+ std::vector<sal_Int32>& o_rColumnPrio, std::vector<sal_Int32>& o_rRowPrio
+ ) const
{
- Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder );
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
+ Size aMatrixSize( 2*nOuterBorder, 2*nOuterBorder );
// first find out the current number of rows and columns
sal_uInt32 nRows = 0, nColumns = 0;
@@ -746,6 +855,8 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>&
// now allocate row and column depth vectors
o_rColumnWidths = std::vector< long >( nColumns, 0 );
o_rRowHeights = std::vector< long >( nRows, 0 );
+ o_rColumnPrio = std::vector< sal_Int32 >( nColumns, 0 );
+ o_rRowPrio = std::vector< sal_Int32 >( nRows, 0 );
// get sizes an allocate them into rows/columns
for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin();
@@ -756,18 +867,24 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>&
o_rColumnWidths[ it->m_nX ] = aSize.Width();
if( aSize.Height() > o_rRowHeights[ it->m_nY ] )
o_rRowHeights[ it->m_nY ] = aSize.Height();
+ if( it->m_nExpandPriority > o_rColumnPrio[ it->m_nX ] )
+ o_rColumnPrio[ it->m_nX ] = it->m_nExpandPriority;
+ if( it->m_nExpandPriority > o_rRowPrio[ it->m_nY ] )
+ o_rRowPrio[ it->m_nY ] = it->m_nExpandPriority;
}
// add up sizes
+ long nDistanceX = getBorderValue( m_nBorderX );
+ long nDistanceY = getBorderValue( m_nBorderY );
for( sal_uInt32 i = 0; i < nColumns; i++ )
- aMatrixSize.Width() += o_rColumnWidths[i] + m_nBorderX;
+ aMatrixSize.Width() += o_rColumnWidths[i] + nDistanceX;
if( nColumns > 0 )
- aMatrixSize.Width() -= m_nBorderX;
+ aMatrixSize.Width() -= nDistanceX;
for( sal_uInt32 i = 0; i < nRows; i++ )
- aMatrixSize.Height() += o_rRowHeights[i] + m_nBorderY;
+ aMatrixSize.Height() += o_rRowHeights[i] + nDistanceY;
if( nRows > 0 )
- aMatrixSize.Height() -= m_nBorderY;
+ aMatrixSize.Height() -= nDistanceY;
return aMatrixSize;
}
@@ -775,9 +892,48 @@ Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>&
Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const
{
std::vector<long> aColumnWidths, aRowHeights;
- return getOptimalSize( i_eType, aColumnWidths, aRowHeights );
+ std::vector<sal_Int32> aColumnPrio, aRowPrio;
+ return getOptimalSize( i_eType, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio );
}
+void MatrixArranger::distributeExtraSize( std::vector<long>& io_rSizes, const std::vector<sal_Int32>& i_rPrios, long i_nExtraWidth )
+{
+ if( ! io_rSizes.empty() && io_rSizes.size() == i_rPrios.size() ) // sanity check
+ {
+ // find all elements with the highest expand priority
+ size_t nElements = io_rSizes.size();
+ std::vector< size_t > aIndices;
+ sal_Int32 nHighPrio = 0;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ sal_Int32 nCurPrio = i_rPrios[ i ];
+ if( nCurPrio > nHighPrio )
+ {
+ aIndices.clear();
+ nHighPrio = nCurPrio;
+ }
+ if( nCurPrio == nHighPrio )
+ aIndices.push_back( i );
+ }
+
+ // distribute extra space evenly among collected elements
+ nElements = aIndices.size();
+ if( nElements > 0 )
+ {
+ long nDelta = i_nExtraWidth / nElements;
+ for( size_t i = 0; i < nElements; i++ )
+ {
+ io_rSizes[ aIndices[i] ] += nDelta;
+ i_nExtraWidth -= nDelta;
+ }
+ // add the last pixels to the last row element
+ if( i_nExtraWidth > 0 && nElements > 0 )
+ io_rSizes[aIndices.back()] += i_nExtraWidth;
+ }
+ }
+}
+
+
void MatrixArranger::resize()
{
// assure that we have at least one row and column
@@ -786,30 +942,44 @@ void MatrixArranger::resize()
// check if we can get optimal size, else fallback to minimal size
std::vector<long> aColumnWidths, aRowHeights;
- Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) );
+ std::vector<sal_Int32> aColumnPrio, aRowPrio;
+ Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights, aColumnPrio, aRowPrio ) );
if( aOptSize.Height() > m_aManagedArea.GetHeight() ||
aOptSize.Width() > m_aManagedArea.GetWidth() )
{
std::vector<long> aMinColumnWidths, aMinRowHeights;
- getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights );
+ getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights, aColumnPrio, aRowPrio );
if( aOptSize.Height() > m_aManagedArea.GetHeight() )
aRowHeights = aMinRowHeights;
if( aOptSize.Width() > m_aManagedArea.GetWidth() )
aColumnWidths = aMinColumnWidths;
}
- // FIXME: distribute extra space available
+ // distribute extra space available
+ long nExtraSize = m_aManagedArea.GetWidth();
+ for( size_t i = 0; i < aColumnWidths.size(); ++i )
+ nExtraSize -= aColumnWidths[i] + m_nBorderX;
+ if( nExtraSize > 0 )
+ distributeExtraSize( aColumnWidths, aColumnPrio, nExtraSize );
+ nExtraSize = m_aManagedArea.GetHeight();
+ for( size_t i = 0; i < aRowHeights.size(); ++i )
+ nExtraSize -= aRowHeights[i] + m_nBorderY;
+ if( nExtraSize > 0 )
+ distributeExtraSize( aRowHeights, aRowPrio, nExtraSize );
// prepare offsets
+ long nDistanceX = getBorderValue( m_nBorderX );
+ long nDistanceY = getBorderValue( m_nBorderY );
+ long nOuterBorder = getBorderValue( m_nOuterBorder );
std::vector<long> aColumnX( aColumnWidths.size() );
- aColumnX[0] = m_aManagedArea.Left() + m_nOuterBorder;
+ aColumnX[0] = m_aManagedArea.Left() + nOuterBorder;
for( size_t i = 1; i < aColumnX.size(); i++ )
- aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + m_nBorderX;
+ aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + nDistanceX;
std::vector<long> aRowY( aRowHeights.size() );
- aRowY[0] = m_aManagedArea.Top() + m_nOuterBorder;
+ aRowY[0] = m_aManagedArea.Top() + nOuterBorder;
for( size_t i = 1; i < aRowY.size(); i++ )
- aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + m_nBorderY;
+ aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + nDistanceY;
// now iterate over the elements and assign their positions
for( std::vector< MatrixElement >::iterator it = m_aElements.begin();
@@ -821,7 +991,7 @@ void MatrixArranger::resize()
}
}
-size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio )
+size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio, const Size& i_rMinSize )
{
sal_uInt64 nMapValue = getMap( i_nX, i_nY );
std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue );
@@ -829,7 +999,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32
if( it == m_aMatrixMap.end() )
{
m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size();
- m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) );
+ m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio, i_rMinSize ) );
}
else
{
@@ -837,6 +1007,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32
rEle.m_pElement = i_pWindow;
rEle.m_pChild.reset();
rEle.m_nExpandPriority = i_nExpandPrio;
+ rEle.m_aMinSize = i_rMinSize;
rEle.m_nX = i_nX;
rEle.m_nY = i_nY;
nIndex = it->second;
diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx
index e835fe749ed1..9a0452027737 100644
--- a/vcl/source/window/btndlg.cxx
+++ b/vcl/source/window/btndlg.cxx
@@ -530,22 +530,19 @@ XubString ButtonDialog::GetButtonHelpText( USHORT nId ) const
// -----------------------------------------------------------------------
-void ButtonDialog::SetButtonHelpId( USHORT nId, ULONG nHelpId )
+void ButtonDialog::SetButtonHelpId( USHORT nId, const rtl::OString& rHelpId )
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
if ( pItem )
- pItem->mpPushButton->SetHelpId( nHelpId );
+ pItem->mpPushButton->SetHelpId( rHelpId );
}
// -----------------------------------------------------------------------
-ULONG ButtonDialog::GetButtonHelpId( USHORT nId ) const
+rtl::OString ButtonDialog::GetButtonHelpId( USHORT nId ) const
{
ImplBtnDlgItem* pItem = ImplGetItem( nId );
- if ( pItem )
- return pItem->mpPushButton->GetHelpId();
- else
- return 0;
+ return pItem ? rtl::OString( pItem->mpPushButton->GetHelpId() ) : rtl::OString();
}
diff --git a/vcl/source/window/javachild.cxx b/vcl/source/window/javachild.cxx
index 2cd18b897ff5..aa198c85c138 100644
--- a/vcl/source/window/javachild.cxx
+++ b/vcl/source/window/javachild.cxx
@@ -2,10 +2,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: javachild.cxx,v $
+ * $Revision: 1.12 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -28,32 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-
-#ifdef SOLAR_JAVA
-#include <jni.h>
-#endif
-#include <comphelper/processfactory.hxx>
-
-#include <vcl/unohelp.hxx>
-#include <rtl/process.h>
-#include <rtl/ref.hxx>
-#include <jvmaccess/virtualmachine.hxx>
-#include <com/sun/star/java/XJavaVM.hpp>
-#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#ifndef _SV_SVSYS_HXX
-#include <svsys.h>
-#endif
-#include <vcl/salinst.hxx>
-#include <vcl/salframe.hxx>
-#include <vcl/window.hxx>
-#include <vcl/salobj.hxx>
#include <vcl/javachild.hxx>
-#include <vcl/svdata.hxx>
-#include <vcl/sysdata.hxx>
-
-using namespace ::com::sun::star;
// -------------------
// - JavaChildWindow -
@@ -79,129 +57,7 @@ JavaChildWindow::~JavaChildWindow()
// -----------------------------------------------------------------------
-void JavaChildWindow::implTestJavaException( void* pEnv )
-{
-#ifdef SOLAR_JAVA
- JNIEnv* pJavaEnv = reinterpret_cast< JNIEnv* >( pEnv );
- jthrowable jtThrowable = pJavaEnv->ExceptionOccurred();
-
- if( jtThrowable )
- { // is it a java exception ?
-#if OSL_DEBUG_LEVEL > 1
- pJavaEnv->ExceptionDescribe();
-#endif // OSL_DEBUG_LEVEL > 1
- pJavaEnv->ExceptionClear();
-
- jclass jcThrowable = pJavaEnv->FindClass("java/lang/Throwable");
- jmethodID jmThrowable_getMessage = pJavaEnv->GetMethodID(jcThrowable, "getMessage", "()Ljava/lang/String;");
- jstring jsMessage = (jstring) pJavaEnv->CallObjectMethod(jtThrowable, jmThrowable_getMessage);
- ::rtl::OUString ouMessage;
-
- if(jsMessage)
- {
- const jchar * jcMessage = pJavaEnv->GetStringChars(jsMessage, NULL);
- ouMessage = ::rtl::OUString(jcMessage);
- pJavaEnv->ReleaseStringChars(jsMessage, jcMessage);
- }
-
- throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>());
- }
-#endif // SOLAR_JAVA
-}
-
-// -----------------------------------------------------------------------
-
sal_IntPtr JavaChildWindow::getParentWindowHandleForJava()
{
- sal_IntPtr nRet = 0;
-
-#if defined WNT
- nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd );
-#elif defined QUARTZ
- // FIXME: this is wrong
- nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
-#elif defined UNX
-#ifdef SOLAR_JAVA
- uno::Reference< lang::XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
-
- if( xFactory.is() && ( GetSystemData()->aWindow > 0 ) )
- {
- try
- {
- ::rtl::Reference< ::jvmaccess::VirtualMachine > xVM;
- uno::Reference< java::XJavaVM > xJavaVM( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), uno::UNO_QUERY );
- uno::Sequence< sal_Int8 > aProcessID( 17 );
-
- rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() );
- aProcessID[ 16 ] = 0;
- OSL_ENSURE(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64");
- sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( static_cast< jvmaccess::VirtualMachine * >(0));
- xJavaVM->getJavaVM(aProcessID) >>= nPointer;
- xVM = reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer);
-
- if( xVM.is() )
- {
- try
- {
- ::jvmaccess::VirtualMachine::AttachGuard aVMAttachGuard( xVM );
- JNIEnv* pEnv = aVMAttachGuard.getEnvironment();
-
- jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit");
- implTestJavaException(pEnv);
-
- jmethodID jmToolkit_getDefaultToolkit = pEnv->GetStaticMethodID( jcToolkit, "getDefaultToolkit", "()Ljava/awt/Toolkit;" );
- implTestJavaException(pEnv);
-
- pEnv->CallStaticObjectMethod(jcToolkit, jmToolkit_getDefaultToolkit);
- implTestJavaException(pEnv);
-
- jclass jcMotifAppletViewer = pEnv->FindClass("sun/plugin/navig/motif/MotifAppletViewer");
- if( pEnv->ExceptionOccurred() )
- {
- pEnv->ExceptionClear();
-
- jcMotifAppletViewer = pEnv->FindClass( "sun/plugin/viewer/MNetscapePluginContext");
- implTestJavaException(pEnv);
- }
-
- jclass jcClassLoader = pEnv->FindClass("java/lang/ClassLoader");
- implTestJavaException(pEnv);
-
- jmethodID jmClassLoader_loadLibrary = pEnv->GetStaticMethodID( jcClassLoader, "loadLibrary", "(Ljava/lang/Class;Ljava/lang/String;Z)V");
- implTestJavaException(pEnv);
-
- jstring jsplugin = pEnv->NewStringUTF("javaplugin_jni");
- implTestJavaException(pEnv);
-
- pEnv->CallStaticVoidMethod(jcClassLoader, jmClassLoader_loadLibrary, jcMotifAppletViewer, jsplugin, JNI_FALSE);
- implTestJavaException(pEnv);
-
- jmethodID jmMotifAppletViewer_getWidget = pEnv->GetStaticMethodID( jcMotifAppletViewer, "getWidget", "(IIIII)I" );
- implTestJavaException(pEnv);
-
- const Size aSize( GetOutputSizePixel() );
- jint ji_widget = pEnv->CallStaticIntMethod( jcMotifAppletViewer, jmMotifAppletViewer_getWidget,
- GetSystemData()->aWindow, 0, 0, aSize.Width(), aSize.Height() );
- implTestJavaException(pEnv);
-
- nRet = static_cast< sal_IntPtr >( ji_widget );
- }
- catch( uno::RuntimeException& )
- {
- }
-
- if( !nRet )
- nRet = static_cast< sal_IntPtr >( GetSystemData()->aWindow );
- }
- }
- catch( ... )
- {
- }
- }
-#endif // SOLAR_JAVA
-#else // WNT || QUARTZ || UNX
- // TBD
-#endif
-
- return nRet;
+ return SystemChildWindow::GetParentWindowHandle( sal_True );
}
diff --git a/vcl/source/window/makefile.mk b/vcl/source/window/makefile.mk
index 82ce26f8e78e..1c63376dfda5 100644
--- a/vcl/source/window/makefile.mk
+++ b/vcl/source/window/makefile.mk
@@ -85,6 +85,8 @@ SLOFILES= \
$(SLO)$/winproc.obj \
$(SLO)$/window2.obj \
$(SLO)$/window3.obj \
+ $(SLO)$/window4.obj \
+ $(SLO)$/wpropset.obj \
$(SLO)$/wrkwin.obj
# --- Targets ------------------------------------------------------
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 81676eba3be4..52ad54957dd0 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -157,7 +157,7 @@ struct MenuItemData
XubString aTipHelpText; // TipHelp-String (eg, expanded filenames)
XubString aCommandStr; // CommandString
XubString aHelpCommandStr; // Help command string (to reference external help)
- ULONG nHelpId; // Help-Id
+ rtl::OString aHelpId; // Help-Id
ULONG nUserValue; // User value
Image aImage; // Image
KeyCode aAccelKey; // Accelerator-Key
@@ -252,7 +252,6 @@ MenuItemData* MenuItemList::Insert( USHORT nId, MenuItemType eType,
pData->nBits = nBits;
pData->pSubMenu = NULL;
pData->pAutoSubMenu = NULL;
- pData->nHelpId = 0;
pData->nUserValue = 0;
pData->bChecked = FALSE;
pData->bEnabled = TRUE;
@@ -284,7 +283,6 @@ void MenuItemList::InsertSeparator( USHORT nPos )
pData->nBits = 0;
pData->pSubMenu = NULL;
pData->pAutoSubMenu = NULL;
- pData->nHelpId = 0;
pData->nUserValue = 0;
pData->bChecked = FALSE;
pData->bEnabled = TRUE;
@@ -844,14 +842,14 @@ static BOOL ImplHandleHelpEvent( Window* pMenuWindow, Menu* pMenu, USHORT nHighl
// Ist eine ID vorhanden, dann Hilfe mit der ID aufrufen, sonst
// den Hilfe-Index
String aCommand = pMenu->GetItemCommand( nId );
- ULONG nHelpId = pMenu->GetHelpId( nId );
+ rtl::OString aHelpId( pMenu->GetHelpId( nId ) );
+ if( ! aHelpId.getLength() )
+ aHelpId = OOO_HELP_INDEX;
if ( aCommand.Len() )
pHelp->Start( aCommand, NULL );
- else if ( nHelpId )
- pHelp->Start( nHelpId, NULL );
else
- pHelp->Start( OOO_HELP_INDEX, NULL );
+ pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
}
bDone = TRUE;
}
@@ -980,7 +978,7 @@ void Menu::ImplInit()
mpLayoutData = NULL;
mpFirstDel = NULL; // Dtor notification list
// Native-support: returns NULL if not supported
- mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar );
+ mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu( bIsMenuBar, this );
}
Menu* Menu::ImplGetStartedFrom() const
@@ -1330,15 +1328,14 @@ void Menu::InsertItem( const ResId& rResId, USHORT nPos )
SetHelpText( nItemId, aHelpText );
}
- ULONG nHelpId = 0;
if ( nObjMask & RSC_MENUITEM_HELPID )
{
- nHelpId = ReadLongRes();
+ rtl::OString aHelpId( ReadByteStringRes() );
if ( !bSep )
- SetHelpId( nItemId, nHelpId );
+ SetHelpId( nItemId, aHelpId );
}
- if( !bSep /* && SvHelpSettings::HelpText( aHelpText, nHelpId ) */ )
+ if( !bSep )
SetHelpText( nItemId, aHelpText );
if ( nObjMask & RSC_MENUITEM_KEYCODE )
@@ -1463,7 +1460,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, USHORT nPos, USHORT nNewPos,
pThis->CheckItem( nId, TRUE );
if ( !rMenu.IsItemEnabled( nId ) )
pThis->EnableItem( nId, FALSE );
- pThis->SetHelpId( nId, pData->nHelpId );
+ pThis->SetHelpId( nId, pData->aHelpId );
pThis->SetHelpText( nId, pData->aHelpText );
pThis->SetAccelKey( nId, pData->aAccelKey );
pThis->SetItemCommand( nId, pData->aCommandStr );
@@ -2039,7 +2036,7 @@ const XubString& Menu::ImplGetHelpText( USHORT nItemId ) const
if ( pData )
{
if ( !pData->aHelpText.Len() &&
- (( pData->nHelpId ) || ( pData->aCommandStr.Len() )))
+ (( pData->aHelpId.getLength() ) || ( pData->aCommandStr.Len() )))
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
@@ -2047,8 +2044,8 @@ const XubString& Menu::ImplGetHelpText( USHORT nItemId ) const
if ( pData->aCommandStr.Len() )
pData->aHelpText = pHelp->GetHelpText( pData->aCommandStr, NULL );
- if( !pData->aHelpText.Len() && pData->nHelpId )
- pData->aHelpText = pHelp->GetHelpText( pData->nHelpId, NULL );
+ if( !pData->aHelpText.Len() && pData->aHelpId.getLength() )
+ pData->aHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pData->aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
}
}
@@ -2081,22 +2078,29 @@ const XubString& Menu::GetTipHelpText( USHORT nItemId ) const
return ImplGetSVEmptyStr();
}
-void Menu::SetHelpId( USHORT nItemId, ULONG nHelpId )
+void Menu::SetHelpId( USHORT nItemId, const rtl::OString& rHelpId )
{
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
- pData->nHelpId = nHelpId;
+ pData->aHelpId = rHelpId;
}
-ULONG Menu::GetHelpId( USHORT nItemId ) const
+rtl::OString Menu::GetHelpId( USHORT nItemId ) const
{
+ rtl::OString aRet;
+
MenuItemData* pData = pItemList->GetData( nItemId );
if ( pData )
- return pData->nHelpId;
- else
- return 0;
+ {
+ if ( pData->aHelpId.getLength() )
+ aRet = pData->aHelpId;
+ else
+ aRet = ::rtl::OUStringToOString( pData->aCommandStr, RTL_TEXTENCODING_UTF8 );
+ }
+
+ return aRet;
}
Menu& Menu::operator=( const Menu& rMenu )
@@ -2480,6 +2484,16 @@ Size Menu::ImplCalcSize( Window* pWin )
if ( !bIsMenuBar )
{
+ // popup menus should not be wider than half the screen
+ // except on rather small screens
+ // TODO: move GetScreenNumber from SystemWindow to Window ?
+ // currently we rely on internal privileges
+ unsigned int nScreenNumber = pWin->ImplGetWindowImpl()->mpFrame->maGeometry.nScreenNumber;
+ Rectangle aDispRect( Application::GetScreenPosSizePixel( nScreenNumber ) );
+ long nScreenWidth = aDispRect.GetWidth() >= 800 ? aDispRect.GetWidth() : 800;
+ if( nMaxWidth > nScreenWidth/2 )
+ nMaxWidth = nScreenWidth/2;
+
USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
nCheckPos = (USHORT)nExtra;
if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
@@ -2573,6 +2587,26 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec
}
}
+static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_nMaxWidth )
+{
+ xub_StrLen nPos = STRING_NOTFOUND;
+ String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) );
+ aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS );
+ // re-insert mnemonic
+ if( nPos != STRING_NOTFOUND )
+ {
+ if( nPos < aNonMnem.Len() && i_rLong.GetChar(nPos+1) == aNonMnem.GetChar(nPos) )
+ {
+ rtl::OUStringBuffer aBuf( i_rLong.Len() );
+ aBuf.append( aNonMnem.GetBuffer(), nPos );
+ aBuf.append( sal_Unicode('~') );
+ aBuf.append( aNonMnem.GetBuffer()+nPos );
+ aNonMnem = aBuf.makeStringAndClear();
+ }
+ }
+ return aNonMnem;
+}
+
void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* pThisItemOnly, BOOL bHighlighted, bool bLayout ) const
{
// Fuer Symbole: nFontHeight x nFontHeight
@@ -2763,7 +2797,19 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData*
pWin->GetSettings().GetStyleSettings().GetMenuColor();
pWin->SetBackground( Wallpaper( aBg ) );
}
- pWin->DrawCtrlText( aTmpPos, pData->aText, 0, pData->aText.Len(), nStyle, pVector, pDisplayText );
+ // how much space is there for the text ?
+ long nMaxItemTextWidth = aOutSz.Width() - aTmpPos.X() - nExtra - nOuterSpace;
+ if( !bIsMenuBar && pData->aAccelKey.GetCode() && !ImplAccelDisabled() )
+ {
+ XubString aAccText = pData->aAccelKey.GetName();
+ nMaxItemTextWidth -= pWin->GetTextWidth( aAccText ) + 3*nExtra;
+ }
+ if( !bIsMenuBar && pData->pSubMenu )
+ {
+ nMaxItemTextWidth -= nFontHeight - nExtra;
+ }
+ String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) );
+ pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText );
if( bSetTmpBackground )
pWin->SetBackground();
}
@@ -3722,7 +3768,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM
if ( GetItemCount() )
{
SalMenu* pMenu = ImplGetSalMenu();
- if( pMenu && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) )
+ if( pMenu && bRealExecute && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) )
{
pWin->StopExecute(0);
pWin->doShutdown();
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index 7f7a65cd7fb9..d00d569883d5 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -196,10 +196,9 @@ MessBox::MessBox( Window* pParent, const ResId& rResId ) :
USHORT nLoButtons = ReadShortRes();
USHORT nHiDefButton = ReadShortRes();
USHORT nLoDefButton = ReadShortRes();
- USHORT nHiHelpId = ReadShortRes();
- USHORT nLoHelpId = ReadShortRes();
+ rtl::OString aHelpId( ReadByteStringRes() );
/* USHORT bSysModal = */ ReadShortRes();
- SetHelpId( ((ULONG)nHiHelpId << 16) + nLoHelpId );
+ SetHelpId( aHelpId );
WinBits nBits = (((ULONG)nHiButtons << 16) + nLoButtons) |
(((ULONG)nHiDefButton << 16) + nLoDefButton);
ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
@@ -233,7 +232,7 @@ MessBox::~MessBox()
void MessBox::ImplPosControls()
{
- if ( GetHelpId() )
+ if ( GetHelpId().getLength() )
{
if ( !mbHelpBtn )
{
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index d0fae33acf3b..73420e6ef8b5 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -46,7 +46,7 @@
#include "unotools/localedatawrapper.hxx"
-#include "rtl/ustrbuf.hxx"
+#include "rtl/strbuf.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
@@ -61,14 +61,16 @@ using namespace com::sun::star::container;
using namespace com::sun::star::beans;
#define HELPID_PREFIX ".HelpId:vcl:PrintDialog"
-#define SMHID2( a, b ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ":" b ) ), HID_PRINTDLG ) )
-#define SMHID1( a ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ) ), HID_PRINTDLG ) )
+#define SMHID2( a, b ) SetHelpId( rtl::OString( HELPID_PREFIX ":" a ":" b ) )
+#define SMHID1( a ) SetHelpId( rtl::OString( HELPID_PREFIX ":" a ) )
PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const ResId& i_rId )
: Window( i_pParent, i_rId )
, maOrigSize( 10, 10 )
, maPageVDev( *this )
, maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) )
+ , maHorzDim( this, WB_HORZ | WB_CENTER )
+ , maVertDim( this, WB_VERT | WB_VCENTER )
{
SetPaintTransparent( TRUE );
SetBackground();
@@ -76,6 +78,11 @@ PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const Re
maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() );
else
maPageVDev.SetBackground( Color( COL_WHITE ) );
+ maHorzDim.Show();
+ maVertDim.Show();
+
+ maHorzDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) );
+ maVertDim.SetText( String( RTL_CONSTASCII_USTRINGPARAM( "2.0in" ) ) );
}
PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
@@ -162,9 +169,10 @@ void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDC
void PrintDialog::PrintPreviewWindow::Resize()
{
Size aNewSize( GetSizePixel() );
+ long nTextHeight = maHorzDim.GetTextHeight();
// leave small space for decoration
- aNewSize.Width() -= 2;
- aNewSize.Height() -= 2;
+ aNewSize.Width() -= nTextHeight + 2;
+ aNewSize.Height() -= nTextHeight + 2;
Size aScaledSize;
double fScale = 1.0;
@@ -206,16 +214,28 @@ void PrintDialog::PrintPreviewWindow::Resize()
}
maPageVDev.SetOutputSizePixel( aScaledSize, FALSE );
+
+ // position dimension lines
+ Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2,
+ nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 );
+ maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
+ Size( maPreviewSize.Width(), nTextHeight ) );
+ maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
+ Size( nTextHeight, maPreviewSize.Height() ) );
+
}
void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
{
+ long nTextHeight = maHorzDim.GetTextHeight();
Size aSize( GetSizePixel() );
+ aSize.Width() -= nTextHeight;
+ aSize.Height() -= nTextHeight;
if( maReplacementString.getLength() != 0 )
{
// replacement is active
Push();
- Rectangle aTextRect( Point( 0, 0 ), aSize );
+ Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize );
DecorationView aVw( this );
aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP );
aTextRect.Left() += 2;
@@ -233,8 +253,8 @@ void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
{
GDIMetaFile aMtf( maMtf );
- Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2,
- (aSize.Height() - maPreviewSize.Height()) / 2 );
+ Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + nTextHeight,
+ (aSize.Height() - maPreviewSize.Height()) / 2 + nTextHeight );
Size aVDevSize( maPageVDev.GetOutputSizePixel() );
const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) );
@@ -294,13 +314,6 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
{
rtl::OUStringBuffer aBuf( 256 );
aBuf.append( maToolTipString );
- #if OSL_DEBUG_LEVEL > 0
- aBuf.appendAscii( "\n---\nPageSize: " );
- aBuf.append( sal_Int32( i_rOrigSize.Width()/100) );
- aBuf.appendAscii( "mm x " );
- aBuf.append( sal_Int32( i_rOrigSize.Height()/100) );
- aBuf.appendAscii( "mm" );
- #endif
SetQuickHelpText( aBuf.makeStringAndClear() );
maMtf = i_rNewPreview;
if( useHCColorReplacement() )
@@ -312,6 +325,27 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi
maReplacementString = i_rReplacement;
maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY );
maPageVDev.EnableOutput( TRUE );
+
+ // use correct measurements
+ const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() );
+ MapUnit eUnit = MAP_MM;
+ int nDigits = 0;
+ if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
+ {
+ eUnit = MAP_100TH_INCH;
+ nDigits = 2;
+ }
+ Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) );
+ String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) );
+ aBuf.append( aNumText );
+ aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
+ maHorzDim.SetText( aBuf.makeStringAndClear() );
+
+ aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
+ aBuf.append( aNumText );
+ aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
+ maVertDim.SetText( aBuf.makeStringAndClear() );
+
Resize();
Invalidate();
}
@@ -364,12 +398,18 @@ void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect )
int nX = 0, nY = 0;
switch( mnOrderMode )
{
- case SV_PRINT_PRT_NUP_ORDER_LRTD:
+ case SV_PRINT_PRT_NUP_ORDER_LRTB:
nX = (i % mnColumns); nY = (i / mnColumns);
break;
- case SV_PRINT_PRT_NUP_ORDER_TDLR:
+ case SV_PRINT_PRT_NUP_ORDER_TBLR:
nX = (i / mnRows); nY = (i % mnRows);
break;
+ case SV_PRINT_PRT_NUP_ORDER_RLTB:
+ nX = mnColumns - 1 - (i % mnColumns); nY = (i / mnColumns);
+ break;
+ case SV_PRINT_PRT_NUP_ORDER_TBRL:
+ nX = mnColumns - 1 - (i / mnRows); nY = (i % mnRows);
+ break;
}
Size aTextSize( GetTextWidth( aPageText ), nTextHeight );
int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2;
@@ -493,22 +533,21 @@ void PrintDialog::NUpTabPage::showAdvancedControls( bool i_bShow )
maSheetMarginTxt2.Show( i_bShow );
maNupOrientationTxt.Show( i_bShow );
maNupOrientationBox.Show( i_bShow );
- maLayout.resize();
+ getLayout()->resize();
}
void PrintDialog::NUpTabPage::setupLayout()
{
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
Size aBorder( LogicToPixel( Size( 6, 6 ), MapMode( MAP_APPFONT ) ) );
/* According to OOo style guide, the horizontal indentation of child
elements to their parent element should always be 6 map units. */
long nIndent = aBorder.Width();
- maLayout.setParentWindow( this );
- maLayout.setOuterBorder( aBorder.Width() );
-
- maLayout.addWindow( &maNupLine );
- boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &maLayout, false ) );
- maLayout.addChild( xRow );
+ xLayout->addWindow( &maNupLine );
+ boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( xLayout.get(), false ) );
+ xLayout->addChild( xRow );
boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xRow.get() ) );
xRow->addChild( xIndent );
@@ -544,7 +583,7 @@ void PrintDialog::NUpTabPage::setupLayout()
xMainCol->addRow( &maNupOrderTxt, &maNupOrderBox, nIndent );
xMainCol->setBorders( xMainCol->addWindow( &maBorderCB ), nIndent, 0, 0, 0 );
- xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, aBorder.Width() ) ) );
+ xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, WindowArranger::getDefaultBorder() ) ) );
xMainCol->addChild( xSpacer );
xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) );
@@ -556,11 +595,6 @@ void PrintDialog::NUpTabPage::setupLayout()
showAdvancedControls( false );
}
-void PrintDialog::NUpTabPage::Resize()
-{
- maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
-}
-
void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS )
{
maSheetMarginEdt.SetValue( maSheetMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM );
@@ -601,7 +635,6 @@ PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId )
, maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) )
, maNoCollateHCImg( VclResId( SV_PRINT_NOCOLLATE_HC_IMG ) )
, mnCollateUIMode( 0 )
- , maLayout( NULL, true )
{
FreeResource();
@@ -641,39 +674,37 @@ void PrintDialog::JobTabPage::setupLayout()
// sets the results of GetOptimalSize in a normal ListBox
maPrinters.SetDropDownLineCount( 4 );
- Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
-
- maLayout.setParentWindow( this );
- maLayout.setOuterBorder( aBorder.Width() );
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
// add printer fixed line
- maLayout.addWindow( &maPrinterFL );
+ xLayout->addWindow( &maPrinterFL );
// add print LB
- maLayout.addWindow( &maPrinters, 3 );
+ xLayout->addWindow( &maPrinters, 3 );
// create a row for details button/text and properties button
- boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) );
- maLayout.addChild( xDetRow );
+ boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( xLayout.get(), false ) );
+ xLayout->addChild( xDetRow );
xDetRow->addWindow( &maDetailsBtn );
xDetRow->addChild( new vcl::Spacer( xDetRow.get(), 2 ) );
xDetRow->addWindow( &maSetupButton );
// create an indent for details
- boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( &maLayout ) );
- maLayout.addChild( xIndent );
+ boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xLayout.get() ) );
+ xLayout->addChild( xIndent );
// remember details controls
mxDetails = xIndent;
// create a column for the details
- boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get(), aBorder.Height() ) );
+ boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get() ) );
xIndent->setChild( xLabelCol );
xLabelCol->addRow( &maStatusLabel, &maStatusTxt );
xLabelCol->addRow( &maLocationLabel, &maLocationTxt );
xLabelCol->addRow( &maCommentLabel, &maCommentTxt );
// add print range and copies columns
- maLayout.addWindow( &maCopies );
- boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( &maLayout, false, aBorder.Width() ) );
- maLayout.addChild( xRangeRow );
+ xLayout->addWindow( &maCopies );
+ boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( xLayout.get(), false ) );
+ xLayout->addChild( xRangeRow );
// create print range and add to range row
mxPrintRange.reset( new vcl::RowOrColumn( xRangeRow.get() ) );
@@ -740,11 +771,6 @@ void PrintDialog::JobTabPage::storeToSettings()
rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) );
}
-void PrintDialog::JobTabPage::Resize()
-{
- maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
-}
-
PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId )
: TabPage( i_pParent, i_rResId )
, maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) )
@@ -768,15 +794,13 @@ PrintDialog::OutputOptPage::~OutputOptPage()
void PrintDialog::OutputOptPage::setupLayout()
{
- Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
- maLayout.setParentWindow( this );
- maLayout.setOuterBorder( aBorder.Width() );
-
- maLayout.addWindow( &maOptionsLine );
- boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( &maLayout, aBorder.Width() ) );
- maLayout.addChild( xIndent );
- boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get(), aBorder.Height() ) );
+ xLayout->addWindow( &maOptionsLine );
+ boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( xLayout.get(), -1 ) );
+ xLayout->addChild( xIndent );
+ boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get() ) );
xIndent->setChild( xCol );
mxOptGroup = xCol;
xCol->addWindow( &maToFileBox );
@@ -804,12 +828,6 @@ void PrintDialog::OutputOptPage::storeToSettings()
rtl::OUString::createFromAscii( maToFileBox.IsChecked() ? "true" : "false" ) );
}
-void PrintDialog::OutputOptPage::Resize()
-{
- maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
-}
-
-
PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController )
: ModalDialog( i_pParent, VclResId( SV_DLG_PRINT ) )
, maOKButton( this, VclResId( SV_PRINT_OK ) )
@@ -1017,13 +1035,14 @@ PrintDialog::~PrintDialog()
void PrintDialog::setupLayout()
{
- Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
+ boost::shared_ptr<vcl::RowOrColumn> xLayout =
+ boost::dynamic_pointer_cast<vcl::RowOrColumn>( getLayout() );
+ xLayout->setOuterBorder( 0 );
- maLayout.setParentWindow( this );
- boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( &maLayout, false ) );
- size_t nIndex = maLayout.addChild( xPreviewAndTab, 5 );
- maLayout.setBorders( nIndex, aBorder.Width(), aBorder.Width(), aBorder.Width(), 0 );
+ boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( xLayout.get(), false ) );
+ size_t nIndex = xLayout->addChild( xPreviewAndTab, 5 );
+ xLayout->setBorders( nIndex, -1, -1, -1, 0 );
// setup column for preview and sub controls
boost::shared_ptr< vcl::RowOrColumn > xPreview( new vcl::RowOrColumn( xPreviewAndTab.get() ) );
@@ -1047,12 +1066,12 @@ void PrintDialog::setupLayout()
xPreviewAndTab->addWindow( &maTabCtrl );
// add the button line
- maLayout.addWindow( &maButtonLine );
+ xLayout->addWindow( &maButtonLine );
// add the row for the buttons
- boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &maLayout, false ) );
- nIndex = maLayout.addChild( xButtons );
- maLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() );
+ boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( xLayout.get(), false ) );
+ nIndex = xLayout->addChild( xButtons );
+ xLayout->setBorders( nIndex, -1, 0, -1, -1 );
Size aMinSize( maCancelButton.GetSizePixel() );
// insert help button
@@ -1127,24 +1146,24 @@ bool PrintDialog::isSingleJobs()
static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() )
{
- rtl::OUStringBuffer aBuf( 256 );
- aBuf.appendAscii( HELPID_PREFIX );
+ rtl::OStringBuffer aBuf( 256 );
+ aBuf.append( HELPID_PREFIX );
if( i_rPropName.getLength() )
{
- aBuf.append( sal_Unicode( ':' ) );
- aBuf.append( i_rPropName );
+ aBuf.append( ':' );
+ aBuf.append( rtl::OUStringToOString( i_rPropName, RTL_TEXTENCODING_UTF8 ) );
}
if( i_pType )
{
- aBuf.append( sal_Unicode( ':' ) );
- aBuf.appendAscii( i_pType );
+ aBuf.append( ':' );
+ aBuf.append( i_pType );
}
if( i_nId >= 0 )
{
- aBuf.append( sal_Unicode( ':' ) );
+ aBuf.append( ':' );
aBuf.append( i_nId );
}
- i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) );
+ i_pWindow->SetHelpId( aBuf.makeStringAndClear() );
}
static void setHelpText( Window* /*i_pWindow*/, const Sequence< rtl::OUString >& /*i_rHelpTexts*/, sal_Int32 /*i_nIndex*/ )
@@ -1170,17 +1189,15 @@ void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize )
void PrintDialog::setupOptionalUI()
{
- Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) );
-
- std::vector<vcl::RowOrColumn*> aDynamicColumns;
- vcl::RowOrColumn* pCurColumn = 0;
+ std::vector< boost::shared_ptr<vcl::RowOrColumn> > aDynamicColumns;
+ boost::shared_ptr< vcl::RowOrColumn > pCurColumn;
Window* pCurParent = 0, *pDynamicPageParent = 0;
USHORT nOptPageId = 9, nCurSubGroup = 0;
bool bOnStaticPage = false;
bool bSubgroupOnStaticPage = false;
- std::multimap< rtl::OUString, vcl::RowOrColumn* > aPropertyToDependencyRowMap;
+ std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> > aPropertyToDependencyRowMap;
const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() );
for( int i = 0; i < rOptions.getLength(); i++ )
@@ -1194,6 +1211,7 @@ void PrintDialog::setupOptionalUI()
rtl::OUString aText;
rtl::OUString aPropertyName;
Sequence< rtl::OUString > aChoices;
+ Sequence< sal_Bool > aChoicesDisabled;
Sequence< rtl::OUString > aHelpTexts;
sal_Int64 nMinValue = 0, nMaxValue = 0;
sal_Int32 nCurHelpText = 0;
@@ -1217,6 +1235,10 @@ void PrintDialog::setupOptionalUI()
{
rEntry.Value >>= aChoices;
}
+ else if( rEntry.Name.equalsAscii( "ChoicesDisabled" ) )
+ {
+ rEntry.Value >>= aChoicesDisabled;
+ }
else if( rEntry.Name.equalsAscii( "Property" ) )
{
PropertyValue aVal;
@@ -1286,37 +1308,40 @@ void PrintDialog::setupOptionalUI()
{
// restore to dynamic
pCurParent = pDynamicPageParent;
- pCurColumn = aDynamicColumns.empty() ? NULL : aDynamicColumns.back();
+ if( ! aDynamicColumns.empty() )
+ pCurColumn = aDynamicColumns.back();
+ else
+ pCurColumn.reset();
bOnStaticPage = false;
bSubgroupOnStaticPage = false;
if( aGroupingHint.equalsAscii( "PrintRange" ) )
{
- pCurColumn = maJobPage.mxPrintRange.get();
+ pCurColumn = maJobPage.mxPrintRange;
pCurParent = &maJobPage; // set job page as current parent
bOnStaticPage = true;
}
else if( aGroupingHint.equalsAscii( "OptionsPage" ) )
{
- pCurColumn = &maOptionsPage.maLayout;
+ pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maOptionsPage.getLayout());
pCurParent = &maOptionsPage; // set options page as current parent
bOnStaticPage = true;
}
else if( aGroupingHint.equalsAscii( "OptionsPageOptGroup" ) )
{
- pCurColumn = maOptionsPage.mxOptGroup.get();
+ pCurColumn = maOptionsPage.mxOptGroup;
pCurParent = &maOptionsPage; // set options page as current parent
bOnStaticPage = true;
}
else if( aGroupingHint.equalsAscii( "LayoutPage" ) )
{
- pCurColumn = &maNUpPage.maLayout;
+ pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maNUpPage.getLayout());
pCurParent = &maNUpPage; // set layout page as current parent
bOnStaticPage = true;
}
else if( aGroupingHint.getLength() )
{
- pCurColumn = &maJobPage.maLayout;
+ pCurColumn = boost::dynamic_pointer_cast<vcl::RowOrColumn>(maJobPage.getLayout());
pCurParent = &maJobPage; // set job page as current parent
bOnStaticPage = true;
}
@@ -1341,10 +1366,9 @@ void PrintDialog::setupOptionalUI()
// reset subgroup counter
nCurSubGroup = 0;
- aDynamicColumns.push_back( new vcl::RowOrColumn( NULL, true, aBorder.Width() ) );
+ aDynamicColumns.push_back( boost::dynamic_pointer_cast<vcl::RowOrColumn>(pNewGroup->getLayout()) );
pCurColumn = aDynamicColumns.back();
pCurColumn->setParentWindow( pNewGroup );
- pCurColumn->setOuterBorder( aBorder.Width() );
bSubgroupOnStaticPage = false;
bOnStaticPage = false;
}
@@ -1374,10 +1398,10 @@ void PrintDialog::setupOptionalUI()
}
// add an indent to the current column
- vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, aBorder.Width() );
+ vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn.get(), -1 );
pCurColumn->addChild( pIndent );
// and create a column inside the indent
- pCurColumn = new vcl::RowOrColumn( pIndent );
+ pCurColumn.reset( new vcl::RowOrColumn( pIndent ) );
pIndent->setChild( pCurColumn );
}
// EVIL
@@ -1401,17 +1425,17 @@ void PrintDialog::setupOptionalUI()
maPropertyToWindowMap[ aPropertyName ].push_back( &maNUpPage.maBrochureBtn );
maControlToPropertyMap[&maNUpPage.maBrochureBtn] = aPropertyName;
- aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, maNUpPage.mxBrochureDep.get() ) );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, maNUpPage.mxBrochureDep ) );
}
else
{
- vcl::RowOrColumn* pSaveCurColumn = pCurColumn;
+ boost::shared_ptr<vcl::RowOrColumn> pSaveCurColumn( pCurColumn );
if( bUseDependencyRow )
{
// find the correct dependency row (if any)
- std::pair< std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator,
- std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator > aDepRange;
+ std::pair< std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >::iterator,
+ std::multimap< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >::iterator > aDepRange;
aDepRange = aPropertyToDependencyRowMap.equal_range( aDependsOnName );
if( aDepRange.first != aDepRange.second )
{
@@ -1450,16 +1474,16 @@ void PrintDialog::setupOptionalUI()
// set help text
setHelpText( pNewBox, aHelpTexts, 0 );
- vcl::RowOrColumn* pDependencyRow = new vcl::RowOrColumn( pCurColumn, false );
+ boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pCurColumn.get(), false ) );
pCurColumn->addChild( pDependencyRow );
- aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow ) );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pDependencyRow ) );
// add checkbox to current column
pDependencyRow->addWindow( pNewBox );
}
else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent )
{
- vcl::RowOrColumn* pRadioColumn = pCurColumn;
+ boost::shared_ptr<vcl::RowOrColumn> pRadioColumn( pCurColumn );
if( aText.getLength() )
{
// add a FixedText:
@@ -1475,10 +1499,10 @@ void PrintDialog::setupOptionalUI()
// add fixed text to current column
pCurColumn->addWindow( pHeading );
// add an indent to the current column
- vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, 15 );
+ vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn.get(), 15 );
pCurColumn->addChild( pIndent );
// and create a column inside the indent
- pRadioColumn = new vcl::RowOrColumn( pIndent );
+ pRadioColumn.reset( new vcl::RowOrColumn( pIndent ) );
pIndent->setChild( pRadioColumn );
}
// iterate options
@@ -1488,17 +1512,19 @@ void PrintDialog::setupOptionalUI()
pVal->Value >>= nSelectVal;
for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
{
- boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn, 1 ) );
+ boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn.get(), 1 ) );
pRadioColumn->addChild( pLabel );
boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pLabel.get(), false ) );
pLabel->setElement( pDependencyRow );
- aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow.get() ) );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pDependencyRow ) );
RadioButton* pBtn = new RadioButton( pCurParent, m == 0 ? WB_GROUP : 0 );
maControls.push_front( pBtn );
pBtn->SetText( aChoices[m] );
pBtn->Check( m == nSelectVal );
pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) );
+ if( aChoicesDisabled.getLength() > m && aChoicesDisabled[m] == sal_True )
+ pBtn->Enable( FALSE );
pBtn->Show();
maPropertyToWindowMap[ aPropertyName ].push_back( pBtn );
maControlToPropertyMap[pBtn] = aPropertyName;
@@ -1518,9 +1544,9 @@ void PrintDialog::setupOptionalUI()
) && pCurParent )
{
// create a row in the current column
- vcl::RowOrColumn* pFieldColumn = new vcl::RowOrColumn( pCurColumn, false );
+ boost::shared_ptr<vcl::RowOrColumn> pFieldColumn( new vcl::RowOrColumn( pCurColumn.get(), false ) );
pCurColumn->addChild( pFieldColumn );
- aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pFieldColumn ) );
+ aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, boost::shared_ptr<vcl::RowOrColumn> >( aPropertyName, pFieldColumn ) );
vcl::LabeledElement* pLabel = NULL;
if( aText.getLength() )
@@ -1535,7 +1561,7 @@ void PrintDialog::setupOptionalUI()
setSmartId( pHeading, "FixedText", -1, aPropertyName );
// add to row
- pLabel = new vcl::LabeledElement( pFieldColumn, 2 );
+ pLabel = new vcl::LabeledElement( pFieldColumn.get(), 2 );
pFieldColumn->addChild( pLabel );
pLabel->setLabel( pHeading );
}
@@ -1670,11 +1696,11 @@ void PrintDialog::setupOptionalUI()
// FIXME: the GetNativeControlRegion call on Windows has some issues
// (which skew the results of GetOptimalSize())
// however fixing this thoroughly needs to take interaction with paint into
- // acoount, making the right fix less simple. Fix this the right way
+ // account, making the right fix less simple. Fix this the right way
// at some point. For now simply add some space at the lowest element
- size_t nIndex = maJobPage.maLayout.countElements();
+ size_t nIndex = maJobPage.getLayout()->countElements();
if( nIndex > 0 ) // sanity check
- maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() );
+ maJobPage.getLayout()->setBorders( nIndex-1, 0, 0, 0, -1 );
#endif
// create auto mnemomnics now so they can be calculated in layout
@@ -1684,13 +1710,13 @@ void PrintDialog::setupOptionalUI()
ImplWindowAutoMnemonic( this );
// calculate job page
- Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
+ Size aMaxSize = maJobPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED );
// and layout page
- updateMaxSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
+ updateMaxSize( maNUpPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
// and options page
- updateMaxSize( maOptionsPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
+ updateMaxSize( maOptionsPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize );
- for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin();
+ for( std::vector< boost::shared_ptr<vcl::RowOrColumn> >::iterator it = aDynamicColumns.begin();
it != aDynamicColumns.end(); ++it )
{
Size aPageSize( (*it)->getOptimalSize( WINDOWSIZE_PREFERRED ) );
@@ -1718,19 +1744,7 @@ void PrintDialog::setupOptionalUI()
maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() );
}
- // and finally arrange controls
- for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin();
- it != aDynamicColumns.end(); ++it )
- {
- (*it)->setManagedArea( Rectangle( Point(), aTabSize ) );
- delete *it;
- *it = NULL;
- }
- maJobPage.Resize();
- maNUpPage.Resize();
- maOptionsPage.Resize();
-
- Size aSz = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED );
+ Size aSz = getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED );
SetOutputSizePixel( aSz );
}
@@ -1765,7 +1779,7 @@ void PrintDialog::checkControlDependencies()
maJobPage.maCollateImage.SetSizePixel( aImgSize );
maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg );
maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST );
- maJobPage.maLayout.resize();
+ maJobPage.getLayout()->resize();
// enable setup button only for printers that can be setup
bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG );
@@ -1780,7 +1794,7 @@ void PrintDialog::checkControlDependencies()
aPrinterSize.Width() = aSetupPos.X() - aPrinterPos.X() - LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ).Width();
maJobPage.maPrinters.SetSizePixel( aPrinterSize );
maJobPage.maSetupButton.Show();
- maLayout.resize();
+ getLayout()->resize();
}
}
else
@@ -1794,7 +1808,7 @@ void PrintDialog::checkControlDependencies()
aPrinterSize.Width() = aSetupPos.X() + aSetupSize.Width() - aPrinterPos.X();
maJobPage.maPrinters.SetSizePixel( aPrinterSize );
maJobPage.maSetupButton.Hide();
- maLayout.resize();
+ getLayout()->resize();
}
}
}
@@ -1823,6 +1837,16 @@ void PrintDialog::checkOptionalControlDependencies()
}
}
+ if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first) )
+ {
+ std::map< Window*, sal_Int32 >::const_iterator r_it = maControlToNumValMap.find( it->first );
+ if( r_it != maControlToNumValMap.end() )
+ {
+ bShouldbeEnabled = maPController->isUIChoiceEnabled( it->second, r_it->second );
+ }
+ }
+
+
bool bIsEnabled = it->first->IsEnabled();
// Enable does not do a change check first, so can be less cheap than expected
if( bShouldbeEnabled != bIsEnabled )
@@ -2025,7 +2049,7 @@ void PrintDialog::updateNupFromPages()
if( bCustom )
{
// see if we have to enlarge the dialog to make the tab page fit
- Size aCurSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ) );
+ Size aCurSize( maNUpPage.getLayout()->getOptimalSize( WINDOWSIZE_PREFERRED ) );
Size aTabSize( maTabCtrl.GetTabPageSizePixel() );
if( aTabSize.Height() < aCurSize.Height() )
{
@@ -2061,10 +2085,14 @@ void PrintDialog::updateNup()
int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData(
maNUpPage.maNupOrderBox.GetSelectEntryPos() )));
- if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD )
+ if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTB )
aMPS.nOrder = PrinterController::LRTB;
- else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR )
+ else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBLR )
aMPS.nOrder = PrinterController::TBLR;
+ else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_RLTB )
+ aMPS.nOrder = PrinterController::RLTB;
+ else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBRL )
+ aMPS.nOrder = PrinterController::TBRL;
int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData(
maNUpPage.maNupOrientationBox.GetSelectEntryPos() )));
@@ -2130,7 +2158,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
if( pHelp )
{
// FIXME: find out proper help URL and use here
- pHelp->Start( HID_PRINTDLG, GetParent() );
+ pHelp->Start( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ), GetParent() );
}
}
else if( pButton == &maForwardBtn )
@@ -2144,7 +2172,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
else if( pButton == &maOptionsPage.maToFileBox )
{
maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText );
- maLayout.resize();
+ getLayout()->resize();
}
else if( pButton == &maNUpPage.maBrochureBtn )
{
@@ -2180,7 +2208,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
{
maDetailsCollapsedSize = GetOutputSizePixel();
// enlarge dialog if necessary
- Size aMinSize( maJobPage.maLayout.getOptimalSize( WINDOWSIZE_MINIMUM ) );
+ Size aMinSize( maJobPage.getLayout()->getOptimalSize( WINDOWSIZE_MINIMUM ) );
Size aCurSize( maJobPage.GetSizePixel() );
if( aCurSize.Height() < aMinSize.Height() )
{
@@ -2454,7 +2482,7 @@ void PrintDialog::Command( const CommandEvent& rEvt )
void PrintDialog::Resize()
{
- maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ // maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
// and do the preview; however the metafile does not need to be gotten anew
preparePreview( false );
@@ -2558,6 +2586,7 @@ void PrintProgressDialog::tick()
void PrintProgressDialog::reset()
{
+ mbCanceled = false;
setProgress( 0 );
}
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 689c56cbe619..62fbe2e507f3 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -49,7 +49,8 @@
// =======================================================================
-// Achtung: Darf keine Objekte enthalten, da mit memmove/memcpy gearbeitet wird
+// Attention: Must not contain non-PODs because array is enlarged/copied
+// with the use of memmove/memcpy.
struct ImplSplitItem
{
long mnSize;
@@ -71,6 +72,10 @@ struct ImplSplitItem
SplitWindowItemBits mnBits;
BOOL mbFixed;
BOOL mbSubSize;
+ /// Minimal width or height of the item. -1 means no restriction.
+ long mnMinSize;
+ /// Maximal width or height of the item. -1 means no restriction.
+ long mnMaxSize;
};
struct ImplSplitSet
@@ -85,6 +90,28 @@ struct ImplSplitSet
BOOL mbCalcPix;
};
+
+
+/** Check whether the given size is inside the valid range defined by
+ [rItem.mnMinSize,rItem.mnMaxSize]. When it is not inside it then return
+ the upper or lower bound, respectively. Otherwise return the given size
+ unmodified.
+ Note that either mnMinSize and/or mnMaxSize can be -1 in which case the
+ size has not lower or upper bound.
+*/
+namespace {
+ long ValidateSize (const long nSize, const ImplSplitItem rItem)
+ {
+ if (rItem.mnMinSize>=0 && nSize<rItem.mnMinSize)
+ return rItem.mnMinSize;
+ else if (rItem.mnMaxSize>0 && nSize>rItem.mnMaxSize)
+ return rItem.mnMaxSize;
+ else
+ return nSize;
+ }
+}
+
+
#define SPLITWIN_SPLITSIZE 3
#define SPLITWIN_SPLITSIZEEX 4
#define SPLITWIN_SPLITSIZEEXLN 6
@@ -2850,7 +2877,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
DBG_ASSERT( !ImplFindItem( mpMainSet, nId, nDbgDummy ), "SplitWindow::InsertItem() - Id already exists" );
#endif
- // Size muss min. 1 sein
+ // Size has to be at least 1.
if ( nSize < 1 )
nSize = 1;
@@ -2858,7 +2885,7 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
ImplSplitSet* pNewSet;
ImplSplitItem* pItem;
- // Platz fuer neues Item schaffen
+ // Make room for the new item.
if ( nPos > pSet->mnItems )
nPos = pSet->mnItems;
ImplSplitItem* pNewItems = new ImplSplitItem[pSet->mnItems+1];
@@ -2871,19 +2898,21 @@ void SplitWindow::InsertItem( USHORT nId, Window* pWindow, long nSize,
pSet->mnItems++;
pSet->mbCalcPix = TRUE;
- // Item anlegen und erweitern
+ // Create and initialize item.
pItem = &(pSet->mpItems[nPos]);
memset( pItem, 0, sizeof( ImplSplitItem ) );
pItem->mnSize = nSize;
pItem->mnId = nId;
pItem->mnBits = nBits;
+ pItem->mnMinSize=-1;
+ pItem->mnMaxSize=-1;
if ( pWindow )
{
pItem->mpWindow = pWindow;
pItem->mpOrgParent = pWindow->GetParent();
- // Window mit SplitWindow verbinden
+ // Attach window to SplitWindow.
pWindow->Hide();
pWindow->SetParent( this );
}
@@ -3251,6 +3280,10 @@ void SplitWindow::SplitItem( USHORT nId, long nNewSize,
nItems = pSet->mnItems;
pItems = pSet->mpItems;
+ // When there is an explicit minimum or maximum size then move nNewSize
+ // into that range (when it is not yet already in it.)
+ nNewSize = ValidateSize(nNewSize, pItems[nPos]);
+
if ( mbCalc )
{
pItems[nPos].mnSize = nNewSize;
@@ -3552,6 +3585,36 @@ long SplitWindow::GetItemSize( USHORT nId, SplitWindowItemBits nBits ) const
return 0;
}
+
+
+
+void SplitWindow::SetItemSizeRange (USHORT nId, const Range aRange)
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
+
+ if (pSet != NULL)
+ {
+ pSet->mpItems[nPos].mnMinSize = aRange.Min();
+ pSet->mpItems[nPos].mnMaxSize = aRange.Max();
+ }
+}
+
+
+
+
+Range SplitWindow::GetItemSizeRange (USHORT nId) const
+{
+ USHORT nPos;
+ ImplSplitSet* pSet = ImplFindItem(mpBaseSet, nId, nPos);
+
+ if (pSet != NULL)
+ return Range (pSet->mpItems[nPos].mnMinSize, pSet->mpItems[nPos].mnMaxSize);
+ else
+ return Range(-1,-1);
+}
+
+
// -----------------------------------------------------------------------
void SplitWindow::SetItemBits( USHORT nId, SplitWindowItemBits nNewBits )
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 385dd241c770..36f27b1ceee7 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -89,7 +89,7 @@ struct ImplStatusItem
XubString maText;
XubString maHelpText;
XubString maQuickHelpText;
- ULONG mnHelpId;
+ rtl::OString maHelpId;
void* mpUserData;
BOOL mbVisible;
XubString maAccessibleName;
@@ -320,6 +320,8 @@ void StatusBar::ImplFormat()
nExtraWidth2 = 0;
}
nX = STATUSBAR_OFFSET_X;
+ if( ImplHasMirroredGraphics() && IsRTLEnabled() )
+ nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
}
pItem = mpItemList->First();
@@ -833,7 +835,7 @@ void StatusBar::Resize()
{
// Breite und Hoehe abfragen und merken
Size aSize = GetOutputSizePixel();
- mnDX = aSize.Width();
+ mnDX = aSize.Width() - ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
mnDY = aSize.Height();
mnCalcHeight = mnDY;
// subtract border
@@ -904,9 +906,9 @@ void StatusBar::RequestHelp( const HelpEvent& rHEvt )
else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
{
String aCommand = GetItemCommand( nItemId );
- ULONG nHelpId = GetHelpId( nItemId );
+ rtl::OString aHelpId( GetHelpId( nItemId ) );
- if ( aCommand.Len() || nHelpId )
+ if ( aCommand.Len() || aHelpId.getLength() )
{
// Wenn eine Hilfe existiert, dann ausloesen
Help* pHelp = Application::GetHelp();
@@ -914,8 +916,8 @@ void StatusBar::RequestHelp( const HelpEvent& rHEvt )
{
if ( aCommand.Len() )
pHelp->Start( aCommand, this );
- else if ( nHelpId )
- pHelp->Start( nHelpId, this );
+ else if ( aHelpId.getLength() )
+ pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), this );
}
return;
}
@@ -1031,7 +1033,6 @@ void StatusBar::InsertItem( USHORT nItemId, ULONG nWidth,
pItem->mnBits = nBits;
pItem->mnWidth = (long)nWidth+nFudge+STATUSBAR_OFFSET;
pItem->mnOffset = nOffset;
- pItem->mnHelpId = 0;
pItem->mpUserData = 0;
pItem->mbVisible = TRUE;
@@ -1473,15 +1474,15 @@ const XubString& StatusBar::GetHelpText( USHORT nItemId ) const
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
{
ImplStatusItem* pItem = mpItemList->GetObject( nPos );
- if ( !pItem->maHelpText.Len() && ( pItem->mnHelpId || pItem->maCommand.Len() ))
+ if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommand.Len() ))
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
if ( pItem->maCommand.Len() )
pItem->maHelpText = pHelp->GetHelpText( pItem->maCommand, this );
- if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
- pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this );
+ if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() )
+ pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
}
}
@@ -1518,24 +1519,31 @@ const XubString& StatusBar::GetQuickHelpText( USHORT nItemId ) const
// -----------------------------------------------------------------------
-void StatusBar::SetHelpId( USHORT nItemId, ULONG nHelpId )
+void StatusBar::SetHelpId( USHORT nItemId, const rtl::OString& rHelpId )
{
USHORT nPos = GetItemPos( nItemId );
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- mpItemList->GetObject( nPos )->mnHelpId = nHelpId;
+ mpItemList->GetObject( nPos )->maHelpId = rHelpId;
}
// -----------------------------------------------------------------------
-ULONG StatusBar::GetHelpId( USHORT nItemId ) const
+rtl::OString StatusBar::GetHelpId( USHORT nItemId ) const
{
USHORT nPos = GetItemPos( nItemId );
+ rtl::OString aRet;
if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- return mpItemList->GetObject( nPos )->mnHelpId;
- else
- return 0;
+ {
+ ImplStatusItem* pItem = mpItemList->GetObject( nPos );
+ if ( pItem->maHelpId.getLength() )
+ aRet = pItem->maHelpId;
+ else
+ aRet = ::rtl::OUStringToOString( pItem->maCommand, RTL_TEXTENCODING_UTF8 );
+ }
+
+ return aRet;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx
index ef71f83df1ee..4e897eef4a8b 100644
--- a/vcl/source/window/syschild.cxx
+++ b/vcl/source/window/syschild.cxx
@@ -28,25 +28,34 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_SVSYS_HXX
#include <svsys.h>
-#endif
+#include <rtl/process.h>
+#include <rtl/ref.hxx>
+#include <tools/rc.h>
+#include <vcl/window.h>
#include <vcl/salinst.hxx>
#include <vcl/salframe.hxx>
#include <vcl/window.hxx>
#include <vcl/salobj.hxx>
-
-#ifndef _SV_RC_H
-#include <tools/rc.h>
-#endif
#include <vcl/svdata.hxx>
-#ifndef _SV_WIDNOW_H
-#include <vcl/window.h>
-#endif
+#include <vcl/sysdata.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syschild.hxx>
+#include <vcl/unohelp.hxx>
+#ifdef SOLAR_JAVA
+#include <jni.h>
+#endif
+
+#include <comphelper/processfactory.hxx>
+#include <jvmaccess/virtualmachine.hxx>
+#include <com/sun/star/java/XJavaVM.hpp>
+#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vcl/syschild.hxx>
+using namespace ::com::sun::star;
// =======================================================================
@@ -183,6 +192,8 @@ void SystemChildWindow::EnableEraseBackground( BOOL bEnable )
mpWindowImpl->mpSysObj->EnableEraseBackground( bEnable );
}
+// -----------------------------------------------------------------------
+
BOOL SystemChildWindow::IsEraseBackgroundEnabled()
{
if ( mpWindowImpl->mpSysObj )
@@ -190,3 +201,138 @@ BOOL SystemChildWindow::IsEraseBackgroundEnabled()
else
return FALSE;
}
+
+// -----------------------------------------------------------------------
+
+void SystemChildWindow::ImplTestJavaException( void* pEnv )
+{
+#ifdef SOLAR_JAVA
+ JNIEnv* pJavaEnv = reinterpret_cast< JNIEnv* >( pEnv );
+ jthrowable jtThrowable = pJavaEnv->ExceptionOccurred();
+
+ if( jtThrowable )
+ { // is it a java exception ?
+#if OSL_DEBUG_LEVEL > 1
+ pJavaEnv->ExceptionDescribe();
+#endif // OSL_DEBUG_LEVEL > 1
+ pJavaEnv->ExceptionClear();
+
+ jclass jcThrowable = pJavaEnv->FindClass("java/lang/Throwable");
+ jmethodID jmThrowable_getMessage = pJavaEnv->GetMethodID(jcThrowable, "getMessage", "()Ljava/lang/String;");
+ jstring jsMessage = (jstring) pJavaEnv->CallObjectMethod(jtThrowable, jmThrowable_getMessage);
+ ::rtl::OUString ouMessage;
+
+ if(jsMessage)
+ {
+ const jchar * jcMessage = pJavaEnv->GetStringChars(jsMessage, NULL);
+ ouMessage = ::rtl::OUString(jcMessage);
+ pJavaEnv->ReleaseStringChars(jsMessage, jcMessage);
+ }
+
+ throw uno::RuntimeException(ouMessage, uno::Reference<uno::XInterface>());
+ }
+#endif // SOLAR_JAVA
+}
+
+// -----------------------------------------------------------------------
+
+sal_IntPtr SystemChildWindow::GetParentWindowHandle( sal_Bool bUseJava )
+{
+ sal_IntPtr nRet = 0;
+
+#if defined WNT
+ nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->hWnd );
+#elif defined QUARTZ
+ // FIXME: this is wrong
+ nRet = reinterpret_cast< sal_IntPtr >( GetSystemData()->pView );
+#elif defined UNX
+ if( !bUseJava )
+ {
+ nRet = (sal_IntPtr) GetSystemData()->aWindow;
+ }
+#ifdef SOLAR_JAVA
+ else
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
+
+ if( xFactory.is() && ( GetSystemData()->aWindow > 0 ) )
+ {
+ try
+ {
+ ::rtl::Reference< ::jvmaccess::VirtualMachine > xVM;
+ uno::Reference< java::XJavaVM > xJavaVM( xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine") ) ), uno::UNO_QUERY );
+ uno::Sequence< sal_Int8 > aProcessID( 17 );
+
+ rtl_getGlobalProcessId( (sal_uInt8*) aProcessID.getArray() );
+ aProcessID[ 16 ] = 0;
+ OSL_ENSURE(sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64");
+ sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( static_cast< jvmaccess::VirtualMachine * >(0));
+ xJavaVM->getJavaVM(aProcessID) >>= nPointer;
+ xVM = reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer);
+
+ if( xVM.is() )
+ {
+ try
+ {
+ ::jvmaccess::VirtualMachine::AttachGuard aVMAttachGuard( xVM );
+ JNIEnv* pEnv = aVMAttachGuard.getEnvironment();
+
+ jclass jcToolkit = pEnv->FindClass("java/awt/Toolkit");
+ ImplTestJavaException(pEnv);
+
+ jmethodID jmToolkit_getDefaultToolkit = pEnv->GetStaticMethodID( jcToolkit, "getDefaultToolkit", "()Ljava/awt/Toolkit;" );
+ ImplTestJavaException(pEnv);
+
+ pEnv->CallStaticObjectMethod(jcToolkit, jmToolkit_getDefaultToolkit);
+ ImplTestJavaException(pEnv);
+
+ jclass jcMotifAppletViewer = pEnv->FindClass("sun/plugin/navig/motif/MotifAppletViewer");
+ if( pEnv->ExceptionOccurred() )
+ {
+ pEnv->ExceptionClear();
+
+ jcMotifAppletViewer = pEnv->FindClass( "sun/plugin/viewer/MNetscapePluginContext");
+ ImplTestJavaException(pEnv);
+ }
+
+ jclass jcClassLoader = pEnv->FindClass("java/lang/ClassLoader");
+ ImplTestJavaException(pEnv);
+
+ jmethodID jmClassLoader_loadLibrary = pEnv->GetStaticMethodID( jcClassLoader, "loadLibrary", "(Ljava/lang/Class;Ljava/lang/String;Z)V");
+ ImplTestJavaException(pEnv);
+
+ jstring jsplugin = pEnv->NewStringUTF("javaplugin_jni");
+ ImplTestJavaException(pEnv);
+
+ pEnv->CallStaticVoidMethod(jcClassLoader, jmClassLoader_loadLibrary, jcMotifAppletViewer, jsplugin, JNI_FALSE);
+ ImplTestJavaException(pEnv);
+
+ jmethodID jmMotifAppletViewer_getWidget = pEnv->GetStaticMethodID( jcMotifAppletViewer, "getWidget", "(IIIII)I" );
+ ImplTestJavaException(pEnv);
+
+ const Size aSize( GetOutputSizePixel() );
+ jint ji_widget = pEnv->CallStaticIntMethod( jcMotifAppletViewer, jmMotifAppletViewer_getWidget,
+ GetSystemData()->aWindow, 0, 0, aSize.Width(), aSize.Height() );
+ ImplTestJavaException(pEnv);
+
+ nRet = static_cast< sal_IntPtr >( ji_widget );
+ }
+ catch( uno::RuntimeException& )
+ {
+ }
+
+ if( !nRet )
+ nRet = static_cast< sal_IntPtr >( GetSystemData()->aWindow );
+ }
+ }
+ catch( ... )
+ {
+ }
+ }
+ }
+#endif // SOLAR_JAVA
+#else // WNT || QUARTZ || UNX
+#endif
+
+ return nRet;
+}
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index c09dc464b809..1adabe487492 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -206,7 +206,7 @@ BOOL TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
BOOL bFocusInList = FALSE;
KeyCode aKeyCode = aKeyEvent.GetKeyCode();
BOOL bForward = !aKeyCode.IsShift();
- if( aKeyCode.GetCode() == KEY_F6 ) // F6
+ if( aKeyCode.GetCode() == KEY_F6 && ! aKeyCode.IsMod2() ) // F6
{
bSplitterOnly = aKeyCode.IsMod1() && aKeyCode.IsShift();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index cde91a8dcd97..b71cf1c13c8d 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3451,6 +3451,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
MetricVector* pVector = bLayout ? &mpData->m_pLayoutData->m_aUnicodeBoundRects : NULL;
String* pDisplayText = bLayout ? &mpData->m_pLayoutData->m_aDisplayText : NULL;
+ bHighlight = bHighlight && pItem->mbEnabled;
+
// Falls Rechteck ausserhalb des sichbaren Bereichs liegt
if ( pItem->maRect.IsEmpty() )
return;
@@ -4818,15 +4820,15 @@ const XubString& ToolBox::ImplGetHelpText( USHORT nItemId ) const
if ( pItem )
{
- if ( !pItem->maHelpText.Len() && ( pItem->mnHelpId || pItem->maCommandStr.Len() ))
+ if ( !pItem->maHelpText.Len() && ( pItem->maHelpId.getLength() || pItem->maCommandStr.Len() ))
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
if ( pItem->maCommandStr.Len() )
pItem->maHelpText = pHelp->GetHelpText( pItem->maCommandStr, this );
- if ( !pItem->maHelpText.Len() && pItem->mnHelpId )
- pItem->maHelpText = pHelp->GetHelpText( pItem->mnHelpId, this );
+ if ( !pItem->maHelpText.Len() && pItem->maHelpId.getLength() )
+ pItem->maHelpText = pHelp->GetHelpText( rtl::OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
}
}
@@ -4892,9 +4894,9 @@ void ToolBox::RequestHelp( const HelpEvent& rHEvt )
else if ( rHEvt.GetMode() & HELPMODE_EXTENDED )
{
String aCommand = GetItemCommand( nItemId );
- ULONG nHelpId = GetHelpId( nItemId );
+ rtl::OString aHelpId( GetHelpId( nItemId ) );
- if ( aCommand.Len() || nHelpId )
+ if ( aCommand.Len() || aHelpId.getLength() )
{
// Wenn eine Hilfe existiert, dann ausloesen
Help* pHelp = Application::GetHelp();
@@ -4902,8 +4904,8 @@ void ToolBox::RequestHelp( const HelpEvent& rHEvt )
{
if ( aCommand.Len() )
pHelp->Start( aCommand, this );
- else if ( nHelpId )
- pHelp->Start( nHelpId, this );
+ else if ( aHelpId.getLength() )
+ pHelp->Start( rtl::OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), this );
}
return;
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 334cdd2d0a64..35a39676353a 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -99,7 +99,6 @@ ImplToolItem::ImplToolItem()
mnId = 0;
mpWindow = NULL;
mpUserData = NULL;
- mnHelpId = 0;
meType = TOOLBOXITEM_BUTTON;
mnBits = 0;
meState = STATE_NOCHECK;
@@ -124,7 +123,6 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage,
mnId = nItemId;
mpWindow = NULL;
mpUserData = NULL;
- mnHelpId = 0;
meType = TOOLBOXITEM_BUTTON;
mnBits = nItemBits;
meState = STATE_NOCHECK;
@@ -149,7 +147,6 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const XubString& rText,
mnId = nItemId;
mpWindow = NULL;
mpUserData = NULL;
- mnHelpId = 0;
meType = TOOLBOXITEM_BUTTON;
mnBits = nItemBits;
meState = STATE_NOCHECK;
@@ -175,7 +172,6 @@ ImplToolItem::ImplToolItem( USHORT nItemId, const Image& rImage,
mnId = nItemId;
mpWindow = NULL;
mpUserData = NULL;
- mnHelpId = 0;
meType = TOOLBOXITEM_BUTTON;
mnBits = nItemBits;
meState = STATE_NOCHECK;
@@ -204,7 +200,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) :
maQuickHelpText ( rItem.maQuickHelpText ),
maHelpText ( rItem.maHelpText ),
maCommandStr ( rItem.maCommandStr ),
- mnHelpId ( rItem.mnHelpId ),
+ maHelpId ( rItem.maHelpId ),
maRect ( rItem.maRect ),
maCalcRect ( rItem.maCalcRect ),
maItemSize ( rItem.maItemSize ),
@@ -243,7 +239,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem )
maQuickHelpText = rItem.maQuickHelpText;
maHelpText = rItem.maHelpText;
maCommandStr = rItem.maCommandStr;
- mnHelpId = rItem.mnHelpId;
+ maHelpId = rItem.maHelpId;
maRect = rItem.maRect;
maCalcRect = rItem.maCalcRect;
mnSepSize = rItem.mnSepSize;
@@ -595,7 +591,7 @@ void ToolBox::InsertItem( const ResId& rResId, USHORT nPos )
aItem.mnBits = (ToolBoxItemBits)ReadLongRes();
if( nObjMask & RSC_TOOLBOXITEM_HELPID )
- aItem.mnHelpId = ReadLongRes();
+ aItem.maHelpId = ReadByteStringRes();
if ( nObjMask & RSC_TOOLBOXITEM_TEXT )
{
@@ -1923,24 +1919,31 @@ const XubString& ToolBox::GetHelpText( USHORT nItemId ) const
// -----------------------------------------------------------------------
-void ToolBox::SetHelpId( USHORT nItemId, ULONG nHelpId )
+void ToolBox::SetHelpId( USHORT nItemId, const rtl::OString& rHelpId )
{
ImplToolItem* pItem = ImplGetItem( nItemId );
if ( pItem )
- pItem->mnHelpId = nHelpId;
+ pItem->maHelpId = rHelpId;
}
// -----------------------------------------------------------------------
-ULONG ToolBox::GetHelpId( USHORT nItemId ) const
+rtl::OString ToolBox::GetHelpId( USHORT nItemId ) const
{
+ rtl::OString aRet;
+
ImplToolItem* pItem = ImplGetItem( nItemId );
if ( pItem )
- return pItem->mnHelpId;
- else
- return 0;
+ {
+ if ( pItem->maHelpId.getLength() )
+ aRet = pItem->maHelpId;
+ else
+ aRet = ::rtl::OUStringToOString( pItem->maCommandStr, RTL_TEXTENCODING_UTF8 );
+ }
+
+ return aRet;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 370669d6969b..fe2af486c53a 100644..100755
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -295,6 +295,8 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl )
aTmpSt.SetHighContrastMode( FALSE );
rSettings.SetStyleSettings( aTmpSt );
ImplGetFrame()->UpdateSettings( rSettings );
+ // reset default border width for layouters
+ ImplGetSVData()->maAppData.mnDefaultLayoutBorder = -1;
// Verify availability of the configured UI font, otherwise choose "Andale Sans UI"
String aUserInterfaceFont;
@@ -599,6 +601,7 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mpDlgCtrlDownWindow = NULL; // window for dialog control
mpWindowImpl->mpFirstDel = NULL; // Dtor notification list
mpWindowImpl->mpUserData = NULL; // user data
+ mpWindowImpl->mpExtImpl = NULL; // extended implementation data
mpWindowImpl->mpCursor = NULL; // cursor
mpWindowImpl->mpControlFont = NULL; // font propertie
mpWindowImpl->mpVCLXWindow = NULL;
@@ -612,8 +615,6 @@ void Window::ImplInitWindowData( WindowType nType )
mpWindowImpl->mnX = 0; // X-Position to Parent
mpWindowImpl->mnY = 0; // Y-Position to Parent
mpWindowImpl->mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning
- mpWindowImpl->mnHelpId = 0; // help id
- mpWindowImpl->mnUniqId = 0; // unique id
mpWindowImpl->mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren
mpWindowImpl->mpPaintRegion = NULL; // Paint-ClipRegion
mpWindowImpl->mnStyle = 0; // style (init in ImplInitWindow)
@@ -1131,6 +1132,8 @@ void Window::ImplCallResize()
// #88419# Most classes don't call the base class in Resize() and Move(),
// => Call ImpleResize/Move instead of Resize/Move directly...
ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE );
+
+ ImplExtResize();
}
// -----------------------------------------------------------------------
@@ -1179,20 +1182,14 @@ void Window::ImplCallMove()
// -----------------------------------------------------------------------
-static ULONG ImplAutoHelpID( ResMgr* pResMgr )
+static rtl::OString ImplAutoHelpID( ResMgr* pResMgr )
{
- if ( !Application::IsAutoHelpIdEnabled() )
- return 0;
+ rtl::OString aRet;
- ULONG nHID = 0;
-
- DBG_ASSERT( pResMgr, "No res mgr for auto help id" );
- if( ! pResMgr )
- return 0;
+ if( pResMgr && Application::IsAutoHelpIdEnabled() )
+ aRet = pResMgr->GetAutoHelpId();
- nHID = pResMgr->GetAutoHelpId();
-
- return nHID;
+ return aRet;
}
// -----------------------------------------------------------------------
@@ -1212,22 +1209,23 @@ WinBits Window::ImplInitRes( const ResId& rResId )
void Window::ImplLoadRes( const ResId& rResId )
{
- // newer move this line after IncrementRes
- char* pRes = (char*)GetClassRes();
- pRes += 12;
- sal_uInt32 nHelpId = (sal_uInt32)GetLongRes( (void*)pRes );
- if ( !nHelpId )
- nHelpId = ImplAutoHelpID( rResId.GetResMgr() );
- SetHelpId( nHelpId );
-
ULONG nObjMask = ReadLongRes();
+ // we need to calculate auto helpids before the resource gets closed
+ // if the resource only contains flags, it will be closed before we try to read a help id
+ // so we always create an auto help id that might be overwritten later
+ // HelpId
+ rtl::OString aHelpId = ImplAutoHelpID( rResId.GetResMgr() );
+
// ResourceStyle
ULONG nRSStyle = ReadLongRes();
// WinBits
ReadLongRes();
- // HelpId
- ReadLongRes();
+
+ if( nObjMask & WINDOW_HELPID )
+ aHelpId = ReadByteStringRes();
+
+ SetHelpId( aHelpId );
BOOL bPos = FALSE;
BOOL bSize = FALSE;
@@ -1294,7 +1292,7 @@ void Window::ImplLoadRes( const ResId& rResId )
if ( nObjMask & WINDOW_EXTRALONG )
SetData( (void*)ReadLongRes() );
if ( nObjMask & WINDOW_UNIQUEID )
- SetUniqueId( (ULONG)ReadLongRes() );
+ SetUniqueId( ReadByteStringRes() );
if ( nObjMask & WINDOW_BORDER_STYLE )
{
@@ -1322,8 +1320,6 @@ ImplWinData* Window::ImplGetWinData() const
mpWindowImpl->mpWinData->mnIsTopWindow = (USHORT) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
mpWindowImpl->mpWinData->mbMouseOver = FALSE;
mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? FALSE : TRUE; // TRUE: try to draw this control with native theme API
- mpWindowImpl->mpWinData->mpSmartHelpId = NULL;
- mpWindowImpl->mpWinData->mpSmartUniqueId = NULL;
}
return mpWindowImpl->mpWinData;
@@ -4351,6 +4347,8 @@ namespace
Window::~Window()
{
+ ImplFreeExtWindowImpl();
+
vcl::LazyDeletor<Window>::Undelete( this );
DBG_DTOR( Window, ImplDbgCheckWindow );
@@ -4734,10 +4732,6 @@ Window::~Window()
delete mpWindowImpl->mpWinData->mpFocusRect;
if ( mpWindowImpl->mpWinData->mpTrackRect )
delete mpWindowImpl->mpWinData->mpTrackRect;
- if ( mpWindowImpl->mpWinData->mpSmartHelpId )
- delete mpWindowImpl->mpWinData->mpSmartHelpId;
- if ( mpWindowImpl->mpWinData->mpSmartUniqueId )
- delete mpWindowImpl->mpWinData->mpSmartUniqueId;
delete mpWindowImpl->mpWinData;
}
@@ -4882,6 +4876,12 @@ void Window::Paint( const Rectangle& rRect )
// -----------------------------------------------------------------------
+void Window::PostPaint()
+{
+}
+
+// -----------------------------------------------------------------------
+
void Window::Draw( OutputDevice*, const Point&, const Size&, ULONG )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
@@ -4986,29 +4986,18 @@ void Window::RequestHelp( const HelpEvent& rHEvt )
}
else
{
- SmartId aSmartId = GetSmartHelpId();
-
- ULONG nNumHelpId = 0;
- String aStrHelpId;
- if( aSmartId.HasString() )
- aStrHelpId = aSmartId.GetStr();
- if( aSmartId.HasNumeric() )
- nNumHelpId = aSmartId.GetNum();
-
- if ( !nNumHelpId && aStrHelpId.Len() == 0 && ImplGetParent() )
+ String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
+ if ( aStrHelpId.Len() == 0 && ImplGetParent() )
ImplGetParent()->RequestHelp( rHEvt );
else
{
- if ( !nNumHelpId && aStrHelpId.Len() == 0 )
- nNumHelpId = OOO_HELP_INDEX;
-
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
if( aStrHelpId.Len() > 0 )
pHelp->Start( aStrHelpId, this );
else
- pHelp->Start( nNumHelpId, this );
+ pHelp->Start( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OOO_HELP_INDEX ) ), this );
}
}
}
@@ -8137,32 +8126,22 @@ const XubString& Window::GetHelpText() const
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
- SmartId aSmartId = GetSmartHelpId();
-
- ULONG nNumHelpId = 0;
- String aStrHelpId;
- if( aSmartId.HasString() )
- aStrHelpId = aSmartId.GetStr();
- if( aSmartId.HasNumeric() )
- nNumHelpId = aSmartId.GetNum();
+ String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
bool bStrHelpId = (aStrHelpId.Len() > 0);
- if ( !mpWindowImpl->maHelpText.Len() && (nNumHelpId || bStrHelpId) )
+ if ( !mpWindowImpl->maHelpText.Len() && bStrHelpId )
{
if ( !IsDialog() && (mpWindowImpl->mnType != WINDOW_TABPAGE) && (mpWindowImpl->mnType != WINDOW_FLOATINGWINDOW) )
{
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
- if( bStrHelpId )
- ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this );
- else
- ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( nNumHelpId, this );
+ ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this );
mpWindowImpl->mbHelpTextDynamic = FALSE;
}
}
}
- else if( mpWindowImpl->mbHelpTextDynamic && (nNumHelpId || bStrHelpId) )
+ else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId )
{
static const char* pEnv = getenv( "HELP_DEBUG" );
if( pEnv && *pEnv )
@@ -8170,10 +8149,7 @@ const XubString& Window::GetHelpText() const
rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() );
aTxt.append( mpWindowImpl->maHelpText );
aTxt.appendAscii( "\n------------------\n" );
- if( bStrHelpId )
- aTxt.append( rtl::OUString( aStrHelpId ) );
- else
- aTxt.append( sal_Int32( nNumHelpId ) );
+ aTxt.append( rtl::OUString( aStrHelpId ) );
mpWindowImpl->maHelpText = aTxt.makeStringAndClear();
}
mpWindowImpl->mbHelpTextDynamic = FALSE;
@@ -9408,7 +9384,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
if( bDark )
aSelectionFillCol = COL_BLACK;
else
- nPercent = bRoundEdges ? 90 : 80; // just checked (light)
+ nPercent = 80; // just checked (light)
}
else
{
@@ -9423,7 +9399,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
nPercent = 0;
}
else
- nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark )
+ nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark )
}
else if( bChecked || highlight == 1 )
{
@@ -9436,7 +9412,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
nPercent = 0;
}
else
- nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark )
+ nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark )
}
else
{
@@ -9452,7 +9428,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect,
nPercent = 0;
}
else
- nPercent = bRoundEdges ? 80 : 70; // selected ( dark )
+ nPercent = 70; // selected ( dark )
}
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 02b2713b01cc..e5b58a8b6f3c 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1442,115 +1442,31 @@ Window* Window::ImplGetTopmostFrameWindow()
return pTopmostParent->mpWindowImpl->mpFrameWindow;
}
-// making these Methods out of line to be able to change them lateron without complete rebuild
-// TODO: Set the SmartId in here and remove mpWindowImpl->mnHelpId
-void Window::SetHelpId( ULONG nHelpId )
+void Window::SetHelpId( const rtl::OString& rHelpId )
{
- SetSmartHelpId(SmartId(nHelpId));
+ mpWindowImpl->maHelpId = rHelpId;
}
-ULONG Window::GetHelpId() const
+const rtl::OString& Window::GetHelpId() const
{
- return mpWindowImpl->mnHelpId;
+ return mpWindowImpl->maHelpId;
}
-void Window::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode )
+void Window::SetUniqueId( const rtl::OString& rUniqueId )
{
- // create SmartId if required
- if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) )
- {
- if ( !ImplGetWinData()->mpSmartHelpId )
- ImplGetWinData()->mpSmartHelpId = new SmartId();
- }
-
- // if we have a SmartId (eather from earlier call or just created) fill with new values
- if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId )
- ImplGetWinData()->mpSmartHelpId->UpdateId( aId, aMode );
-
- if ( (aMode == SMART_SET_NUM) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasNumeric() ) )
- {
- mpWindowImpl->mnHelpId = aId.GetNum();
- }
-}
-
-SmartId Window::GetSmartHelpId() const
-{
- if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId )
- {
- if ( mpWindowImpl->mnHelpId || mpWindowImpl->mpWinData->mpSmartHelpId->HasNumeric() )
- mpWindowImpl->mpWinData->mpSmartHelpId->UpdateId( SmartId( mpWindowImpl->mnHelpId ), SMART_SET_NUM );
- return *mpWindowImpl->mpWinData->mpSmartHelpId;
- }
- else
- {
- if ( mpWindowImpl->mnHelpId )
- return SmartId( mpWindowImpl->mnHelpId );
- else
- return SmartId();
- }
-}
-
-
-// making these Methods out of line to be able to change them lateron without complete rebuild
-// TODO: Set the SmartId in here and remove mpWindowImpl->mnUniqId
-void Window::SetUniqueId( ULONG nUniqueId ) { mpWindowImpl->mnUniqId = nUniqueId; }
-ULONG Window::GetUniqueId() const { return mpWindowImpl->mnUniqId; }
-
-
-void Window::SetSmartUniqueId( const SmartId& aId, SmartIdUpdateMode aMode )
-{
- // create SmartId if required
- if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) )
- {
- if ( !ImplGetWinData()->mpSmartUniqueId )
- ImplGetWinData()->mpSmartUniqueId = new SmartId();
- }
-
- // if we have a SmartId (eather from earlier call or just created) fill with new values
- if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId )
- ImplGetWinData()->mpSmartUniqueId->UpdateId( aId, aMode );
-
- if ( (aMode == SMART_SET_NUM) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasNumeric() ) )
- mpWindowImpl->mnUniqId = aId.GetNum();
+ mpWindowImpl->maUniqId = rUniqueId;
}
-SmartId Window::GetSmartUniqueId() const
+const rtl::OString& Window::GetUniqueId() const
{
- if ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId )
- {
- if ( mpWindowImpl->mnUniqId || mpWindowImpl->mpWinData->mpSmartUniqueId->HasNumeric() )
- mpWindowImpl->mpWinData->mpSmartUniqueId->UpdateId( SmartId( mpWindowImpl->mnUniqId ), SMART_SET_NUM );
- return *mpWindowImpl->mpWinData->mpSmartUniqueId;
- }
- else
- {
- if ( mpWindowImpl->mnUniqId )
- return SmartId( mpWindowImpl->mnUniqId );
- else
- return SmartId();
- }
+ return mpWindowImpl->maUniqId;
}
-SmartId Window::GetSmartUniqueOrHelpId() const
+const rtl::OString& Window::GetUniqueOrHelpId() const
{
- if ( ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartHelpId ) || mpWindowImpl->mnHelpId )
- {
- if ( ( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mpSmartUniqueId ) || mpWindowImpl->mnUniqId )
- {
- SmartId aTemp = GetSmartHelpId();
- aTemp.UpdateId( GetSmartUniqueId() );
- return aTemp;
- }
- else
- return GetSmartHelpId();
- }
- else
- return GetSmartUniqueId();
+ return mpWindowImpl->maUniqId.getLength() ? mpWindowImpl->maUniqId : mpWindowImpl->maHelpId;
}
-
-
-
// --------- old inline methods ---------------
Window* Window::ImplGetWindow()
diff --git a/vcl/source/window/window4.cxx b/vcl/source/window/window4.cxx
new file mode 100644
index 000000000000..577a573c2015
--- /dev/null
+++ b/vcl/source/window/window4.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_vcl.hxx"
+
+#include "vcl/window.hxx"
+#include "vcl/window.h"
+#include "vcl/svdata.hxx"
+#include "vcl/arrange.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+
+#include <map>
+#include <vector>
+
+using namespace com::sun::star;
+
+namespace vcl
+{
+ struct ExtWindowImpl
+ {
+ ExtWindowImpl()
+ : mbOwnedByParent( false )
+ {}
+ ~ExtWindowImpl()
+ {}
+
+ boost::shared_ptr< WindowArranger > mxLayout;
+ bool mbOwnedByParent;
+ rtl::OUString maIdentifier;
+ };
+}
+
+void Window::ImplDeleteOwnedChildren()
+{
+ Window* pChild = mpWindowImpl->mpFirstChild;
+ while ( pChild )
+ {
+ Window* pDeleteCandidate = pChild;
+ pChild = pChild->mpWindowImpl->mpNext;
+ vcl::ExtWindowImpl* pDelImpl = pDeleteCandidate->ImplGetExtWindowImpl();
+ if( pDelImpl && pDelImpl->mbOwnedByParent )
+ delete pDeleteCandidate;
+ }
+}
+
+void Window::ImplFreeExtWindowImpl()
+{
+ ImplDeleteOwnedChildren();
+ if( mpWindowImpl )
+ {
+ delete mpWindowImpl->mpExtImpl;
+ mpWindowImpl->mpExtImpl = NULL;
+ }
+}
+
+vcl::ExtWindowImpl* Window::ImplGetExtWindowImpl() const
+{
+ vcl::ExtWindowImpl* pImpl = NULL;
+ if( mpWindowImpl )
+ {
+ if( ! mpWindowImpl->mpExtImpl && ! mpWindowImpl->mbInDtor )
+ mpWindowImpl->mpExtImpl = new vcl::ExtWindowImpl();
+ pImpl = mpWindowImpl->mpExtImpl;
+ }
+ return pImpl;
+}
+
+void Window::ImplExtResize()
+{
+ if( mpWindowImpl && mpWindowImpl->mpExtImpl )
+ {
+ if( mpWindowImpl->mpExtImpl->mxLayout.get() )
+ mpWindowImpl->mpExtImpl->mxLayout->setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ }
+}
+
+boost::shared_ptr< vcl::WindowArranger > Window::getLayout()
+{
+ boost::shared_ptr< vcl::WindowArranger > xRet;
+ vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl();
+ if( pImpl )
+ {
+ if( ! pImpl->mxLayout.get() )
+ {
+ pImpl->mxLayout.reset( new vcl::LabelColumn() );
+ pImpl->mxLayout->setParentWindow( this );
+ pImpl->mxLayout->setOuterBorder( -1 );
+ }
+ xRet = pImpl->mxLayout;
+ }
+
+ return xRet;
+}
+
+void Window::addWindow( Window* i_pWin, bool i_bTakeOwnership )
+{
+ vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl();
+ if( pImpl && i_pWin )
+ {
+ vcl::ExtWindowImpl* pChildImpl = i_pWin->ImplGetExtWindowImpl();
+ if( pChildImpl )
+ {
+ i_pWin->SetParent( this );
+ pChildImpl->mbOwnedByParent = i_bTakeOwnership;
+ }
+ }
+}
+
+Window* Window::removeWindow( Window* i_pWin, Window* i_pNewParent )
+{
+ Window* pRet = NULL;
+ if( i_pWin )
+ {
+ vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl();
+ if( pImpl )
+ {
+ vcl::ExtWindowImpl* pChildImpl = i_pWin->ImplGetExtWindowImpl();
+ if( pChildImpl )
+ {
+ if( ! i_pNewParent )
+ pChildImpl->mbOwnedByParent = false;
+ i_pWin->SetParent( i_pNewParent );
+ pRet = i_pWin;
+ }
+ }
+ }
+ return pRet;
+}
+
+Window* Window::findWindow( const rtl::OUString& i_rIdentifier ) const
+{
+ if( getIdentifier() == i_rIdentifier )
+ return const_cast<Window*>(this);
+
+ Window* pChild = mpWindowImpl->mpFirstChild;
+ while ( pChild )
+ {
+ Window* pResult = pChild->findWindow( i_rIdentifier );
+ if( pResult )
+ return pResult;
+ pChild = pChild->mpWindowImpl->mpNext;
+ }
+
+ return NULL;
+}
+
+const rtl::OUString& Window::getIdentifier() const
+{
+ static rtl::OUString aEmptyStr;
+
+ return (mpWindowImpl && mpWindowImpl->mpExtImpl) ? mpWindowImpl->mpExtImpl->maIdentifier : aEmptyStr;
+}
+
+void Window::setIdentifier( const rtl::OUString& i_rIdentifier )
+{
+ vcl::ExtWindowImpl* pImpl = ImplGetExtWindowImpl();
+ if( pImpl )
+ pImpl->maIdentifier = i_rIdentifier;
+}
+
+void Window::setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps )
+{
+ const beans::PropertyValue* pVals = i_rProps.getConstArray();
+ for( sal_Int32 i = 0; i < i_rProps.getLength(); i++ )
+ {
+ if( pVals[i].Name.equalsAscii( "Enabled" ) )
+ {
+ sal_Bool bVal = sal_True;
+ if( pVals[i].Value >>= bVal )
+ Enable( bVal );
+ }
+ else if( pVals[i].Name.equalsAscii( "Visible" ) )
+ {
+ sal_Bool bVal = sal_True;
+ if( pVals[i].Value >>= bVal )
+ Show( bVal );
+ }
+ else if( pVals[i].Name.equalsAscii( "Text" ) )
+ {
+ rtl::OUString aText;
+ if( pVals[i].Value >>= aText )
+ SetText( aText );
+ }
+ }
+}
+
+uno::Sequence< beans::PropertyValue > Window::getProperties() const
+{
+ uno::Sequence< beans::PropertyValue > aProps( 3 );
+ aProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) );
+ aProps[0].Value = uno::makeAny( sal_Bool( IsEnabled() ) );
+ aProps[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
+ aProps[1].Value = uno::makeAny( sal_Bool( IsVisible() ) );
+ aProps[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
+ aProps[2].Value = uno::makeAny( rtl::OUString( GetText() ) );
+
+ return aProps;
+}
+
diff --git a/vcl/source/window/wpropset.cxx b/vcl/source/window/wpropset.cxx
new file mode 100644
index 000000000000..4aaa3f987b77
--- /dev/null
+++ b/vcl/source/window/wpropset.cxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * 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 "precompiled_vcl.hxx"
+
+#include "vcl/wpropset.hxx"
+#include "vcl/window.hxx"
+#include "vcl/vclevent.hxx"
+#include "vcl/svdata.hxx"
+
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertyContainer.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+
+#include "cppuhelper/basemutex.hxx"
+#include "cppuhelper/compbase1.hxx"
+
+#include <map>
+
+using namespace vcl;
+using namespace com::sun::star;
+
+/*
+
+TODO:
+- release solarmutex during outside UNO calls
+- in ChildEventListener protect against reentry by using PostUserEvent
+
+*/
+
+class vcl::WindowPropertySetListener :
+ public cppu::BaseMutex,
+ public cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >,
+ private boost::noncopyable
+{
+ WindowPropertySet* mpParent;
+ bool mbSuspended;
+public:
+ WindowPropertySetListener( WindowPropertySet* pParent )
+ : cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >( m_aMutex )
+ , mpParent( pParent )
+ , mbSuspended( false )
+ {}
+
+ virtual ~WindowPropertySetListener()
+ {
+ }
+
+ using cppu::WeakComponentImplHelperBase::disposing;
+ virtual void SAL_CALL disposing( const lang::EventObject& ) throw()
+ {
+ }
+
+ virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& i_rEvent ) throw()
+ {
+ if( ! mbSuspended )
+ mpParent->propertyChange( i_rEvent );
+ }
+
+ void suspend( bool i_bSuspended )
+ {
+ mbSuspended = i_bSuspended;
+ }
+};
+
+class vcl::WindowPropertySetData
+{
+public:
+
+ struct PropertyMapEntry
+ {
+ Window* mpWindow;
+ boost::shared_ptr<WindowArranger> mpLayout;
+ uno::Sequence< beans::PropertyValue > maSavedValues;
+
+ PropertyMapEntry( Window* i_pWindow = NULL,
+ const boost::shared_ptr<WindowArranger>& i_pLayout = boost::shared_ptr<WindowArranger>() )
+ : mpWindow( i_pWindow )
+ , mpLayout( i_pLayout )
+ {}
+
+ uno::Sequence< beans::PropertyValue > getProperties() const
+ {
+ if( mpWindow )
+ return mpWindow->getProperties();
+ else if( mpLayout.get() )
+ return mpLayout->getProperties();
+ return uno::Sequence< beans::PropertyValue >();
+ }
+
+ void setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps ) const
+ {
+ if( mpWindow )
+ mpWindow->setProperties( i_rProps );
+ else if( mpLayout.get() )
+ mpLayout->setProperties( i_rProps );
+ }
+ };
+
+ Window* mpTopWindow;
+ bool mbOwner;
+ std::map< rtl::OUString, PropertyMapEntry > maProperties;
+ uno::Reference< beans::XPropertySet > mxPropSet;
+ uno::Reference< beans::XPropertyAccess > mxPropSetAccess;
+ uno::Reference< beans::XPropertyChangeListener > mxListener;
+ vcl::WindowPropertySetListener* mpListener;
+
+ WindowPropertySetData()
+ : mpTopWindow( NULL )
+ , mbOwner( false )
+ , mpListener( NULL )
+ {}
+
+ ~WindowPropertySetData()
+ {
+ // release layouters, possibly interface properties before destroying
+ // the involved parent to be on the safe side
+ maProperties.clear();
+ if( mbOwner )
+ delete mpTopWindow;
+ }
+};
+
+static rtl::OUString getIdentifiedPropertyName( const rtl::OUString& i_rIdentifier, const rtl::OUString& i_rName )
+{
+ rtl::OUStringBuffer aBuf( i_rIdentifier.getLength() + 1 + i_rName.getLength() );
+ aBuf.append( i_rIdentifier );
+ aBuf.append( sal_Unicode( '#' ) );
+ aBuf.append( i_rName );
+ return aBuf.makeStringAndClear();
+}
+
+static void spliceIdentifiedPropertyName( const rtl::OUString& i_rIdentifiedPropName,
+ rtl::OUString& o_rIdentifier,
+ rtl::OUString& o_rPropName )
+{
+ sal_Int32 nIndex = 0;
+ o_rIdentifier = i_rIdentifiedPropName.getToken( 0, sal_Unicode( '#' ), nIndex );
+ if( nIndex != -1 )
+ o_rPropName = i_rIdentifiedPropName.copy( nIndex );
+ else
+ o_rPropName = rtl::OUString();
+}
+
+WindowPropertySet::WindowPropertySet( Window* i_pTopWindow, bool i_bTakeOwnership )
+: mpImpl( new vcl::WindowPropertySetData )
+{
+ mpImpl->mpTopWindow = i_pTopWindow;
+ mpImpl->mbOwner = i_bTakeOwnership;
+
+ mpImpl->mpTopWindow->AddChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) );
+
+ mpImpl->mxPropSet = uno::Reference< beans::XPropertySet >(
+ ImplGetSVData()->maAppData.mxMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertyBag" ) ) ),
+ uno::UNO_QUERY );
+ OSL_ENSURE( mpImpl->mxPropSet.is(), "could not create instance of com.sun.star.beans.PropertyBag" );
+ mpImpl->mxPropSetAccess = uno::Reference< beans::XPropertyAccess >( mpImpl->mxPropSet, uno::UNO_QUERY );
+ OSL_ENSURE( mpImpl->mxPropSet.is(), "could not query XPropertyAccess interface" );
+ if( ! mpImpl->mxPropSetAccess.is() )
+ mpImpl->mxPropSet.clear();
+
+ addWindowToSet( i_pTopWindow );
+
+ setupProperties();
+
+ if( mpImpl->mxPropSet.is() )
+ {
+ mpImpl->mxListener.set( mpImpl->mpListener = new WindowPropertySetListener( this ) );
+ }
+}
+
+WindowPropertySet::~WindowPropertySet()
+{
+ mpImpl->mpTopWindow->RemoveChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) );
+
+ delete mpImpl;
+ mpImpl = NULL;
+}
+
+uno::Reference< beans::XPropertySet > WindowPropertySet::getPropertySet() const
+{
+ return mpImpl->mxPropSet;
+}
+
+void WindowPropertySet::addLayoutToSet( const boost::shared_ptr< WindowArranger >& i_pLayout )
+{
+ if( i_pLayout.get() )
+ {
+ if( i_pLayout->getIdentifier().getLength() )
+ {
+ WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pLayout->getIdentifier() ];
+ OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted layout has duplicate name" );
+ rEntry.mpWindow = NULL;
+ rEntry.mpLayout = i_pLayout;
+ rEntry.maSavedValues = i_pLayout->getProperties();
+ }
+ // insert child layouts
+ size_t nChildren = i_pLayout->countElements();
+ for( size_t i = 0; i < nChildren; i++ )
+ addLayoutToSet( i_pLayout->getChild( i ) );
+ }
+}
+
+void WindowPropertySet::addWindowToSet( Window* i_pWindow )
+{
+ if( i_pWindow->getIdentifier().getLength() ) // no name, no properties
+ {
+ WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pWindow->getIdentifier() ];
+ OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted window has duplicate name" );
+ rEntry.mpWindow = i_pWindow;
+ rEntry.mpLayout.reset();
+ rEntry.maSavedValues = i_pWindow->getProperties();
+ }
+ addLayoutToSet( i_pWindow->getLayout() );
+
+ Window* pWin = i_pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while( pWin )
+ {
+ addWindowToSet( pWin );
+ pWin = pWin->GetWindow( WINDOW_NEXT );
+ }
+}
+
+void WindowPropertySet::setupProperties()
+{
+ uno::Reference< beans::XPropertyContainer > xCont( mpImpl->mxPropSet, uno::UNO_QUERY );
+ OSL_ENSURE( xCont.is(), "could not get XPropertyContainer interface" );
+ if( ! xCont.is() )
+ return;
+
+ for( std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it
+ = mpImpl->maProperties.begin(); it != mpImpl->maProperties.end(); ++it )
+ {
+ uno::Sequence< beans::PropertyValue > aOutsideValues( it->second.maSavedValues );
+ beans::PropertyValue* pVal = aOutsideValues.getArray();
+ for( sal_Int32 i = 0; i < aOutsideValues.getLength(); i++ )
+ {
+ pVal[i].Name = getIdentifiedPropertyName( it->first, pVal[i].Name );
+ xCont->addProperty( pVal[i].Name,
+ beans::PropertyAttribute::BOUND | beans:: PropertyAttribute::CONSTRAINED,
+ pVal[i].Value
+ );
+ }
+ }
+}
+
+void WindowPropertySet::propertyChange( const beans::PropertyChangeEvent& i_rEvent )
+{
+ rtl::OUString aIdentifier, aProperty;
+ spliceIdentifiedPropertyName( i_rEvent.PropertyName, aIdentifier, aProperty );
+ std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it =
+ mpImpl->maProperties.find( aIdentifier );
+ if( it != mpImpl->maProperties.end() )
+ {
+ uno::Sequence< beans::PropertyValue > aSet( 1 );
+ aSet[0].Name = aProperty;
+ aSet[0].Value = i_rEvent.NewValue;
+ it->second.setProperties( aSet );
+ }
+}
+
+IMPL_LINK( vcl::WindowPropertySet, ChildEventListener, VclWindowEvent*, pEvent )
+{
+ // find window in our properties
+ std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it
+ = mpImpl->maProperties.find( pEvent->GetWindow()->getIdentifier() );
+ if( it != mpImpl->maProperties.end() ) // this is valid, some unnamed child may have sent an event
+ {
+ ULONG nId = pEvent->GetId();
+ // check if anything interesting happened
+ if(
+ // general windowy things
+ nId == VCLEVENT_WINDOW_SHOW ||
+ nId == VCLEVENT_WINDOW_HIDE ||
+ nId == VCLEVENT_WINDOW_ENABLED ||
+ nId == VCLEVENT_WINDOW_DISABLED ||
+ // button thingies
+ nId == VCLEVENT_BUTTON_CLICK ||
+ nId == VCLEVENT_PUSHBUTTON_TOGGLE ||
+ nId == VCLEVENT_RADIOBUTTON_TOGGLE ||
+ nId == VCLEVENT_CHECKBOX_TOGGLE ||
+ // listbox
+ nId == VCLEVENT_LISTBOX_SELECT ||
+ // edit
+ nId == VCLEVENT_EDIT_MODIFY
+ )
+ {
+ WindowPropertySetData::PropertyMapEntry& rEntry = it->second;
+ // collect changes
+ uno::Sequence< beans::PropertyValue > aNewProps( rEntry.getProperties() );
+ uno::Sequence< beans::PropertyValue > aNewPropsOut( aNewProps );
+
+ // translate to identified properties
+ beans::PropertyValue* pValues = aNewPropsOut.getArray();
+ for( sal_Int32 i = 0; i < aNewPropsOut.getLength(); i++ )
+ pValues[i].Name = getIdentifiedPropertyName( it->first, pValues[i].Name );
+
+ // broadcast changes
+ bool bWasVeto = false;
+ mpImpl->mpListener->suspend( true );
+ try
+ {
+ mpImpl->mxPropSetAccess->setPropertyValues( aNewPropsOut );
+ }
+ catch( beans::PropertyVetoException& )
+ {
+ bWasVeto = true;
+ }
+ mpImpl->mpListener->suspend( false );
+
+ if( ! bWasVeto ) // changes accepted ?
+ rEntry.maSavedValues = rEntry.getProperties();
+ else // no, reset
+ rEntry.setProperties( rEntry.maSavedValues );
+ }
+ }
+
+ return 0;
+}
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index 51297109ca43..076e36291ae6 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -77,11 +77,10 @@ atk_wrapper_focus_idle_handler (gpointer data)
uno::Reference< accessibility::XAccessible > xAccessible = xNextFocusObject;
if( xAccessible.get() == reinterpret_cast < accessibility::XAccessible * > (data) )
{
+ AtkObject *atk_obj = xAccessible.is() ? atk_object_wrapper_ref( xAccessible ) : NULL;
// Gail does not notify focus changes to NULL, so do we ..
- if( xAccessible.is() )
+ if( atk_obj )
{
- AtkObject *atk_obj = atk_object_wrapper_ref( xAccessible );
-
#ifdef ENABLE_TRACING
fprintf(stderr, "notifying focus event for %p\n", atk_obj);
#endif
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 2679f4a29c02..f308822df147 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -217,11 +217,12 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
{
gint nMonitors = gdk_screen_get_n_monitors(pScreen);
m_aXineramaScreens = std::vector<Rectangle>();
+ m_aXineramaScreenIndexMap = std::vector<int>(nMonitors);
for (gint i = 0; i < nMonitors; ++i)
{
GdkRectangle dest;
gdk_screen_get_monitor_geometry(pScreen, i, &dest);
- addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height );
+ m_aXineramaScreenIndexMap[i] = addXineramaScreenUnique( dest.x, dest.y, dest.width, dest.height );
}
m_bXinerama = m_aXineramaScreens.size() > 1;
if( ! m_aFrames.empty() )
@@ -235,6 +236,26 @@ void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
}
}
+extern "C"
+{
+ typedef gint(* screen_get_primary_monitor)(GdkScreen *screen);
+}
+
+int GtkSalDisplay::GetDefaultMonitorNumber() const
+{
+ int n = 0;
+ GdkScreen* pScreen = gdk_display_get_screen( m_pGdkDisplay, m_nDefaultScreen );
+#if GTK_CHECK_VERSION(2,20,0)
+ n = m_aXineramaScreenIndexMap[gdk_screen_get_primary_monitor(pScreen)];
+#else
+ static screen_get_primary_monitor sym_gdk_screen_get_primary_monitor =
+ (screen_get_primary_monitor)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_screen_get_primary_monitor" );
+ if (sym_gdk_screen_get_primary_monitor)
+ n = m_aXineramaScreenIndexMap[sym_gdk_screen_get_primary_monitor( pScreen )];
+#endif
+ return n;
+}
+
void GtkSalDisplay::initScreen( int nScreen ) const
{
if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
@@ -489,6 +510,7 @@ class GtkXLib : public SalXLib
GSource *m_pUserEvent;
oslMutex m_aDispatchMutex;
oslCondition m_aDispatchCondition;
+ XIOErrorHandler m_aOrigGTKXIOErrorHandler;
public:
static gboolean timeoutFn(gpointer data);
@@ -522,6 +544,7 @@ GtkXLib::GtkXLib()
m_pUserEvent = NULL;
m_aDispatchCondition = osl_createCondition();
m_aDispatchMutex = osl_createMutex();
+ m_aOrigGTKXIOErrorHandler = NULL;
}
GtkXLib::~GtkXLib()
@@ -535,6 +558,9 @@ GtkXLib::~GtkXLib()
osl_setCondition( m_aDispatchCondition );
osl_destroyCondition( m_aDispatchCondition );
osl_destroyMutex( m_aDispatchMutex );
+
+ PopXErrorLevel();
+ XSetIOErrorHandler (m_aOrigGTKXIOErrorHandler);
}
void GtkXLib::Init()
@@ -596,6 +622,10 @@ void GtkXLib::Init()
// init gtk/gdk
gtk_init_check( &nParams, &pCmdLineAry );
+ //gtk_init_check sets XError/XIOError handlers, we want our own one
+ m_aOrigGTKXIOErrorHandler = XSetIOErrorHandler ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
+ PushXErrorLevel( !!getenv( "SAL_IGNOREXERRORS" ) );
+
for (i = 0; i < nParams; i++ )
g_free( pCmdLineAry[i] );
delete [] pCmdLineAry;
@@ -630,9 +660,10 @@ void GtkXLib::Init()
* the clipboard build another connection
* to the xserver using $DISPLAY
*/
- char *pPutEnvIsBroken = g_strdup_printf( "DISPLAY=%s",
- gdk_display_get_name( pGdkDisp ) );
- putenv( pPutEnvIsBroken );
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DISPLAY"));
+ const gchar *name = gdk_display_get_name( pGdkDisp );
+ rtl::OUString envValue(name, strlen(name), aEnc);
+ osl_setEnvironment(envVar.pData, envValue.pData);
Display *pDisp = gdk_x11_display_get_xdisplay( pGdkDisp );
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 68617c8c16be..2cb92ecd8292 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -39,6 +39,8 @@
#include <rtl/strbuf.hxx>
+#include <rtl/uri.hxx>
+
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
#endif
@@ -76,7 +78,7 @@ void GtkHookedYieldMutex::ThreadsLeave()
#if OSL_DEBUG_LEVEL > 1
if( mnThreadId &&
- mnThreadId != NAMESPACE_VOS(OThread)::getCurrentIdentifier())
+ mnThreadId != vos::OThread::getCurrentIdentifier())
fprintf( stderr, "\n\n--- A different thread owns the mutex ...---\n\n\n");
#endif
@@ -216,9 +218,25 @@ extern "C"
void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType)
{
+ rtl::OString sGtkURL;
+ rtl_TextEncoding aSystemEnc = osl_getThreadTextEncoding();
+ if ((aSystemEnc == RTL_TEXTENCODING_UTF8) || (rFileUrl.compareToAscii( "file://", 7 ) != 0))
+ sGtkURL = rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8);
+ else
+ {
+ //Non-utf8 locales are a bad idea if trying to work with non-ascii filenames
+ //Decode %XX components
+ rtl::OUString sDecodedUri = Uri::decode(rFileUrl.copy(7), rtl_UriDecodeToIuri, RTL_TEXTENCODING_UTF8);
+ //Convert back to system locale encoding
+ rtl::OString sSystemUrl = rtl::OUStringToOString(sDecodedUri, aSystemEnc);
+ //Encode to an escaped ASCII-encoded URI
+ gchar *g_uri = g_filename_to_uri(sSystemUrl.getStr(), NULL, NULL);
+ sGtkURL = rtl::OString(g_uri);
+ g_free(g_uri);
+ }
#if GTK_CHECK_VERSION(2,10,0)
GtkRecentManager *manager = gtk_recent_manager_get_default ();
- gtk_recent_manager_add_item (manager, rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr());
+ gtk_recent_manager_add_item (manager, sGtkURL);
(void)rMimeType;
#else
static getDefaultFnc sym_gtk_recent_manager_get_default =
@@ -227,10 +245,7 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r
static addItemFnc sym_gtk_recent_manager_add_item =
(addItemFnc)osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_recent_manager_add_item");
if (sym_gtk_recent_manager_get_default && sym_gtk_recent_manager_add_item)
- {
- sym_gtk_recent_manager_add_item(sym_gtk_recent_manager_get_default(),
- rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8).getStr());
- }
+ sym_gtk_recent_manager_add_item(sym_gtk_recent_manager_get_default(), sGtkURL);
else
X11SalInstance::AddToRecentDocumentList(rFileUrl, rMimeType);
#endif
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 58ab3771213f..318f593ac6a3 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -735,12 +735,6 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
const ImplControlValue& aValue,
const OUString& rCaption )
{
- if( (nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL) &&
- aValue.getTristateVal() == BUTTONVALUE_MIXED )
- {
- return drawNativeMixedStateCheck( nType, nPart, rControlRegion, nState, aValue, rCaption );
- }
-
BOOL returnVal = FALSE;
// get a GC with current clipping region set
SelectFont();
@@ -898,55 +892,6 @@ BOOL GtkSalGraphics::drawNativeControl( ControlType nType,
return( returnVal );
}
-BOOL GtkSalGraphics::drawNativeMixedStateCheck( ControlType nType,
- ControlPart nPart,
- const Rectangle& rControlRegion,
- ControlState nState,
- const ImplControlValue& aValue,
- const OUString& rCaption )
-{
- // need to emulate something for mixed state
-
- // do this via pixmap since some themes don't care for regions
- bool bOldNeedPixmapPaint = bNeedPixmapPaint;
- bNeedPixmapPaint = true;
-
- Rectangle aCtrlRect = rControlRegion;
- BOOL returnVal = FALSE;
- SelectFont();
-
- // draw upper half in off state
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_OFF );
- XLIB_Region aRegion = XCreateRegion();
- XRectangle aXRect = { aCtrlRect.Left(), aCtrlRect.Top(), aCtrlRect.GetWidth(), aCtrlRect.GetHeight() };
- const unsigned short nH = aXRect.height/2;
- aXRect.height -= nH;
- XUnionRectWithRegion( &aXRect, aRegion, aRegion );
- SetClipRegion( pFontGC_, aRegion );
- XDestroyRegion( aRegion );
-
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
-
- if( returnVal )
- {
- // draw lower half in on state
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_ON );
- aXRect.y += nH;
- aRegion = XCreateRegion();
- XUnionRectWithRegion( &aXRect, aRegion, aRegion );
- SetClipRegion( pFontGC_, aRegion );
- XDestroyRegion( aRegion );
- returnVal = drawNativeControl( nType, nPart, rControlRegion, nState, aValue, rCaption );
- }
-
- // clean up
- bNeedPixmapPaint = bOldNeedPixmapPaint;
- const_cast<ImplControlValue&>(aValue).setTristateVal( BUTTONVALUE_MIXED );
- SetClipRegion( pFontGC_ );
- return returnVal;
-}
-
-
/*
* DrawNativeControlText()
*
@@ -1382,7 +1327,8 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
{
GtkStateType stateType;
GtkShadowType shadowType;
- BOOL isChecked = (aValue.getTristateVal()==BUTTONVALUE_ON) ? TRUE : FALSE;
+ bool isChecked = (aValue.getTristateVal() == BUTTONVALUE_ON);
+ bool isInconsistent = (aValue.getTristateVal() == BUTTONVALUE_MIXED);
GdkRectangle clipRect;
gint x,y;
@@ -1397,7 +1343,7 @@ BOOL GtkSalGraphics::NWPaintGTKCheck( GdkDrawable* gdkDrawable,
y = rControlRectangle.Top() + (rControlRectangle.GetHeight()-indicator_size)/2;
// Set the shadow based on if checked or not so we get a checkmark.
- shadowType = isChecked ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+ shadowType = isChecked ? GTK_SHADOW_IN : isInconsistent ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_OUT;
NWSetWidgetState( gWidgetData[m_nScreen].gCheckWidget, nState, stateType );
GTK_TOGGLE_BUTTON(gWidgetData[m_nScreen].gCheckWidget)->active = isChecked;
@@ -2537,7 +2483,6 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
gint g_x=0, g_y=0, g_w=10, g_h=10;
bool bPaintButton = true;
GtkWidget* pButtonWidget = gWidgetData[m_nScreen].gToolbarButtonWidget;
- const gchar* pButtonDetail = "button";
GdkRectangle clipRect;
NWEnsureGTKToolbar( m_nScreen );
@@ -2596,13 +2541,18 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
{
pButtonWidget = gWidgetData[m_nScreen].gToolbarToggleWidget;
shadowType = GTK_SHADOW_IN;
+ stateType = GTK_STATE_ACTIVE;
// special case stateType value for depressed toggle buttons
// cf. gtk+/gtk/gtktogglebutton.c (gtk_toggle_button_update_state)
- if( ! (nState & (CTRL_STATE_PRESSED|CTRL_STATE_ROLLOVER)) )
- stateType = GTK_STATE_ACTIVE;
- pButtonDetail = "togglebutton";
+ if( (nState & (CTRL_STATE_ROLLOVER|CTRL_STATE_PRESSED)) )
+ {
+ stateType = GTK_STATE_PRELIGHT;
+ shadowType = GTK_SHADOW_OUT;
+ }
bPaintButton = true;
}
+ else
+ stateType = GTK_STATE_PRELIGHT; // only for bPaintButton = true, in which case always rollver is meant
NWSetWidgetState( pButtonWidget, nState, stateType );
gtk_widget_ensure_style( pButtonWidget );
@@ -2660,7 +2610,7 @@ BOOL GtkSalGraphics::NWPaintGTKToolbar(
stateType,
shadowType,
&clipRect,
- pButtonWidget, pButtonDetail, x, y, w, h );
+ pButtonWidget, "button", x, y, w, h );
}
}
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index e8b55ebfa895..d04d5c0ce684 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -1353,11 +1353,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
//
// i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused.
// awesome.
- bool bHack =
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz")
- ;
- if( nUserTime == 0 && bHack )
+ if( nUserTime == 0 )
{
/* #i99360# ugly workaround an X11 library bug */
nUserTime= getDisplay()->GetLastUserEventTime( true );
@@ -1365,7 +1361,7 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
}
lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime );
- if( bHack && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
+ if( ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
m_bSetFocusOnMap = true;
gtk_widget_show( m_pWindow );
@@ -1452,6 +1448,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
}
+ if( m_bFullscreen && m_aMaxSize.Width() && m_aMaxSize.Height() )
+ {
+ aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_height = m_aMaxSize.Height();
+ aHints |= GDK_HINT_MAX_SIZE;
+ }
if( aHints )
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL,
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index ca1af87f8862..93ec080d0136 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -86,9 +86,9 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
diff --git a/vcl/unx/headless/svpinst.cxx b/vcl/unx/headless/svpinst.cxx
index 466b56868900..fc788b2a0530 100644
--- a/vcl/unx/headless/svpinst.cxx
+++ b/vcl/unx/headless/svpinst.cxx
@@ -302,7 +302,7 @@ vos::IMutex* SvpSalInstance::GetYieldMutex()
ULONG SvpSalInstance::ReleaseYieldMutex()
{
if ( m_aYieldMutex.GetThreadId() ==
- NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ vos::OThread::getCurrentIdentifier() )
{
ULONG nCount = m_aYieldMutex.GetAcquireCount();
ULONG n = nCount;
@@ -327,6 +327,19 @@ void SvpSalInstance::AcquireYieldMutex( ULONG nCount )
}
}
+bool SvpSalInstance::CheckYieldMutex()
+{
+ bool bRet = true;
+
+ if ( m_aYieldMutex.GetThreadId() !=
+ vos::OThread::getCurrentIdentifier() )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
// first, check for already queued events.
@@ -419,24 +432,6 @@ bool SvpSalInstance::AnyInput( USHORT nType )
return false;
}
-SalMenu* SvpSalInstance::CreateMenu( BOOL )
-{
- return NULL;
-}
-
-void SvpSalInstance::DestroyMenu( SalMenu* )
-{
-}
-
-SalMenuItem* SvpSalInstance::CreateMenuItem( const SalItemParams* )
-{
- return NULL;
-}
-
-void SvpSalInstance::DestroyMenuItem( SalMenuItem* )
-{
-}
-
SalSession* SvpSalInstance::CreateSalSession()
{
return NULL;
@@ -464,13 +459,13 @@ SvpSalYieldMutex::SvpSalYieldMutex()
void SvpSalYieldMutex::acquire()
{
OMutex::acquire();
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
}
void SvpSalYieldMutex::release()
{
- if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ if ( mnThreadId == vos::OThread::getCurrentIdentifier() )
{
if ( mnCount == 1 )
mnThreadId = 0;
@@ -483,7 +478,7 @@ sal_Bool SvpSalYieldMutex::tryToAcquire()
{
if ( OMutex::tryToAcquire() )
{
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
return sal_True;
}
diff --git a/vcl/unx/headless/svpinst.hxx b/vcl/unx/headless/svpinst.hxx
index 284a2d11cd82..02d5e3fa9494 100644
--- a/vcl/unx/headless/svpinst.hxx
+++ b/vcl/unx/headless/svpinst.hxx
@@ -46,11 +46,11 @@
// SalYieldMutex
// -------------------------------------------------------------------------
-class SvpSalYieldMutex : public NAMESPACE_VOS(OMutex)
+class SvpSalYieldMutex : public vos::OMutex
{
protected:
ULONG mnCount;
- NAMESPACE_VOS(OThread)::TThreadIdentifier mnThreadId;
+ vos::OThread::TThreadIdentifier mnThreadId;
public:
SvpSalYieldMutex();
@@ -60,7 +60,7 @@ public:
virtual sal_Bool tryToAcquire();
ULONG GetAcquireCount() const { return mnCount; }
- NAMESPACE_VOS(OThread)::TThreadIdentifier GetThreadId() const { return mnThreadId; }
+ vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; }
};
// ---------------
@@ -176,6 +176,7 @@ public:
virtual vos::IMutex* GetYieldMutex();
virtual ULONG ReleaseYieldMutex();
virtual void AcquireYieldMutex( ULONG nCount );
+ virtual bool CheckYieldMutex();
// wait next event and dispatch
// must returned by UserEvent (SalFrame::PostEvent)
@@ -183,12 +184,6 @@ public:
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual bool AnyInput( USHORT nType );
- // Menues
- virtual SalMenu* CreateMenu( BOOL bMenuBar );
- virtual void DestroyMenu( SalMenu* pMenu);
- virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
- virtual void DestroyMenuItem( SalMenuItem* pItem );
-
// may return NULL to disable session management
virtual SalSession* CreateSalSession();
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 6da09b38023c..c7b1f4f41fca 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -683,16 +683,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
DrawPrinterLayout( rLayout, *m_pPrinterGfx, true );
}
-ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
{
- // TODO: get ImplFontCharMap directly from fonts
if( !m_pServerFont[0] )
return NULL;
- CmapResult aCmapResult;
- if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) )
- return NULL;
- return new ImplFontCharMap( aCmapResult );
+ const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap();
+ return pIFCMap;
}
USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel )
@@ -792,7 +789,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
}
}
-void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
{
const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
psp::PrintFontInfo aInfo;
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 063dff34c3c2..138198239621 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -105,9 +105,9 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
diff --git a/vcl/unx/headless/svptext.cxx b/vcl/unx/headless/svptext.cxx
index ecb8b11b7e04..dff1fd4d6ca7 100644
--- a/vcl/unx/headless/svptext.cxx
+++ b/vcl/unx/headless/svptext.cxx
@@ -240,12 +240,15 @@ USHORT SvpSalGraphics::SetFont( ImplFontSelectData* pIFSD, int nFallbackLevel )
// ---------------------------------------------------------------------------
-void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void SvpSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
{
- if( m_pServerFont[0] != NULL )
+ if( nFallbackLevel >= MAX_FALLBACK )
+ return;
+
+ if( m_pServerFont[nFallbackLevel] != NULL )
{
long rDummyFactor;
- m_pServerFont[0]->FetchFontMetric( *pMetric, rDummyFactor );
+ m_pServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor );
}
}
@@ -269,15 +272,13 @@ ULONG SvpSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs )
// ---------------------------------------------------------------------------
-ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* SvpSalGraphics::GetImplFontCharMap() const
{
if( !m_pServerFont[0] )
return NULL;
- CmapResult aCmapResult;
- if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) )
- return NULL;
- return new ImplFontCharMap( aCmapResult );
+ const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap();
+ return pIFCMap;
}
// ---------------------------------------------------------------------------
diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx
index d4dec957a6b3..b650cffbae8b 100644
--- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx
@@ -59,6 +59,8 @@ class GtkSalDisplay : public SalDisplay
GdkDisplay* m_pGdkDisplay;
GdkCursor *m_aCursors[ POINTER_COUNT ];
bool m_bStartupCompleted;
+ std::vector< int > m_aXineramaScreenIndexMap;
+
GdkCursor* getFromXPM( const char *pBitmap, const char *pMask,
int nWidth, int nHeight, int nXHot, int nYHot );
public:
@@ -73,6 +75,8 @@ public:
virtual long Dispatch( XEvent *pEvent );
virtual void initScreen( int nScreen ) const;
+ virtual int GetDefaultMonitorNumber() const;
+
static GdkFilterReturn filterGdkEvent( GdkXEvent* sys_event,
GdkEvent* event,
gpointer data );
diff --git a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
index 7544a566d8ae..38c79b3e11df 100644
--- a/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkgdi.hxx
@@ -178,10 +178,6 @@ protected:
const clipList& rClipList,
ControlState nState, const ImplControlValue& aValue,
const OUString& rCaption );
-
- BOOL drawNativeMixedStateCheck( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
- ControlState nState, const ImplControlValue& aValue,
- const rtl::OUString& rCaption );
};
#endif // _VCL_GTKGDI_HXX
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 4b1ac12116a3..d4f5a9f156e0 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -102,9 +102,9 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* );
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
index 7e38e0a89bf2..939437060750 100644
--- a/vcl/unx/inc/saldata.hxx
+++ b/vcl/unx/inc/saldata.hxx
@@ -63,6 +63,7 @@ protected:
SalDisplay *m_pSalDisplay;
pthread_t hMainThread_;
rtl::OUString maLocalHostName;
+ rtl::OUString maUnicodeAccumulator;
public:
X11SalData();
@@ -90,6 +91,7 @@ public:
const rtl::OUString& GetLocalHostName() const
{ return maLocalHostName; }
+ rtl::OUString& GetUnicodeAccumulator() { return maUnicodeAccumulator; }
static int XErrorHdl( Display*, XErrorEvent* );
static int XIOErrorHdl( Display* );
diff --git a/vcl/unx/inc/saldisp.hxx b/vcl/unx/inc/saldisp.hxx
index 3734cbec6ef7..99c9bea699d6 100644
--- a/vcl/unx/inc/saldisp.hxx
+++ b/vcl/unx/inc/saldisp.hxx
@@ -405,7 +405,7 @@ protected:
int processRandREvent( XEvent* );
void doDestruct();
- void addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight );
+ int addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight );
public:
static SalDisplay *GetSalDisplay( Display* display );
static BOOL BestVisual( Display *pDisp,
@@ -475,6 +475,7 @@ public:
XLIB_Window GetDrawable( int nScreen ) const { return getDataForScreen( nScreen ).m_aRefWindow; }
Display *GetDisplay() const { return pDisp_; }
int GetDefaultScreenNumber() const { return m_nDefaultScreen; }
+ virtual int GetDefaultMonitorNumber() const { return 0; }
const Size& GetScreenSize( int nScreen ) const { return getDataForScreen( nScreen ).m_aSize; }
srv_vendor_t GetServerVendor() const { return meServerVendor; }
void SetServerVendor() { meServerVendor = sal_GetServerVendor(pDisp_); }
diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h
index ed173e61fe61..9786bac76f35 100644
--- a/vcl/unx/inc/salframe.h
+++ b/vcl/unx/inc/salframe.h
@@ -208,6 +208,10 @@ public:
bool isMapped() const { return bMapped_; }
bool hasFocus() const { return mbInputFocus; }
+ void beginUnicodeSequence();
+ bool appendUnicodeSequence( sal_Unicode );
+ bool endUnicodeSequence();
+
virtual SalGraphics* GetGraphics();
virtual void ReleaseGraphics( SalGraphics* pGraphics );
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index 42d9c5592317..b5fdce50eee9 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -253,9 +253,9 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
virtual ULONG GetKernPairs( ULONG nMaxPairs, ImplKernPairData* );
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
virtual void GetDevFontSubstList( OutputDevice* );
virtual bool AddTempDevFont( ImplDevFontList*, const String& rFileURL, const String& rFontName );
diff --git a/vcl/unx/inc/salinst.h b/vcl/unx/inc/salinst.h
index d73d67f81425..133f0bf6037f 100644
--- a/vcl/unx/inc/salinst.h
+++ b/vcl/unx/inc/salinst.h
@@ -39,11 +39,11 @@
#include <vcl/dllapi.h>
#include <vcl/salinst.hxx>
-class VCL_DLLPUBLIC SalYieldMutex : public NAMESPACE_VOS(OMutex)
+class VCL_DLLPUBLIC SalYieldMutex : public vos::OMutex
{
protected:
ULONG mnCount;
- NAMESPACE_VOS(OThread)::TThreadIdentifier mnThreadId;
+ vos::OThread::TThreadIdentifier mnThreadId;
public:
SalYieldMutex();
@@ -53,7 +53,7 @@ public:
virtual sal_Bool tryToAcquire();
ULONG GetAcquireCount() const { return mnCount; }
- NAMESPACE_VOS(OThread)::TThreadIdentifier GetThreadId() const { return mnThreadId; }
+ vos::OThread::TThreadIdentifier GetThreadId() const { return mnThreadId; }
};
// -=-= SalInstanceData =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -102,13 +102,10 @@ public:
virtual vos::IMutex* GetYieldMutex();
virtual ULONG ReleaseYieldMutex();
virtual void AcquireYieldMutex( ULONG nCount );
+ virtual bool CheckYieldMutex();
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual bool AnyInput( USHORT nType );
- virtual SalMenu* CreateMenu( BOOL bMenuBar );
- virtual void DestroyMenu( SalMenu* pMenu);
- virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
- virtual void DestroyMenuItem( SalMenuItem* pItem );
virtual void* GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes );
void FillFontPathList( std::list< rtl::OString >& o_rFontPaths );
diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h
index fa68f1b38e73..6e6ca0a2f1cc 100644
--- a/vcl/unx/inc/salprn.h
+++ b/vcl/unx/inc/salprn.h
@@ -71,6 +71,7 @@ public:
bool m_bFax:1;
bool m_bPdf:1;
bool m_bSwallowFaxNo:1;
+ bool m_bIsPDFWriterJob:1;
PspGraphics* m_pGraphics;
psp::PrinterJob m_aPrintJob;
psp::JobData m_aJobData;
@@ -91,6 +92,11 @@ public:
bool bCollate,
bool bDirect,
ImplJobSetup* pSetupData );
+ virtual BOOL StartJob( const String*,
+ const String&,
+ const String&,
+ ImplJobSetup*,
+ vcl::PrinterController& i_rController );
virtual BOOL EndJob();
virtual BOOL AbortJob();
virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, BOOL bNewJobData );
diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx
index cbedede2cc99..e8620db29c6f 100644
--- a/vcl/unx/inc/wmadaptor.hxx
+++ b/vcl/unx/inc/wmadaptor.hxx
@@ -165,6 +165,8 @@ protected:
bool m_bLegacyPartialFullscreen;
int m_nWinGravity;
int m_nInitWinGravity;
+ bool m_bWMshouldSwitchWorkspace;
+ bool m_bWMshouldSwitchWorkspaceInit;
WMAdaptor( SalDisplay * )
;
@@ -177,6 +179,7 @@ protected:
*/
virtual bool isValid() const;
+ bool getWMshouldSwitchWorkspace() const;
public:
virtual ~WMAdaptor();
@@ -214,8 +217,9 @@ public:
/*
* attemp to switch the desktop to a certain workarea
+ * if bConsiderWM is true, then on some WMs the call will not result in any action
*/
- void switchToWorkArea( int nWorkArea ) const;
+ void switchToWorkArea( int nWorkArea, bool bConsiderWM = true ) const;
/*
* sets window title
diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx
index 9f1ffee3d1c4..c797da34e76c 100644
--- a/vcl/unx/source/app/i18n_im.cxx
+++ b/vcl/unx/source/app/i18n_im.cxx
@@ -36,10 +36,6 @@
# endif
#endif
#include <poll.h>
-#ifdef SOLARIS
-// for SetSystemEnvironment()
-#include <sal/alloca.h>
-#endif
#include <tools/prex.h>
#include <X11/Xlocale.h>
@@ -53,6 +49,7 @@
#include <i18n_status.hxx>
#include <osl/thread.h>
+#include <osl/process.h>
using namespace vcl;
#include "i18n_cb.hxx"
@@ -179,21 +176,13 @@ SetSystemLocale( const char* p_inlocale )
#ifdef SOLARIS
static void
-SetSystemEnvironment( const char* p_locale )
+SetSystemEnvironment( const rtl::OUString& rLocale )
{
- const char *lc_all = "LC_ALL=%s";
- const char *lang = "LANG=%s";
-
- char *p_buffer;
+ rtl::OUString LC_ALL_Var(RTL_CONSTASCII_USTRINGPARAM("LC_ALL"));
+ osl_setEnvironment(LC_ALL_Var.pData, rLocale.pData);
- if (p_locale != NULL)
- {
- p_buffer = (char*)alloca(10 + strlen(p_locale));
- sprintf(p_buffer, lc_all, p_locale);
- putenv(strdup(p_buffer));
- sprintf(p_buffer, lang, p_locale);
- putenv(strdup(p_buffer));
- }
+ rtl::OUString LANG_Var(RTL_CONSTASCII_USTRINGPARAM("LANG"));
+ osl_setEnvironment(LANG_Var.pData, rLocale.pData);
}
#endif
@@ -249,13 +238,13 @@ SalI18N_InputMethod::SetLocale( const char* pLocale )
osl_setThreadTextEncoding (RTL_TEXTENCODING_ISO_8859_1);
locale = SetSystemLocale( "en_US" );
#ifdef SOLARIS
- SetSystemEnvironment( "en_US" );
+ SetSystemEnvironment( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en_US")) );
#endif
if (! IsXWindowCompatibleLocale(locale))
{
locale = SetSystemLocale( "C" );
#ifdef SOLARIS
- SetSystemEnvironment( "C" );
+ SetSystemEnvironment( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("C")) );
#endif
if (! IsXWindowCompatibleLocale(locale))
mbUseable = False;
@@ -440,7 +429,8 @@ SalI18N_InputMethod::CreateMethod ( Display *pDisplay )
if ((maMethod == (XIM)NULL) && (getenv("XMODIFIERS") != NULL))
{
- putenv (strdup("XMODIFIERS"));
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("XMODIFIERS"));
+ osl_clearEnvironment(envVar.pData);
XSetLocaleModifiers("");
maMethod = XOpenIM(pDisplay, NULL, NULL, NULL);
mbMultiLingual = False;
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
index 50ef71df8619..beb7b60a551c 100644
--- a/vcl/unx/source/app/saldata.cxx
+++ b/vcl/unx/source/app/saldata.cxx
@@ -425,10 +425,8 @@ void SalXLib::Init()
* the clipboard build another connection
* to the xserver using $DISPLAY
*/
- const char envpre[] = "DISPLAY=";
- char *envstr = new char[sizeof(envpre)+aDisplay.getLength()];
- snprintf(envstr, sizeof(envpre)+aDisplay.getLength(), "DISPLAY=%s", aDisplay.getStr());
- putenv(envstr);
+ rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DISPLAY"));
+ osl_setEnvironment(envVar.pData, aParam.pData);
}
break;
}
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 13a0d1093c8e..354c4d433d42 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -2255,7 +2255,7 @@ void SalX11Display::Yield()
XEvent aEvent;
DBG_ASSERT( static_cast<SalYieldMutex*>(GetSalData()->m_pInstance->GetYieldMutex())->GetThreadId() ==
- NAMESPACE_VOS(OThread)::getCurrentIdentifier(),
+ vos::OThread::getCurrentIdentifier(),
"will crash soon since solar mutex not locked in SalDisplay::Yield" );
XNextEvent( pDisp_, &aEvent );
@@ -2592,7 +2592,7 @@ void SalDisplay::PrintInfo() const
sal::static_int_cast< unsigned int >(GetVisual(m_nDefaultScreen).GetVisualId()) );
}
-void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight )
+int SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, long i_nHeight )
{
// see if any frame buffers are at the same coordinates
// this can happen with weird configuration e.g. on
@@ -2608,10 +2608,11 @@ void SalDisplay::addXineramaScreenUnique( long i_nX, long i_nY, long i_nWidth, l
{
m_aXineramaScreens[n].SetSize( Size( i_nWidth, i_nHeight ) );
}
- return;
+ return (int)n;
}
}
m_aXineramaScreens.push_back( Rectangle( Point( i_nX, i_nY ), Size( i_nWidth, i_nHeight ) ) );
+ return (int)m_aXineramaScreens.size()-1;
}
void SalDisplay::InitXinerama()
diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx
index 8a8db44cefcd..88af0b70ef7e 100644
--- a/vcl/unx/source/app/salinst.cxx
+++ b/vcl/unx/source/app/salinst.cxx
@@ -66,13 +66,13 @@ SalYieldMutex::SalYieldMutex()
void SalYieldMutex::acquire()
{
OMutex::acquire();
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
}
void SalYieldMutex::release()
{
- if ( mnThreadId == NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ if ( mnThreadId == vos::OThread::getCurrentIdentifier() )
{
if ( mnCount == 1 )
mnThreadId = 0;
@@ -85,7 +85,7 @@ sal_Bool SalYieldMutex::tryToAcquire()
{
if ( OMutex::tryToAcquire() )
{
- mnThreadId = NAMESPACE_VOS(OThread)::getCurrentIdentifier();
+ mnThreadId = vos::OThread::getCurrentIdentifier();
mnCount++;
return True;
}
@@ -231,7 +231,7 @@ ULONG X11SalInstance::ReleaseYieldMutex()
{
SalYieldMutex* pYieldMutex = mpSalYieldMutex;
if ( pYieldMutex->GetThreadId() ==
- NAMESPACE_VOS(OThread)::getCurrentIdentifier() )
+ vos::OThread::getCurrentIdentifier() )
{
ULONG nCount = pYieldMutex->GetAcquireCount();
ULONG n = nCount;
@@ -259,6 +259,24 @@ void X11SalInstance::AcquireYieldMutex( ULONG nCount )
}
}
+// -----------------------------------------------------------------------
+
+bool X11SalInstance::CheckYieldMutex()
+{
+ bool bRet = true;
+
+ SalYieldMutex* pYieldMutex = mpSalYieldMutex;
+ if ( pYieldMutex->GetThreadId() !=
+ vos::OThread::getCurrentIdentifier() )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
void X11SalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
{ GetX11SalData()->GetLib()->Yield( bWait, bHandleAllCurrentEvents ); }
diff --git a/vcl/unx/source/app/salsys.cxx b/vcl/unx/source/app/salsys.cxx
index 1ccb214df4ed..84c9dba32e40 100644
--- a/vcl/unx/source/app/salsys.cxx
+++ b/vcl/unx/source/app/salsys.cxx
@@ -71,7 +71,7 @@ bool X11SalSystem::IsMultiDisplay()
unsigned int X11SalSystem::GetDefaultDisplayNumber()
{
SalDisplay* pSalDisp = GetX11SalData()->GetDisplay();
- return pSalDisp->GetDefaultScreenNumber();
+ return pSalDisp->IsXinerama() ? pSalDisp->GetDefaultMonitorNumber() : pSalDisp->GetDefaultScreenNumber();
}
Rectangle X11SalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen )
diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index aa2e4c84ef24..f816c5d1426e 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -31,21 +31,22 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sal/alloca.h>
-#include <wmadaptor.hxx>
-#include <saldisp.hxx>
-#include <saldata.hxx>
-#include <salframe.h>
-#include <vcl/salgdi.hxx>
-#include <osl/thread.h>
-#include <rtl/locale.h>
-#include <osl/process.h>
-
-#include <tools/prex.h>
+#include "sal/alloca.h"
+#include "wmadaptor.hxx"
+#include "saldisp.hxx"
+#include "saldata.hxx"
+#include "salframe.h"
+#include "vcl/salgdi.hxx"
+#include "osl/thread.h"
+#include "rtl/locale.h"
+#include "osl/process.h"
+#include "vcl/configsettings.hxx"
+
+#include "tools/prex.h"
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xresource.h>
-#include <tools/postx.h>
+#include "tools/postx.h"
#if OSL_DEBUG_LEVEL > 1
#include <stdio.h>
@@ -238,7 +239,9 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
m_bEnableAlwaysOnTopWorks( false ),
m_bLegacyPartialFullscreen( false ),
m_nWinGravity( StaticGravity ),
- m_nInitWinGravity( StaticGravity )
+ m_nInitWinGravity( StaticGravity ),
+ m_bWMshouldSwitchWorkspace( true ),
+ m_bWMshouldSwitchWorkspaceInit( false )
{
Atom aRealType = None;
int nFormat = 8;
@@ -965,6 +968,30 @@ bool WMAdaptor::getNetWmName()
return bNetWM;
}
+bool WMAdaptor::getWMshouldSwitchWorkspace() const
+{
+ if( ! m_bWMshouldSwitchWorkspaceInit )
+ {
+ WMAdaptor * pWMA = const_cast<WMAdaptor*>(this);
+
+ pWMA->m_bWMshouldSwitchWorkspace = true;
+ vcl::SettingsConfigItem* pItem = vcl::SettingsConfigItem::get();
+ rtl::OUString aSetting( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WM" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShouldSwitchWorkspace" ) ) ) );
+ if( aSetting.getLength() == 0 )
+ {
+ if( m_aWMName.EqualsAscii( "awesome" ) )
+ {
+ pWMA->m_bWMshouldSwitchWorkspace = false;
+ }
+ }
+ else
+ pWMA->m_bWMshouldSwitchWorkspace = aSetting.toBoolean();
+ pWMA->m_bWMshouldSwitchWorkspaceInit = true;
+ }
+ return m_bWMshouldSwitchWorkspace;
+}
+
/*
* WMAdaptor::isValid()
*/
@@ -2338,8 +2365,11 @@ int WMAdaptor::getWindowWorkArea( XLIB_Window aWindow ) const
* WMAdaptor::getCurrentWorkArea
*/
// fixme: multi screen case
-void WMAdaptor::switchToWorkArea( int nWorkArea ) const
+void WMAdaptor::switchToWorkArea( int nWorkArea, bool bConsiderWM ) const
{
+ if( bConsiderWM && ! getWMshouldSwitchWorkspace() )
+ return;
+
if( m_aWMAtoms[ NET_CURRENT_DESKTOP ] )
{
XEvent aEvent;
diff --git a/vcl/unx/source/fontmanager/fontcache.cxx b/vcl/unx/source/fontmanager/fontcache.cxx
index db4a7d05e5fc..0c43373bfa8e 100644
--- a/vcl/unx/source/fontmanager/fontcache.cxx
+++ b/vcl/unx/source/fontmanager/fontcache.cxx
@@ -373,9 +373,9 @@ void FontCache::read()
xub_StrLen nLastIndex = nIndex+1;
for( nIndex = nLastIndex ; nIndex < nLen && pLine[nIndex] != ';'; nIndex++ )
;
- if( nIndex - nLastIndex > 1 )
+ if( nIndex - nLastIndex )
{
- OUString aAlias( pLine+nLastIndex, nIndex-nLastIndex-1, RTL_TEXTENCODING_UTF8 );
+ OUString aAlias( pLine+nLastIndex, nIndex-nLastIndex, RTL_TEXTENCODING_UTF8 );
pFont->m_aAliases.push_back( pAtoms->getAtom( ATOM_FAMILYNAME, aAlias, sal_True ) );
}
}
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 5b18ec002aa9..434263db352e 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -121,16 +121,20 @@ class FontCfgWrapper
FcResult (*m_pFcPatternGetBool)(const FcPattern*,const char*,int,FcBool*);
void (*m_pFcDefaultSubstitute)(FcPattern *);
FcPattern* (*m_pFcFontSetMatch)(FcConfig*,FcFontSet**, int, FcPattern*,FcResult*);
+ FcPattern* (*m_pFcFontMatch)(FcConfig*,FcPattern*,FcResult*);
FcBool (*m_pFcConfigAppFontAddFile)(FcConfig*, const FcChar8*);
FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
FcBool (*m_pFcConfigParseAndLoad)(FcConfig*,const FcChar8*,FcBool);
-
FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
+
+ FcPattern* (*m_pFcPatternDuplicate)(const FcPattern*);
FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
+ FcBool (*m_pFcPatternDel)(FcPattern*,const char*);
+
FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32);
oslGenericFunction loadSymbol( const char* );
@@ -230,8 +234,13 @@ public:
{ m_pFcDefaultSubstitute( pPattern ); }
FcPattern* FcFontSetMatch( FcConfig* pConfig, FcFontSet **ppFontSet, int nset, FcPattern* pPattern, FcResult* pResult )
{ return m_pFcFontSetMatch ? m_pFcFontSetMatch( pConfig, ppFontSet, nset, pPattern, pResult ) : 0; }
+ FcPattern* FcFontMatch( FcConfig* pConfig, FcPattern* pPattern, FcResult* pResult )
+ { return m_pFcFontMatch( pConfig, pPattern, pResult ); }
FcBool FcConfigSubstitute( FcConfig* pConfig, FcPattern* pPattern, FcMatchKind eKind )
{ return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); }
+
+ FcPattern* FcPatternDuplicate( const FcPattern* pPattern ) const
+ { return m_pFcPatternDuplicate( pPattern ); }
FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue )
{ return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue )
@@ -242,6 +251,8 @@ public:
{ return m_pFcPatternAddBool( pPattern, pObject, nValue ); }
FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet)
{ return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); }
+ FcBool FcPatternDel(FcPattern* pPattern, const char* object)
+ { return m_pFcPatternDel( pPattern, object); }
FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 )
{ return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
@@ -337,8 +348,13 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcDefaultSubstitute" );
m_pFcFontSetMatch = (FcPattern*(*)(FcConfig*,FcFontSet**,int,FcPattern*,FcResult*))
loadSymbol( "FcFontSetMatch" );
+ m_pFcFontMatch = (FcPattern*(*)(FcConfig*,FcPattern*,FcResult*))
+ loadSymbol( "FcFontMatch" );
m_pFcConfigSubstitute = (FcBool(*)(FcConfig*,FcPattern*,FcMatchKind))
loadSymbol( "FcConfigSubstitute" );
+
+ m_pFcPatternDuplicate = (FcPattern*(*)(const FcPattern*))
+ loadSymbol( "FcPatternDuplicate" );
m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
loadSymbol( "FcPatternAddInteger" );
m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double))
@@ -349,6 +365,9 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcPatternAddCharSet" );
m_pFcPatternAddString = (FcBool(*)(FcPattern*,const char*,const FcChar8*))
loadSymbol( "FcPatternAddString" );
+ m_pFcPatternDel = (FcBool(*)(FcPattern*,const char*))
+ loadSymbol( "FcPatternDel" );
+
m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
loadSymbol( "FcFreeTypeCharIndex" );
@@ -391,13 +410,16 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcConfigAppFontAddFile &&
m_pFcConfigAppFontAddDir &&
m_pFcConfigParseAndLoad &&
+ m_pFcFontMatch &&
m_pFcDefaultSubstitute &&
m_pFcConfigSubstitute &&
+ m_pFcPatternDuplicate &&
m_pFcPatternAddInteger &&
m_pFcPatternAddDouble &&
m_pFcPatternAddCharSet &&
m_pFcPatternAddBool &&
- m_pFcPatternAddString
+ m_pFcPatternAddString &&
+ m_pFcPatternDel
) )
{
osl_unloadModule( (oslModule)m_pLib );
@@ -428,18 +450,44 @@ void FontCfgWrapper::addFontSet( FcSetName eSetName )
if( !pOrig )
return;
+ // filter the font sets to remove obsolete or duplicate faces
for( int i = 0; i < pOrig->nfont; ++i )
{
- FcBool outline = false;
- FcPattern *pOutlinePattern = pOrig->fonts[i];
- FcResult eOutRes =
- FcPatternGetBool( pOutlinePattern, FC_OUTLINE, 0, &outline );
- if( (eOutRes != FcResultMatch) || (outline != FcTrue) )
+ FcPattern* pOrigPattern = pOrig->fonts[i];
+ // #i115131# ignore non-outline fonts
+ FcBool bOutline = FcFalse;
+ FcResult eOutRes = FcPatternGetBool( pOrigPattern, FC_OUTLINE, 0, &bOutline );
+ if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
continue;
- FcPatternReference(pOutlinePattern);
- FcFontSetAdd(m_pOutlineSet, pOutlinePattern);
+ // create a pattern to find eventually better alternatives
+ FcPattern* pBetterPattern = pOrigPattern;
+ if( m_nFcVersion > 20400 ) // #i115204# avoid trouble with old FC versions
+ {
+ FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern );
+ FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue );
+ // TODO: ignore all attributes that are not interesting for finding dupes
+ // e.g. by using pattern->ImplFontAttr->pattern conversion
+ FcPatternDel( pTestPattern, FC_FONTVERSION );
+ FcPatternDel( pTestPattern, FC_CHARSET );
+ FcPatternDel( pTestPattern, FC_FILE );
+ // find the font face for the dupe-search pattern
+ FcResult eFcResult = FcResultMatch;
+ pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult );
+ FcPatternDestroy( pTestPattern );
+ if( eFcResult != FcResultMatch )
+ continue;
+ // #i115131# double check results and eventually ignore them
+ eOutRes = FcPatternGetBool( pBetterPattern, FC_OUTLINE, 0, &bOutline );
+ if( (eOutRes != FcResultMatch) || (bOutline == FcFalse) )
+ continue;
+ }
+ // insert best found pattern for the dupe-search pattern
+ // TODO: skip inserting patterns that are already known in the target fontset
+ FcPatternReference( pBetterPattern );
+ FcFontSetAdd( m_pOutlineSet, pBetterPattern );
}
- // TODO: FcFontSetDestroy( pOrig );
+
+ // TODO?: FcFontSetDestroy( pOrig );
#else
(void)eSetName; // prevent compiler warning about unused parameter
#endif
@@ -708,7 +756,7 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
);
#endif
- OSL_ASSERT(eOutRes != FcResultMatch || outline);
+// OSL_ASSERT(eOutRes != FcResultMatch || outline);
// only outline fonts are usable to psprint anyway
if( eOutRes == FcResultMatch && ! outline )
@@ -738,7 +786,10 @@ int PrintFontManager::countFontconfigFonts( std::hash_map<rtl::OString, int, rtl
#endif
}
if( aFonts.empty() )
+ {
+ // TODO: remove fonts unusable to psprint from fontset
continue;
+ }
int nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME, OStringToOUString( OString( (sal_Char*)family ), RTL_TEXTENCODING_UTF8 ), sal_True );
PrintFont* pUpdate = aFonts.front();
@@ -1068,6 +1119,7 @@ bool PrintFontManager::getFontOptions(
ImplFontOptions& rOptions) const
{
#ifndef ENABLE_FONTCONFIG
+ (void)rInfo;(void)nSize;(void)subcallback;(void)rOptions;
return false;
#else // ENABLE_FONTCONFIG
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index feffdc1adbb6..bab78b0cb2df 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -775,16 +775,13 @@ void PspGraphics::DrawServerFontLayout( const ServerFontLayout& rLayout )
DrawPrinterLayout( rLayout, *m_pPrinterGfx, true );
}
-ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* PspGraphics::GetImplFontCharMap() const
{
- // TODO: get ImplFontCharMap directly from fonts
if( !m_pServerFont[0] )
return NULL;
- CmapResult aCmapResult;
- if( !m_pServerFont[0]->GetFontCodeRanges( aCmapResult ) )
- return NULL;
- return new ImplFontCharMap( aCmapResult );
+ const ImplFontCharMap* pIFCMap = m_pServerFont[0]->GetImplFontCharMap();
+ return pIFCMap;
}
USHORT PspGraphics::SetFont( ImplFontSelectData *pEntry, int nFallbackLevel )
@@ -890,7 +887,7 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
}
}
-void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
{
const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
psp::PrintFontInfo aInfo;
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index c0658c162489..9215f2e25b16 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -1240,14 +1240,17 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, double
basegfx::tools::createLineTrapezoidFromB2DPolygon( aB2DTrapVector, aPolygon, rLineWidth.getX() );
// draw tesselation result
- const int nTrapCount = aB2DTrapVector.size();
- if( !nTrapCount )
- return true;
- const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
+ if( ! aB2DTrapVector.empty() )
+ {
+ const int nTrapCount = aB2DTrapVector.size();
+ const bool bDrawOk = drawFilledTrapezoids( &aB2DTrapVector[0], nTrapCount, fTransparency );
- // restore the original brush GC
- nBrushColor_ = aKeepBrushColor;
- return bDrawOk;
+ // restore the original brush GC
+ nBrushColor_ = aKeepBrushColor;
+ return bDrawOk;
+ }
+ else
+ return true;
}
// get the area polygon for the line polygon
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 6024b66f6010..62e575ebc5ef 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -1494,20 +1494,13 @@ void X11SalGraphics::DrawStringUCS2MB( ExtendedFontStruct& rFont,
//--------------------------------------------------------------------------
-ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* X11SalGraphics::GetImplFontCharMap() const
{
- // TODO: get ImplFontCharMap directly from fonts
if( !mpServerFont[0] )
-#if 0 // RIP XLFD fonts
- if( mXFont[0] )
- // TODO?: nPairCount = mXFont[0]->GetFontCodeRanges( NULL );
-#endif
return NULL;
- CmapResult aCmapResult;
- if( !mpServerFont[0]->GetFontCodeRanges( aCmapResult ) )
- return NULL;
- return new ImplFontCharMap( aCmapResult );
+ const ImplFontCharMap* pIFCMap = mpServerFont[0]->GetImplFontCharMap();
+ return pIFCMap;
}
// ----------------------------------------------------------------------------
@@ -1763,16 +1756,19 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
// ----------------------------------------------------------------------------
void
-X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric )
+X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric, int nFallbackLevel )
{
- if( mpServerFont[0] != NULL )
+ if( nFallbackLevel >= MAX_FALLBACK )
+ return;
+
+ if( mpServerFont[nFallbackLevel] != NULL )
{
long rDummyFactor;
- mpServerFont[0]->FetchFontMetric( *pMetric, rDummyFactor );
+ mpServerFont[nFallbackLevel]->FetchFontMetric( *pMetric, rDummyFactor );
}
- else if( mXFont[0] != NULL )
+ else if( mXFont[nFallbackLevel] != NULL )
{
- mXFont[0]->ToImplFontMetricData( pMetric );
+ mXFont[nFallbackLevel]->ToImplFontMetricData( pMetric );
if ( bFontVertical_ )
pMetric->mnOrientation = 0;
}
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index 8617bc4e5bfa..ece724d717cb 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -54,6 +54,8 @@
#include "vcl/svapp.hxx"
#include "vcl/jobset.h"
#include "vcl/print.h"
+#include "vcl/print.hxx"
+#include "vcl/pdfwriter.hxx"
#include "vcl/salptype.hxx"
#include "vcl/printerinfomanager.hxx"
@@ -63,6 +65,7 @@
using namespace psp;
using namespace rtl;
+using namespace com::sun::star;
/*
* static helpers
@@ -892,9 +895,26 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
case PRINTER_CAPABILITIES_FAX:
return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "fax" ) ? 1 : 0;
case PRINTER_CAPABILITIES_PDF:
- return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "pdf" ) ? 1 : 0;
+ if( PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "pdf" ) )
+ return 1;
+ else
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName );
+ if( pJobSetup->mpDriverData )
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+ return aData.m_nPDFDevice > 0 ? 1 : 0;
+ }
case PRINTER_CAPABILITIES_EXTERNALDIALOG:
return PrinterInfoManager::get().checkFeatureToken( pJobSetup->maPrinterName, "external_dialog" ) ? 1 : 0;
+ case PRINTER_CAPABILITIES_USEPULLMODEL:
+ {
+ // see if the PPD contains a value to set Collate to True
+ JobData aData = PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName );
+ if( pJobSetup->mpDriverData )
+ JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData );
+ return aData.m_nPDFDevice > 0 ? 1 : 0;
+ }
default: break;
};
return 0;
@@ -910,6 +930,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT
: m_bFax( false ),
m_bPdf( false ),
m_bSwallowFaxNo( false ),
+ m_bIsPDFWriterJob( false ),
m_pGraphics( NULL ),
m_nCopies( 1 ),
m_bCollate( false ),
@@ -1021,22 +1042,28 @@ BOOL PspSalPrinter::StartJob(
BOOL PspSalPrinter::EndJob()
{
- BOOL bSuccess = m_aPrintJob.EndJob();
-
- if( bSuccess )
+ BOOL bSuccess = FALSE;
+ if( m_bIsPDFWriterJob )
+ bSuccess = TRUE;
+ else
{
- // check for fax
- if( m_bFax )
- {
+ bSuccess = m_aPrintJob.EndJob();
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- // sendAFax removes the file after use
- bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand );
- }
- else if( m_bPdf )
+ if( bSuccess )
{
- const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
- bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
+ // check for fax
+ if( m_bFax )
+ {
+
+ const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
+ // sendAFax removes the file after use
+ bSuccess = sendAFax( m_aFaxNr, m_aTmpFile, rInfo.m_aCommand );
+ }
+ else if( m_bPdf )
+ {
+ const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( m_aJobData.m_aPrinterName ) );
+ bSuccess = createPdf( m_aFileName, m_aTmpFile, rInfo.m_aCommand );
+ }
}
}
vcl_sal::PrinterUpdate::jobEnded();
@@ -1089,6 +1116,271 @@ ULONG PspSalPrinter::GetErrorCode()
return 0;
}
+// -----------------------------------------------------------------------
+
+struct PDFNewJobParameters
+{
+ Size maPageSize;
+ USHORT mnPaperBin;
+
+ PDFNewJobParameters( const Size& i_rSize = Size(),
+ USHORT i_nPaperBin = 0xffff )
+ : maPageSize( i_rSize ), mnPaperBin( i_nPaperBin ) {}
+
+ bool operator!=(const PDFNewJobParameters& rComp ) const
+ {
+ Size aCompLSSize( rComp.maPageSize.Height(), rComp.maPageSize.Width() );
+ return
+ (maPageSize != rComp.maPageSize && maPageSize != aCompLSSize)
+ || mnPaperBin != rComp.mnPaperBin
+ ;
+ }
+
+ bool operator==(const PDFNewJobParameters& rComp) const
+ {
+ return ! this->operator!=(rComp);
+ }
+};
+
+struct PDFPrintFile
+{
+ rtl::OUString maTmpURL;
+ PDFNewJobParameters maParameters;
+
+ PDFPrintFile( const rtl::OUString& i_rURL, const PDFNewJobParameters& i_rNewParameters )
+ : maTmpURL( i_rURL )
+ , maParameters( i_rNewParameters ) {}
+};
+
+BOOL PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName,
+ ImplJobSetup* i_pSetupData, vcl::PrinterController& i_rController )
+{
+ OSL_TRACE( "StartJob with controller: pFilename = %s", i_pFileName ? rtl::OUStringToOString( *i_pFileName, RTL_TEXTENCODING_UTF8 ).getStr() : "<nil>" );
+ // mark for endjob
+ m_bIsPDFWriterJob = true;
+ // reset IsLastPage
+ i_rController.setLastPage( sal_False );
+
+ // update job data
+ if( i_pSetupData )
+ JobData::constructFromStreamBuffer( i_pSetupData->mpDriverData, i_pSetupData->mnDriverDataLen, m_aJobData );
+
+ OSL_ASSERT( m_aJobData.m_nPDFDevice > 0 );
+ m_aJobData.m_nPDFDevice = 1;
+
+ // possibly create one job for collated output
+ sal_Bool bSinglePrintJobs = sal_False;
+ beans::PropertyValue* pSingleValue = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintCollateAsSingleJobs" ) ) );
+ if( pSingleValue )
+ {
+ pSingleValue->Value >>= bSinglePrintJobs;
+ }
+
+ int nCopies = i_rController.getPrinter()->GetCopyCount();
+ bool bCollate = i_rController.getPrinter()->IsCollateCopy();
+
+ // notify start of real print job
+ i_rController.jobStarted();
+
+ // setup PDFWriter context
+ vcl::PDFWriter::PDFWriterContext aContext;
+ aContext.Version = vcl::PDFWriter::PDF_1_4;
+ aContext.Tagged = false;
+ aContext.EmbedStandardFonts = true;
+ aContext.DocumentLocale = Application::GetSettings().GetLocale();
+
+ // prepare doc info
+ aContext.DocumentInfo.Title = i_rJobName;
+ aContext.DocumentInfo.Creator = i_rAppName;
+ aContext.DocumentInfo.Producer = i_rAppName;
+
+ // define how we handle metafiles in PDFWriter
+ vcl::PDFWriter::PlayMetafileContext aMtfContext;
+ aMtfContext.m_bOnlyLosslessCompression = true;
+
+ boost::shared_ptr<vcl::PDFWriter> pWriter;
+ std::vector< PDFPrintFile > aPDFFiles;
+ boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
+ int nAllPages = i_rController.getFilteredPageCount();
+ i_rController.createProgressDialog();
+ bool bAborted = false;
+ PDFNewJobParameters aLastParm;
+
+ aContext.DPIx = pPrinter->ImplGetDPIX();
+ aContext.DPIy = pPrinter->ImplGetDPIY();
+ for( int nPage = 0; nPage < nAllPages && ! bAborted; nPage++ )
+ {
+ if( nPage == nAllPages-1 )
+ i_rController.setLastPage( sal_True );
+
+ // get the page's metafile
+ GDIMetaFile aPageFile;
+ vcl::PrinterController::PageSize aPageSize = i_rController.getFilteredPageFile( nPage, aPageFile );
+ if( i_rController.isProgressCanceled() )
+ {
+ bAborted = true;
+ if( nPage != nAllPages-1 )
+ {
+ i_rController.createProgressDialog();
+ i_rController.setLastPage( sal_True );
+ i_rController.getFilteredPageFile( nPage, aPageFile );
+ }
+ }
+ else
+ {
+ pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
+ pPrinter->SetPaperSizeUser( aPageSize.aSize, true );
+ PDFNewJobParameters aNewParm( pPrinter->GetPaperSize(), pPrinter->GetPaperBin() );
+
+ // create PDF writer on demand
+ // either on first page
+ // or on paper format change - cups does not support multiple paper formats per job (yet?)
+ // so we need to start a new job to get a new paper format from the printer
+ // orientation switches (that is switch of height and width) is handled transparently by CUPS
+ if( ! pWriter ||
+ (aNewParm != aLastParm && ! i_pFileName ) )
+ {
+ if( pWriter )
+ {
+ pWriter->Emit();
+ }
+ // produce PDF file
+ OUString aPDFUrl;
+ if( i_pFileName )
+ aPDFUrl = *i_pFileName;
+ else
+ osl_createTempFile( NULL, NULL, &aPDFUrl.pData );
+ // normalize to file URL
+ if( aPDFUrl.compareToAscii( "file:", 5 ) != 0 )
+ {
+ // this is not a file URL, but it should
+ // form it into a osl friendly file URL
+ rtl::OUString aTmp;
+ osl_getFileURLFromSystemPath( aPDFUrl.pData, &aTmp.pData );
+ aPDFUrl = aTmp;
+ }
+ // save current file and paper format
+ aLastParm = aNewParm;
+ aPDFFiles.push_back( PDFPrintFile( aPDFUrl, aNewParm ) );
+ // update context
+ aContext.URL = aPDFUrl;
+
+ // create and initialize PDFWriter
+ #if defined __SUNPRO_CC
+ #pragma disable_warn
+ #endif
+ pWriter.reset( new vcl::PDFWriter( aContext, uno::Reference< beans::XMaterialHolder >() ) );
+ #if defined __SUNPRO_CC
+ #pragma enable_warn
+ #endif
+ }
+
+ pWriter->NewPage( TenMuToPt( aNewParm.maPageSize.Width() ),
+ TenMuToPt( aNewParm.maPageSize.Height() ),
+ vcl::PDFWriter::Portrait );
+
+ pWriter->PlayMetafile( aPageFile, aMtfContext, NULL );
+ }
+ }
+
+ // emit the last file
+ if( pWriter )
+ pWriter->Emit();
+
+ // handle collate, copy count and multiple jobs correctly
+ int nOuterJobs = 1;
+ if( bSinglePrintJobs )
+ {
+ nOuterJobs = nCopies;
+ m_aJobData.m_nCopies = 1;
+ }
+ else
+ {
+ if( bCollate )
+ {
+ if( aPDFFiles.size() == 1 && pPrinter->HasSupport( SUPPORT_COLLATECOPY ) )
+ {
+ m_aJobData.setCollate( true );
+ m_aJobData.m_nCopies = nCopies;
+ }
+ else
+ {
+ nOuterJobs = nCopies;
+ m_aJobData.m_nCopies = 1;
+ }
+ }
+ else
+ {
+ m_aJobData.setCollate( false );
+ m_aJobData.m_nCopies = nCopies;
+ }
+ }
+
+ // spool files
+ if( ! i_pFileName && ! bAborted )
+ {
+ bool bFirstJob = true;
+ for( int nCurJob = 0; nCurJob < nOuterJobs; nCurJob++ )
+ {
+ for( size_t i = 0; i < aPDFFiles.size(); i++ )
+ {
+ oslFileHandle pFile = NULL;
+ osl_openFile( aPDFFiles[i].maTmpURL.pData, &pFile, osl_File_OpenFlag_Read );
+ if( pFile )
+ {
+ osl_setFilePos( pFile, osl_Pos_Absolut, 0 );
+ std::vector< char > buffer( 0x10000, 0 );
+ // update job data with current page size
+ Size aPageSize( aPDFFiles[i].maParameters.maPageSize );
+ m_aJobData.setPaper( TenMuToPt( aPageSize.Width() ), TenMuToPt( aPageSize.Height() ) );
+ // update job data with current paperbin
+ m_aJobData.setPaperBin( aPDFFiles[i].maParameters.mnPaperBin );
+
+ // spool current file
+ FILE* fp = PrinterInfoManager::get().startSpool( pPrinter->GetName(), i_rController.isDirectPrint() );
+ if( fp )
+ {
+ sal_uInt64 nBytesRead = 0;
+ do
+ {
+ osl_readFile( pFile, &buffer[0], buffer.size(), &nBytesRead );
+ if( nBytesRead > 0 )
+ fwrite( &buffer[0], 1, nBytesRead, fp );
+ } while( nBytesRead == buffer.size() );
+ rtl::OUStringBuffer aBuf( i_rJobName.Len() + 8 );
+ aBuf.append( i_rJobName );
+ if( i > 0 || nCurJob > 0 )
+ {
+ aBuf.append( sal_Unicode(' ') );
+ aBuf.append( sal_Int32( i + nCurJob * aPDFFiles.size() ) );
+ }
+ PrinterInfoManager::get().endSpool( pPrinter->GetName(), aBuf.makeStringAndClear(), fp, m_aJobData, bFirstJob );
+ bFirstJob = false;
+ }
+ }
+ osl_closeFile( pFile );
+ }
+ }
+ }
+
+ // job has been spooled
+ i_rController.setJobState( bAborted ? view::PrintableState_JOB_ABORTED : view::PrintableState_JOB_SPOOLED );
+
+ // clean up the temporary PDF files
+ if( ! i_pFileName || bAborted )
+ {
+ for( size_t i = 0; i < aPDFFiles.size(); i++ )
+ {
+ osl_removeFile( aPDFFiles[i].maTmpURL.pData );
+ OSL_TRACE( "removed print PDF file %s\n", rtl::OUStringToOString( aPDFFiles[i].maTmpURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+ }
+
+ return TRUE;
+}
+
+
+
/*
* vcl::PrinterUpdate
*/
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index a438760cffba..fd49ee34f543 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -36,6 +36,7 @@
#include "vcl/salinst.hxx"
#include "saldata.hxx"
+#include "vcl/printerinfomanager.hxx"
#include <cstdio>
#include <unistd.h>
@@ -291,10 +292,12 @@ const OUString& SalGetDesktopEnvironment()
SalData::SalData() :
m_pInstance(NULL),
- m_pPlugin(NULL)
+ m_pPlugin(NULL),
+ m_pPIManager(NULL)
{
}
SalData::~SalData()
{
+ psp::PrinterInfoManager::release();
}
diff --git a/vcl/unx/source/printer/cupsmgr.cxx b/vcl/unx/source/printer/cupsmgr.cxx
index e245b2548c79..caf3249b5f46 100644
--- a/vcl/unx/source/printer/cupsmgr.cxx
+++ b/vcl/unx/source/printer/cupsmgr.cxx
@@ -524,12 +524,18 @@ void CUPSManager::initialize()
// introduced in dests with 1.2
// this is needed to check for %%IncludeFeature support
// (#i65684#, #i65491#)
+ bool bUsePDF = false;
cups_dest_t* pDest = ((cups_dest_t*)m_pDests);
const char* pOpt = m_pCUPSWrapper->cupsGetOption( "printer-info",
pDest->num_options,
pDest->options );
if( pOpt )
+ {
m_bUseIncludeFeature = true;
+ bUsePDF = true;
+ if( m_aGlobalDefaults.m_nPSLevel == 0 && m_aGlobalDefaults.m_nPDFDevice == 0 )
+ m_aGlobalDefaults.m_nPDFDevice = 1;
+ }
// do not send include JobPatch; CUPS will insert that itself
// TODO: currently unknwon which versions of CUPS insert JobPatches
// so currently it is assumed CUPS = don't insert JobPatch files
@@ -593,6 +599,8 @@ void CUPSManager::initialize()
aPrinter.m_aInfo.m_pParser = c_it->second.getParser();
aPrinter.m_aInfo.m_aContext = c_it->second;
}
+ if( bUsePDF && aPrinter.m_aInfo.m_nPSLevel == 0 && aPrinter.m_aInfo.m_nPDFDevice == 0 )
+ aPrinter.m_aInfo.m_nPDFDevice = 1;
aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear();
aPrinter.m_bModified = false;
@@ -826,8 +834,15 @@ void CUPSManager::setupJobContextData(
FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand )
{
+ OSL_TRACE( "endSpool: %s, %s",
+ rtl::OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(),
+ bQuickCommand ? "true" : "false" );
+
if( m_aCUPSDestMap.find( rPrintername ) == m_aCUPSDestMap.end() )
+ {
+ OSL_TRACE( "defer to PrinterInfoManager::startSpool" );
return PrinterInfoManager::startSpool( rPrintername, bQuickCommand );
+ }
#ifdef ENABLE_CUPS
OUString aTmpURL, aTmpFile;
@@ -850,7 +865,7 @@ struct less_ppd_key : public ::std::binary_function<double, double, bool>
{ return left->getOrderDependency() < right->getOrderDependency(); }
};
-void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, int& rNumOptions, void** rOptions ) const
+void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) const
{
rNumOptions = 0;
*rOptions = NULL;
@@ -880,10 +895,26 @@ void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, int& rNumOpt
}
}
}
+
+ if( rJob.m_nPDFDevice > 0 && rJob.m_nCopies > 1 )
+ {
+ rtl::OString aVal( rtl::OString::valueOf( sal_Int32( rJob.m_nCopies ) ) );
+ rNumOptions = m_pCUPSWrapper->cupsAddOption( "copies", aVal.getStr(), rNumOptions, (cups_option_t**)rOptions );
+ }
+ if( ! bBanner )
+ {
+ rNumOptions = m_pCUPSWrapper->cupsAddOption( "job-sheets", "none", rNumOptions, (cups_option_t**)rOptions );
+ }
}
-int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData )
+int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner )
{
+ OSL_TRACE( "endSpool: %s, %s, copy count = %d",
+ rtl::OUStringToOString( rPrintername, RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( rJobTitle, RTL_TEXTENCODING_UTF8 ).getStr(),
+ rDocumentJobData.m_nCopies
+ );
+
int nJobID = 0;
osl::MutexGuard aGuard( m_aCUPSMutex );
@@ -891,7 +922,10 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
std::hash_map< OUString, int, OUStringHash >::iterator dest_it =
m_aCUPSDestMap.find( rPrintername );
if( dest_it == m_aCUPSDestMap.end() )
- return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData );
+ {
+ OSL_TRACE( "defer to PrinterInfoManager::endSpool" );
+ return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData, bBanner );
+ }
#ifdef ENABLE_CUPS
std::hash_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
@@ -903,7 +937,7 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
// setup cups options
int nNumOptions = 0;
cups_option_t* pOptions = NULL;
- getOptionsFromDocumentSetup( rDocumentJobData, nNumOptions, (void**)&pOptions );
+ getOptionsFromDocumentSetup( rDocumentJobData, bBanner, nNumOptions, (void**)&pOptions );
cups_dest_t* pDest = ((cups_dest_t*)m_pDests) + dest_it->second;
nJobID = m_pCUPSWrapper->cupsPrintFile( pDest->name,
diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx
index a1bca9441f77..d4211eae31df 100644
--- a/vcl/unx/source/printer/jobdata.cxx
+++ b/vcl/unx/source/printer/jobdata.cxx
@@ -51,6 +51,7 @@ JobData& JobData::operator=(const JobData& rRight)
m_pParser = rRight.m_pParser;
m_aContext = rRight.m_aContext;
m_nPSLevel = rRight.m_nPSLevel;
+ m_nPDFDevice = rRight.m_nPDFDevice;
m_nColorDevice = rRight.m_nColorDevice;
if( ! m_pParser && m_aPrinterName.getLength() )
@@ -83,6 +84,34 @@ void JobData::setCollate( bool bCollate )
}
}
+bool JobData::setPaper( int i_nWidth, int i_nHeight )
+{
+ bool bSuccess = false;
+ if( m_pParser )
+ {
+ rtl::OUString aPaper( m_pParser->matchPaper( i_nWidth, i_nHeight ) );
+
+ const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
+ const PPDValue* pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : NULL;
+
+ bSuccess = pKey && pValue && m_aContext.setValue( pKey, pValue, false );
+ }
+ return bSuccess;
+}
+
+bool JobData::setPaperBin( int i_nPaperBin )
+{
+ bool bSuccess = false;
+ if( m_pParser )
+ {
+ const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
+ const PPDValue* pValue = pKey ? pKey->getValue( i_nPaperBin ) : NULL;
+
+ bSuccess = pKey && pValue && m_aContext.setValue( pKey, pValue, false );
+ }
+ return bSuccess;
+}
+
bool JobData::getStreamBuffer( void*& pData, int& bytes )
{
// consistency checks
@@ -128,6 +157,10 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
aLine += ByteString::CreateFromInt32( m_nPSLevel );
aStream.WriteLine( aLine );
+ aLine = "pdfdevice=";
+ aLine += ByteString::CreateFromInt32( m_nPDFDevice );
+ aStream.WriteLine( aLine );
+
aLine = "colordevice=";
aLine += ByteString::CreateFromInt32( m_nColorDevice );
aStream.WriteLine( aLine );
@@ -158,6 +191,7 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
bool bColorDepth = false;
bool bColorDevice = false;
bool bPSLevel = false;
+ bool bPDFDevice = false;
while( ! aStream.IsEof() )
{
aStream.ReadLine( aLine );
@@ -202,6 +236,11 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
bPSLevel = true;
rJobData.m_nPSLevel = aLine.Copy( 8 ).ToInt32();
}
+ else if( aLine.CompareTo( "pdfdevice=", 10 ) == COMPARE_EQUAL )
+ {
+ bPDFDevice = true;
+ rJobData.m_nPDFDevice = aLine.Copy( 10 ).ToInt32();
+ }
else if( aLine.Equals( "PPDContexData" ) )
{
if( bPrinter )
@@ -222,5 +261,5 @@ bool JobData::constructFromStreamBuffer( void* pData, int bytes, JobData& rJobDa
}
}
- return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bColorDevice && bColorDepth;
+ return bVersion && bPrinter && bOrientation && bCopies && bContext && bMargin && bPSLevel && bPDFDevice && bColorDevice && bColorDepth;
}
diff --git a/vcl/unx/source/printer/ppdparser.cxx b/vcl/unx/source/printer/ppdparser.cxx
index b2549573d099..587e58be5bc7 100644
--- a/vcl/unx/source/printer/ppdparser.cxx
+++ b/vcl/unx/source/printer/ppdparser.cxx
@@ -405,51 +405,53 @@ void PPDParser::scanPPDDir( const String& rDir )
const int nSuffixes = sizeof(pSuffixes)/sizeof(pSuffixes[0]);
osl::Directory aDir( rDir );
- aDir.open();
- osl::DirectoryItem aItem;
-
- INetURLObject aPPDDir(rDir);
- while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
+ if ( aDir.open() == osl::FileBase::E_None )
{
- osl::FileStatus aStatus( FileStatusMask_FileName );
- if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+ osl::DirectoryItem aItem;
+
+ INetURLObject aPPDDir(rDir);
+ while( aDir.getNextItem( aItem ) == osl::FileBase::E_None )
{
- rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 );
- aURLBuf.append( rDir );
- aURLBuf.append( sal_Unicode( '/' ) );
- aURLBuf.append( aStatus.getFileName() );
+ osl::FileStatus aStatus( FileStatusMask_FileName );
+ if( aItem.getFileStatus( aStatus ) == osl::FileBase::E_None )
+ {
+ rtl::OUStringBuffer aURLBuf( rDir.Len() + 64 );
+ aURLBuf.append( rDir );
+ aURLBuf.append( sal_Unicode( '/' ) );
+ aURLBuf.append( aStatus.getFileName() );
- rtl::OUString aFileURL, aFileName;
- osl::FileStatus::Type eType = osl::FileStatus::Unknown;
+ rtl::OUString aFileURL, aFileName;
+ osl::FileStatus::Type eType = osl::FileStatus::Unknown;
- if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None )
- {
- if( eType == osl::FileStatus::Regular )
+ if( resolveLink( aURLBuf.makeStringAndClear(), aFileURL, aFileName, eType ) == osl::FileBase::E_None )
{
- INetURLObject aPPDFile = aPPDDir;
- aPPDFile.Append( aFileName );
-
- // match extension
- for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ )
+ if( eType == osl::FileStatus::Regular )
{
- if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen )
+ INetURLObject aPPDFile = aPPDDir;
+ aPPDFile.Append( aFileName );
+
+ // match extension
+ for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ )
{
- if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
+ if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen )
{
- (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
- break;
+ if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
+ {
+ (*pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
+ break;
+ }
}
}
}
- }
- else if( eType == osl::FileStatus::Directory )
- {
- scanPPDDir( aFileURL );
+ else if( eType == osl::FileStatus::Directory )
+ {
+ scanPPDDir( aFileURL );
+ }
}
}
}
+ aDir.close();
}
- aDir.close();
}
void PPDParser::initPPDFiles()
diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index e1d499c40ca5..af189b1b01b5 100644
--- a/vcl/unx/source/printer/printerinfomanager.cxx
+++ b/vcl/unx/source/printer/printerinfomanager.cxx
@@ -35,6 +35,7 @@
#include "cupsmgr.hxx"
#include "vcl/fontmanager.hxx"
#include "vcl/strhelper.hxx"
+#include "saldata.hxx"
#include "tools/urlobj.hxx"
#include "tools/stream.hxx"
@@ -92,22 +93,28 @@ namespace psp
PrinterInfoManager& PrinterInfoManager::get()
{
- static PrinterInfoManager* pManager = NULL;
+ SalData* pSalData = GetSalData();
- if( ! pManager )
+ if( ! pSalData->m_pPIManager )
{
- pManager = CUPSManager::tryLoadCUPS();
- if( ! pManager )
- pManager = new PrinterInfoManager();
+ pSalData->m_pPIManager = CUPSManager::tryLoadCUPS();
+ if( ! pSalData->m_pPIManager )
+ pSalData->m_pPIManager = new PrinterInfoManager();
- if( pManager )
- pManager->initialize();
+ pSalData->m_pPIManager->initialize();
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pManager->getType() );
+ fprintf( stderr, "PrinterInfoManager::get create Manager of type %d\n", pSalData->m_pPIManager->getType() );
#endif
}
- return *pManager;
+ return *pSalData->m_pPIManager;
+}
+
+void PrinterInfoManager::release()
+{
+ SalData* pSalData = GetSalData();
+ delete pSalData->m_pPIManager;
+ pSalData->m_pPIManager = NULL;
}
// -----------------------------------------------------------------
@@ -130,6 +137,9 @@ PrinterInfoManager::PrinterInfoManager( Type eType ) :
PrinterInfoManager::~PrinterInfoManager()
{
delete m_pQueueInfo;
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "PrinterInfoManager: destroyed Manager of type %d\n", getType() );
+ #endif
}
// -----------------------------------------------------------------
@@ -283,6 +293,10 @@ void PrinterInfoManager::initialize()
if( aValue.Len() )
m_aGlobalDefaults.m_nPSLevel = aValue.ToInt32();
+ aValue = aConfig.ReadKey( "PDFDevice" );
+ if( aValue.Len() )
+ m_aGlobalDefaults.m_nPDFDevice = aValue.ToInt32();
+
aValue = aConfig.ReadKey( "PerformFontSubstitution" );
if( aValue.Len() )
{
@@ -324,7 +338,7 @@ void PrinterInfoManager::initialize()
}
}
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "global settings: fontsubst = %s, %d substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", m_aGlobalDefaults.m_aFontSubstitutes.size() );
+ fprintf( stderr, "global settings: fontsubst = %s, %d substitutes\n", m_aGlobalDefaults.m_bPerformFontSubstitution ? "true" : "false", (int)m_aGlobalDefaults.m_aFontSubstitutes.size() );
#endif
}
}
@@ -494,6 +508,10 @@ void PrinterInfoManager::initialize()
if( aValue.Len() )
aPrinter.m_aInfo.m_nPSLevel = aValue.ToInt32();
+ aValue = aConfig.ReadKey( "PDFDevice" );
+ if( aValue.Len() )
+ aPrinter.m_aInfo.m_nPDFDevice = aValue.ToInt32();
+
aValue = aConfig.ReadKey( "PerformFontSubstitution" );
if( ! aValue.Equals( "0" ) && ! aValue.EqualsIgnoreCaseAscii( "false" ) )
aPrinter.m_aInfo.m_bPerformFontSubstitution = true;
@@ -624,7 +642,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const OUString& rPrinter
static PrinterInfo aEmptyInfo;
::std::hash_map< OUString, Printer, OUStringHash >::const_iterator it = m_aPrinters.find( rPrinter );
- DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistant printers" );
+ DBG_ASSERT( it != m_aPrinters.end(), "Do not ask for info about nonexistent printers" );
return it != m_aPrinters.end() ? it->second.m_aInfo : aEmptyInfo;
}
@@ -758,6 +776,7 @@ bool PrinterInfoManager::writePrinterConfig()
pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) );
pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" );
pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) );
+ pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) );
pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) );
pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) );
aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust );
@@ -845,9 +864,10 @@ bool PrinterInfoManager::addPrinter( const OUString& rPrinterName, const OUStrin
m_aPrinters[ rPrinterName ] = aPrinter;
bSuccess = true;
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "new printer %s, level = %d, colordevice = %d, depth = %d\n",
+ fprintf( stderr, "new printer %s, level = %d, pdfdevice = %d, colordevice = %d, depth = %d\n",
OUStringToOString( rPrinterName, osl_getThreadTextEncoding() ).getStr(),
m_aPrinters[rPrinterName].m_aInfo.m_nPSLevel,
+ m_aPrinters[rPrinterName].m_aInfo.m_nPDFDevice,
m_aPrinters[rPrinterName].m_aInfo.m_nColorDevice,
m_aPrinters[rPrinterName].m_aInfo.m_nColorDepth );
#endif
@@ -1095,7 +1115,7 @@ FILE* PrinterInfoManager::startSpool( const OUString& rPrintername, bool bQuickC
return popen (aShellCommand.getStr(), "w");
}
-int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/ )
+int PrinterInfoManager::endSpool( const OUString& /*rPrintername*/, const OUString& /*rJobTitle*/, FILE* pFile, const JobData& /*rDocumentJobData*/, bool /*bBanner*/ )
{
return (0 == pclose( pFile ));
}
@@ -1166,7 +1186,11 @@ SystemQueueInfo::SystemQueueInfo() :
SystemQueueInfo::~SystemQueueInfo()
{
- terminate();
+ static const char* pNoSyncDetection = getenv( "SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION" );
+ if( ! pNoSyncDetection || !*pNoSyncDetection )
+ join();
+ else
+ terminate();
}
bool SystemQueueInfo::hasChanged() const
diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx
index 5e18849b8dfe..af2cf14b1a0c 100644
--- a/vcl/unx/source/printergfx/printerjob.cxx
+++ b/vcl/unx/source/printergfx/printerjob.cxx
@@ -341,7 +341,8 @@ PrinterJob::~PrinterJob ()
delete mpJobTrailer;
// XXX should really call osl::remove routines
- removeSpoolDir (maSpoolDirName);
+ if( maSpoolDirName.getLength() )
+ removeSpoolDir (maSpoolDirName);
// osl::Directory::remove (maSpoolDirName);
}
@@ -495,6 +496,10 @@ PrinterJob::StartJob (
sal_Bool
PrinterJob::EndJob ()
{
+ // no pages ? that really means no print job
+ if( maPageList.empty() )
+ return sal_False;
+
// write document setup (done here because it
// includes the accumulated fonts
if( mpJobHeader )
@@ -610,7 +615,7 @@ PrinterJob::EndJob ()
{
PrinterInfoManager& rPrinterInfoManager = PrinterInfoManager::get();
if (0 == rPrinterInfoManager.endSpool( m_aLastJobData.m_aPrinterName,
- maJobTitle, pDestFILE, m_aDocumentJobData ))
+ maJobTitle, pDestFILE, m_aDocumentJobData, true ))
{
bSuccess = sal_False;
}
diff --git a/vcl/unx/source/window/makefile.mk b/vcl/unx/source/window/makefile.mk
index 808b712903f3..c5cd95ba6b1c 100644
--- a/vcl/unx/source/window/makefile.mk
+++ b/vcl/unx/source/window/makefile.mk
@@ -48,7 +48,7 @@ dummy:
.ELSE # "$(GUIBASE)"!="unx"
SLOFILES= \
- $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj $(SLO)/salmenu.obj
+ $(SLO)/FWS.obj $(SLO)/salframe.obj $(SLO)/salobj.obj
.ENDIF # "$(GUIBASE)"!="unx"
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index b0248662a2a2..9934277302e1 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -3144,6 +3144,100 @@ GetAlternateKeyCode( const USHORT nKeyCode )
return aAlternate;
}
+void X11SalFrame::beginUnicodeSequence()
+{
+ rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() );
+ DeletionListener aDeleteWatch( this );
+
+ if( rSeq.getLength() )
+ endUnicodeSequence();
+
+ rSeq = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "u" ) );
+
+ if( ! aDeleteWatch.isDeleted() )
+ {
+ USHORT nTextAttr = SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
+ SalExtTextInputEvent aEv;
+ aEv.mnTime = 0;
+ aEv.maText = rSeq;
+ aEv.mpTextAttr = &nTextAttr;
+ aEv.mnCursorPos = 0;
+ aEv.mnDeltaStart = 0;
+ aEv.mnCursorFlags = 0;
+ aEv.mbOnlyCursor = FALSE;
+
+ CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv);
+ }
+}
+
+bool X11SalFrame::appendUnicodeSequence( sal_Unicode c )
+{
+ bool bRet = false;
+ rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() );
+ if( rSeq.getLength() > 0 )
+ {
+ // range check
+ if( (c >= sal_Unicode('0') && c <= sal_Unicode('9')) ||
+ (c >= sal_Unicode('a') && c <= sal_Unicode('f')) ||
+ (c >= sal_Unicode('A') && c <= sal_Unicode('F')) )
+ {
+ rtl::OUStringBuffer aBuf( rSeq.getLength() + 1 );
+ aBuf.append( rSeq );
+ aBuf.append( c );
+ rSeq = aBuf.makeStringAndClear();
+ std::vector<USHORT> attribs( rSeq.getLength(), SAL_EXTTEXTINPUT_ATTR_UNDERLINE );
+
+ SalExtTextInputEvent aEv;
+ aEv.mnTime = 0;
+ aEv.maText = rSeq;
+ aEv.mpTextAttr = &attribs[0];
+ aEv.mnCursorPos = 0;
+ aEv.mnDeltaStart = 0;
+ aEv.mnCursorFlags = 0;
+ aEv.mbOnlyCursor = FALSE;
+
+ CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv);
+ bRet = true;
+ }
+ else
+ bRet = endUnicodeSequence();
+ }
+ else
+ endUnicodeSequence();
+ return bRet;
+}
+
+bool X11SalFrame::endUnicodeSequence()
+{
+ rtl::OUString& rSeq( GetX11SalData()->GetUnicodeAccumulator() );
+
+ DeletionListener aDeleteWatch( this );
+ if( rSeq.getLength() > 1 && rSeq.getLength() < 6 )
+ {
+ // cut the "u"
+ rtl::OUString aNumbers( rSeq.copy( 1 ) );
+ sal_Int32 nValue = aNumbers.toInt32( 16 );
+ if( nValue >= 32 )
+ {
+ USHORT nTextAttr = SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
+ SalExtTextInputEvent aEv;
+ aEv.mnTime = 0;
+ aEv.maText = rtl::OUString( sal_Unicode(nValue) );
+ aEv.mpTextAttr = &nTextAttr;
+ aEv.mnCursorPos = 0;
+ aEv.mnDeltaStart = 0;
+ aEv.mnCursorFlags = 0;
+ aEv.mbOnlyCursor = FALSE;
+ CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&aEv);
+ }
+ }
+ bool bWasInput = rSeq.getLength() > 0;
+ rSeq = rtl::OUString();
+ if( bWasInput && ! aDeleteWatch.isDeleted() )
+ CallCallback(SALEVENT_ENDEXTTEXTINPUT, NULL);
+ return bWasInput;
+}
+
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
{
@@ -3189,6 +3283,9 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
if( pEvent->state & Mod1Mask )
nModCode |= KEY_MOD2;
+ if( nModCode != (KEY_SHIFT|KEY_MOD1) )
+ endUnicodeSequence();
+
if( nKeySym == XK_Shift_L || nKeySym == XK_Shift_R
|| nKeySym == XK_Control_L || nKeySym == XK_Control_R
|| nKeySym == XK_Alt_L || nKeySym == XK_Alt_R
@@ -3312,6 +3409,33 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
if( !nKeyCode && !nLen && !nKeyString)
return 0;
+ DeletionListener aDeleteWatch( this );
+
+ if( nModCode == (KEY_SHIFT | KEY_MOD1) && pEvent->type == XLIB_KeyPress )
+ {
+ USHORT nSeqKeyCode = pDisplay_->GetKeyCode( nUnmodifiedKeySym, &aDummy );
+ if( nSeqKeyCode == KEY_U )
+ {
+ beginUnicodeSequence();
+ return 1;
+ }
+ else if( nSeqKeyCode >= KEY_0 && nSeqKeyCode <= KEY_9 )
+ {
+ if( appendUnicodeSequence( sal_Unicode( '0' ) + sal_Unicode(nSeqKeyCode - KEY_0) ) )
+ return 1;
+ }
+ else if( nSeqKeyCode >= KEY_A && nSeqKeyCode <= KEY_F )
+ {
+ if( appendUnicodeSequence( sal_Unicode( 'a' ) + sal_Unicode(nSeqKeyCode - KEY_A) ) )
+ return 1;
+ }
+ else
+ endUnicodeSequence();
+ }
+
+ if( aDeleteWatch.isDeleted() )
+ return 0;
+
rtl_TextEncoding nEncoding;
if (mpInputContext != NULL && mpInputContext->IsMultiLingual() )
@@ -3370,8 +3494,6 @@ long X11SalFrame::HandleKeyEvent( XKeyEvent *pEvent )
nSize = 0;
}
- DeletionListener aDeleteWatch( this );
-
if ( mpInputContext != NULL
&& mpInputContext->UseContext()
&& KeyRelease != pEvent->type
diff --git a/vcl/unx/source/window/salmenu.cxx b/vcl/unx/source/window/salmenu.cxx
deleted file mode 100644
index 0739b6cd5352..000000000000
--- a/vcl/unx/source/window/salmenu.cxx
+++ /dev/null
@@ -1,132 +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"
-
-
-#include <saldata.hxx>
-#include <salinst.h>
-#include <salmenu.h>
-
-
-// =======================================================================
-
-// X11SalInst factory methods
-
-SalMenu* X11SalInstance::CreateMenu( BOOL /*bMenuBar*/ )
-{
- return NULL; // no support for native menues
-}
-
-void X11SalInstance::DestroyMenu( SalMenu* pSalMenu )
-{
- delete pSalMenu;
-}
-
-
-SalMenuItem* X11SalInstance::CreateMenuItem( const SalItemParams* )
-{
- return NULL; // no support for native menues
-}
-
-void X11SalInstance::DestroyMenuItem( SalMenuItem* pSalMenuItem )
-{
- delete pSalMenuItem;
-}
-
-
-// =======================================================================
-
-
-/*
- * X11SalMenu
- */
-
-
-X11SalMenu::~X11SalMenu()
-{
-}
-
-BOOL X11SalMenu::VisibleMenuBar()
-{
- return FALSE;
-}
-
-void X11SalMenu::SetFrame( const SalFrame* )
-{
-}
-
-void X11SalMenu::InsertItem( SalMenuItem*, unsigned )
-{
-}
-
-void X11SalMenu::RemoveItem( unsigned )
-{
-}
-
-void X11SalMenu::SetSubMenu( SalMenuItem*, SalMenu*, unsigned )
-{
-}
-
-void X11SalMenu::CheckItem( unsigned, BOOL )
-{
-}
-
-void X11SalMenu::EnableItem( unsigned, BOOL )
-{
-}
-
-void X11SalMenu::SetItemImage( unsigned, SalMenuItem*, const Image& )
-{
-}
-
-void X11SalMenu::SetItemText( unsigned, SalMenuItem*, const XubString& )
-{
-}
-
-void X11SalMenu::SetAccelerator( unsigned, SalMenuItem*, const KeyCode&, const XubString& )
-{
-}
-
-void X11SalMenu::GetSystemMenuData( SystemMenuData* )
-{
-}
-
-// =======================================================================
-
-/*
- * SalMenuItem
- */
-
-
-X11SalMenuItem::~X11SalMenuItem()
-{
-}
-
-// -------------------------------------------------------------------
-
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index eb54531c375c..d21e9dcb3eed 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -312,7 +312,7 @@ SHL2STDLIBS=\
# prepare linking of Xinerama
.IF "$(USE_XINERAMA)" != "NO"
-.IF "$(OS)"=="MACOSX"
+.IF "$(OS)"=="MACOSX" || "$(OS)$(CPU)" == "LINUXX"
XINERAMALIBS=-lXinerama
.ELSE
.IF "$(OS)" != "SOLARIS" || "$(USE_XINERAMA_VERSION)" == "Xorg"
@@ -397,6 +397,9 @@ SHL4STDLIBS+= $(XRANDR_LIBS)
.IF "$(ENABLE_KDE)" != ""
.IF "$(KDE_ROOT)"!=""
EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib
+.IF "$(OS)$(CPU)" == "LINUXX"
+EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64
+.ENDIF
.ENDIF
LIB5TARGET=$(SLB)$/ikde_plug_
LIB5FILES=$(SLB)$/kdeplug.lib
@@ -458,3 +461,16 @@ SHL6STDLIBS+= $(XRANDR_LIBS)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/vcl.component
+
+.IF "$(OS)" == "MACOSX"
+my_platform = .macosx
+.ELIF "$(OS)" == "WNT"
+my_platform = .windows
+.END
+
+$(MISC)/vcl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ vcl.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt vcl$(my_platform).component
diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk
index df9ba1a214d7..ac2977ca8eab 100644
--- a/vcl/util/makefile2.pmk
+++ b/vcl/util/makefile2.pmk
@@ -36,6 +36,6 @@ CFLAGSCXX+=$(OBJCXXFLAGS)
#building with stlport, but graphite was not built with stlport
.IF "$(USE_SYSTEM_STL)"!="YES"
.IF "$(SYSTEM_GRAPHITE)"=="YES"
-CDEFS += -DADAPT_EXT_STL
+CFLAGSCXX+=-DADAPT_EXT_STL
.ENDIF
.ENDIF
diff --git a/vcl/util/vcl.component b/vcl/util/vcl.component
new file mode 100644
index 000000000000..da20fc916c32
--- /dev/null
+++ b/vcl/util/vcl.component
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.datatransfer.X11ClipboardSupport">
+ <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
+ </implementation>
+ <implementation name="com.sun.star.datatransfer.dnd.XdndDropTarget">
+ <service name="com.sun.star.datatransfer.dnd.X11DropTarget"/>
+ </implementation>
+ <implementation name="com.sun.star.datatransfer.dnd.XdndSupport">
+ <service name="com.sun.star.datatransfer.dnd.X11DragSource"/>
+ </implementation>
+ <implementation name="com.sun.star.frame.VCLSessionManagerClient">
+ <service name="com.sun.star.frame.SessionManagerClient"/>
+ </implementation>
+ <implementation name="vcl::DisplayAccess">
+ <service name="com.sun.star.awt.DisplayAccess"/>
+ </implementation>
+ <implementation name="vcl::FontIdentificator">
+ <service name="com.sun.star.awt.FontIdentificator"/>
+ </implementation>
+</component>
diff --git a/vcl/util/vcl.macosx.component b/vcl/util/vcl.macosx.component
new file mode 100644
index 000000000000..3aabcd8c7050
--- /dev/null
+++ b/vcl/util/vcl.macosx.component
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.datatransfer.dnd.OleDragSource_V1">
+ <service name="com.sun.star.datatransfer.dnd.OleDragSource"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.datatransfer.dnd.OleDropTarget_V1">
+ <service name="com.sun.star.datatransfer.dnd.OleDropTarget"/>
+ </implementation>
+ <implementation name="com.sun.star.datatransfer.clipboard.AquaClipboard">
+ <service name="com.sun.star.datatransfer.clipboard.SystemClipboard"/>
+ </implementation>
+ <implementation name="com.sun.star.frame.VCLSessionManagerClient">
+ <service name="com.sun.star.frame.SessionManagerClient"/>
+ </implementation>
+ <implementation name="vcl::DisplayAccess">
+ <service name="com.sun.star.awt.DisplayAccess"/>
+ </implementation>
+ <implementation name="vcl::FontIdentificator">
+ <service name="com.sun.star.awt.FontIdentificator"/>
+ </implementation>
+</component>
diff --git a/vcl/util/vcl.windows.component b/vcl/util/vcl.windows.component
new file mode 100644
index 000000000000..72f7ace9f251
--- /dev/null
+++ b/vcl/util/vcl.windows.component
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.frame.VCLSessionManagerClient">
+ <service name="com.sun.star.frame.SessionManagerClient"/>
+ </implementation>
+ <implementation name="vcl::DisplayAccess">
+ <service name="com.sun.star.awt.DisplayAccess"/>
+ </implementation>
+ <implementation name="vcl::FontIdentificator">
+ <service name="com.sun.star.awt.FontIdentificator"/>
+ </implementation>
+</component>
diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h
index 442b8bee1f15..f592f53ae29c 100755
--- a/vcl/win/inc/salgdi.h
+++ b/vcl/win/inc/salgdi.h
@@ -57,10 +57,10 @@ class ImplFontAttrCache;
class ImplWinFontData : public ImplFontData
{
public:
- ImplWinFontData( const ImplDevFontAttributes&,
+ explicit ImplWinFontData( const ImplDevFontAttributes&,
int nFontHeight, WIN_BYTE eWinCharSet,
WIN_BYTE nPitchAndFamily );
- ~ImplWinFontData();
+ virtual ~ImplWinFontData();
virtual ImplFontData* Clone() const;
virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const;
@@ -82,7 +82,7 @@ public:
bool SupportsGraphite() const { return mbHasGraphiteSupport; }
#endif
- ImplFontCharMap* GetImplFontCharMap() const;
+ const ImplFontCharMap* GetImplFontCharMap() const;
const Ucs2SIntMap* GetEncodingVector() const { return mpEncodingVector; }
void SetEncodingVector( const Ucs2SIntMap* pNewVec ) const
{
@@ -127,9 +127,9 @@ public:
#endif // GNG_VERT_HACK
};
-// -------------------
-// - SalGraphicsData -
-// -------------------
+// ------------------
+// - WinSalGraphics -
+// ------------------
class WinSalGraphics : public SalGraphics
{
@@ -179,7 +179,7 @@ public:
HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont );
public:
- WinSalGraphics();
+ explicit WinSalGraphics();
virtual ~WinSalGraphics();
protected:
@@ -282,12 +282,12 @@ public:
// set the font
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
// get the current font's etrics
- virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontMetric( ImplFontMetricData*, int nFallbackLevel );
// get kernign pairs of the current font
// return only PairCount if (pKernPairs == NULL)
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
// get the repertoire of the current font
- virtual ImplFontCharMap* GetImplFontCharMap() const;
+ virtual const ImplFontCharMap* GetImplFontCharMap() const;
// graphics must fill supplied font list
virtual void GetDevFontList( ImplDevFontList* );
// graphics should call ImplAddDevFontSubstitute on supplied
@@ -359,11 +359,11 @@ public:
};
// Init/Deinit Graphics
-void ImplSalInitGraphics( WinSalGraphics* mpData );
-void ImplSalDeInitGraphics( WinSalGraphics* mpData );
+void ImplSalInitGraphics( WinSalGraphics* );
+void ImplSalDeInitGraphics( WinSalGraphics* );
void ImplUpdateSysColorEntries();
int ImplIsSysColorEntry( SalColor nSalColor );
-void ImplGetLogFontFromFontSelect( HDC hDC, const ImplFontSelectData*,
+void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*,
LOGFONTW&, bool bTestVerticalAvail );
// -----------
@@ -397,7 +397,10 @@ inline bool ImplWinFontData::HasChar( sal_uInt32 cChar ) const
cChar -= 0xF000;
else if( mbAliasSymbolsHigh && (cChar <= 0xFF) )
cChar += 0xF000;
+ else
+ return false;
return mpUnicodeMap->HasChar( cChar );
}
#endif // _SV_SALGDI_H
+
diff --git a/vcl/win/inc/salinst.h b/vcl/win/inc/salinst.h
index f3005e3ad30b..1ab59f8f7f9f 100644
--- a/vcl/win/inc/salinst.h
+++ b/vcl/win/inc/salinst.h
@@ -77,9 +77,11 @@ public:
virtual vos::IMutex* GetYieldMutex();
virtual ULONG ReleaseYieldMutex();
virtual void AcquireYieldMutex( ULONG nCount );
+ virtual bool CheckYieldMutex();
+
virtual void Yield( bool bWait, bool bHandleAllCurrentEvents );
virtual bool AnyInput( USHORT nType );
- virtual SalMenu* CreateMenu( BOOL bMenuBar );
+ virtual SalMenu* CreateMenu( BOOL bMenuBar, Menu* );
virtual void DestroyMenu( SalMenu* );
virtual SalMenuItem* CreateMenuItem( const SalItemParams* pItemData );
virtual void DestroyMenuItem( SalMenuItem* );
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 9514bc9a2ace..a05d2d0b6502 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -323,10 +323,9 @@ void ImplSalAcquireYieldMutex( ULONG nCount )
// -----------------------------------------------------------------------
-#ifdef DBG_UTIL
-
-void ImplDbgTestSolarMutex()
+bool WinSalInstance::CheckYieldMutex()
{
+ bool bRet = true;
SalData* pSalData = GetSalData();
DWORD nCurThreadId = GetCurrentThreadId();
if ( pSalData->mnAppThreadId != nCurThreadId )
@@ -336,7 +335,7 @@ void ImplDbgTestSolarMutex()
SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex;
if ( pYieldMutex->mnThreadId != nCurThreadId )
{
- DBG_ERROR( "SolarMutex not locked, and not thread save code in VCL is called from outside of the main thread" );
+ bRet = false;
}
}
}
@@ -347,14 +346,13 @@ void ImplDbgTestSolarMutex()
SalYieldMutex* pYieldMutex = pSalData->mpFirstInstance->mpSalYieldMutex;
if ( pYieldMutex->mnThreadId != nCurThreadId )
{
- DBG_ERROR( "SolarMutex not locked in the main thread" );
+ bRet = false;
}
}
}
+ return bRet;
}
-#endif
-
// =======================================================================
void SalData::initKeyCodeMap()
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
index 444df039dd69..141c812dcd31 100644
--- a/vcl/win/source/gdi/salbmp.cxx
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -509,8 +509,8 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, bool bReadOnly )
{
PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
const USHORT nCount = pBuffer->maPalette.GetEntryCount();
-
- memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), nCount * sizeof( RGBQUAD ) );
+ const USHORT nDIBColorCount = ImplGetDIBColorCount( mhDIB );
+ memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), Min( nDIBColorCount, nCount ) * sizeof( RGBQUAD ) );
GlobalUnlock( mhDIB );
}
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index d1b5a9cfdeae..c8e0210196e6 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -533,9 +533,10 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace,
// avoid fonts with unknown CMAP subtables for glyph fallback
if( !pCharMap || pCharMap->IsDefaultMap() )
return false;
+ pCharMap->AddReference();
int nMatchCount = 0;
- // static const int nMaxMatchCount = 1; // TODO: check more missing characters?
+ // static const int nMaxMatchCount = 1; // TODO: tolerate more missing characters?
const sal_Int32 nStrLen = rMissingChars.getLength();
for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx )
{
@@ -543,6 +544,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace,
nMatchCount += pCharMap->HasChar( uChar );
break; // for now
}
+ pCharMap->DeReference();
const bool bHasMatches = (nMatchCount > 0);
return bHasMatches;
@@ -1206,11 +1208,10 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const
// -----------------------------------------------------------------------
-ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const
+const ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const
{
if( !mpUnicodeMap )
return NULL;
- mpUnicodeMap->AddReference();
return mpUnicodeMap;
}
@@ -1320,6 +1321,7 @@ void ImplWinFontData::ReadCmapTable( HDC hDC ) const
if( !mpUnicodeMap )
mpUnicodeMap = ImplFontCharMap::GetDefaultMap( bIsSymbolFont );
+ mpUnicodeMap->AddReference();
}
// =======================================================================
@@ -1760,8 +1762,11 @@ USHORT WinSalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel )
// -----------------------------------------------------------------------
-void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
+void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
{
+ // temporarily change the HDC to the font in the fallback level
+ HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] );
+
if ( aSalShlData.mbWNT )
{
wchar_t aFaceName[LF_FACESIZE+60];
@@ -1775,8 +1780,12 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
pMetric->maName = ImplSalGetUniString( aFaceName );
}
+ // get the font metric
TEXTMETRICA aWinMetric;
- if( !GetTextMetricsA( mhDC, &aWinMetric ) )
+ const bool bOK = GetTextMetricsA( mhDC, &aWinMetric );
+ // restore the HDC to the font in the base level
+ SelectFont( mhDC, hOldFont );
+ if( !bOK )
return;
// device independent font attributes
@@ -1815,7 +1824,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
// #107888# improved metric compatibility for Asian fonts...
// TODO: assess workaround below for CWS >= extleading
// TODO: evaluate use of aWinMetric.sTypo* members for CJK
- if( mpWinFontData[0] && mpWinFontData[0]->SupportsCJK() )
+ if( mpWinFontData[nFallbackLevel] && mpWinFontData[nFallbackLevel]->SupportsCJK() )
{
pMetric->mnIntLeading += pMetric->mnExtLeading;
@@ -1836,7 +1845,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
// #109280# HACK korean only: increase descent for wavelines and impr
if( !aSalShlData.mbWNT )
- if( mpWinFontData[0]->SupportsKorean() )
+ if( mpWinFontData[nFallbackLevel]->SupportsKorean() )
pMetric->mnDescent += pMetric->mnExtLeading;
}
@@ -2053,7 +2062,7 @@ ULONG WinSalGraphics::GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs )
// -----------------------------------------------------------------------
-ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* WinSalGraphics::GetImplFontCharMap() const
{
if( !mpWinFontData[0] )
return ImplFontCharMap::GetDefaultMap();
@@ -2875,8 +2884,6 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
ImplDoSetFont( &aIFSD, fScale, hOldFont );
ImplWinFontData* pWinFontData = (ImplWinFontData*)aIFSD.mpFontData;
- pWinFontData->UpdateFromHDC( mhDC );
-/*const*/ ImplFontCharMap* pImplFontCharMap = pWinFontData->GetImplFontCharMap();
#if OSL_DEBUG_LEVEL > 1
// get font metrics
@@ -2899,6 +2906,10 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
const RawFontData aRawCffData( mhDC, nCffTag );
if( aRawCffData.get() )
{
+ pWinFontData->UpdateFromHDC( mhDC );
+ const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap();
+ pCharMap->AddReference();
+
long nRealGlyphIds[ 256 ];
for( int i = 0; i < nGlyphCount; ++i )
{
@@ -2906,13 +2917,15 @@ BOOL WinSalGraphics::CreateFontSubset( const rtl::OUString& rToFile,
// TODO: use GDI's GetGlyphIndices instead? Does it handle GSUB properly?
sal_uInt32 nGlyphIdx = pGlyphIDs[i] & GF_IDXMASK;
if( pGlyphIDs[i] & GF_ISCHAR ) // remaining pseudo-glyphs need to be translated
- nGlyphIdx = pImplFontCharMap->GetGlyphIndex( nGlyphIdx );
+ nGlyphIdx = pCharMap->GetGlyphIndex( nGlyphIdx );
if( (pGlyphIDs[i] & (GF_ROTMASK|GF_GSUB)) != 0) // TODO: vertical substitution
{/*####*/}
nRealGlyphIds[i] = nGlyphIdx;
}
+ pCharMap->DeReference(); // TODO: and and use a RAII object
+
// provide a font subset from the CFF-table
FILE* pOutFile = fopen( aToFile.GetBuffer(), "wb" );
rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() );
@@ -3160,8 +3173,9 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont,
rUnicodeEnc.clear();
}
const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFont);
- ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap();
+ const ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap();
DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" );
+ pMap->AddReference();
int nCharCount = pMap->GetCharCount();
sal_uInt32 nChar = pMap->GetFirstChar();
@@ -3177,6 +3191,8 @@ void WinSalGraphics::GetGlyphWidths( const ImplFontData* pFont,
}
nChar = pMap->GetNextChar( nChar );
}
+
+ pMap->DeReference(); // TODO: and and use a RAII object
}
}
else if( pFont->IsEmbeddable() )
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index bc80cbf94fb8..82fa9bb4b5e1 100755..100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -2076,6 +2076,13 @@ void UniscribeLayout::MoveGlyph( int nStartx8, long nNewXPos )
// move the visual item by having an offset
pVI->mnXOffset += nDelta;
}
+ // move subsequent items - this often isn't necessary because subsequent
+ // moves will correct subsequent items. However, if there is a contiguous
+ // range not involving fallback which spans items, this will be needed
+ while (++pVI - mpVisualItems < mnItemCount)
+ {
+ pVI->mnXOffset += nDelta;
+ }
}
// -----------------------------------------------------------------------
@@ -2364,6 +2371,10 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const
if( rVisualItem.IsEmpty() )
continue;
+ if (mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK)
+ {
+ nXPos = rVisualItem.mnXOffset;
+ }
// get glyph positions
// TODO: handle when rVisualItem's glyph range is only partially used
for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i )
@@ -2397,13 +2408,17 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const
}
}
- // fixup unknown character positions to neighbor
- for( i = 0; i < nMaxIdx; ++i )
+ if (!(mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK))
{
- if( pCaretXArray[ i ] >= 0 )
- nXPos = pCaretXArray[ i ];
- else
- pCaretXArray[ i ] = nXPos;
+ nXPos = 0;
+ // fixup unknown character positions to neighbor
+ for( i = 0; i < nMaxIdx; ++i )
+ {
+ if( pCaretXArray[ i ] >= 0 )
+ nXPos = pCaretXArray[ i ];
+ else
+ pCaretXArray[ i ] = nXPos;
+ }
}
}
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 7314fd2b6164..f0ca1d68ef41 100644..100755
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -161,7 +161,7 @@ BOOL WinSalFrame::mbInReparent = FALSE;
// =======================================================================
static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
-static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
+static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = NULL );
static void ImplSaveFrameState( WinSalFrame* pFrame )
{
@@ -182,6 +182,25 @@ static void ImplSaveFrameState( WinSalFrame* pFrame )
if ( bVisible )
pFrame->mnShowState = SW_SHOWMAXIMIZED;
pFrame->mbRestoreMaximize = TRUE;
+
+ WINDOWPLACEMENT aPlacement;
+ aPlacement.length = sizeof(aPlacement);
+ if( GetWindowPlacement( pFrame->mhWnd, &aPlacement ) )
+ {
+ RECT aRect = aPlacement.rcNormalPosition;
+ RECT aRect2 = aRect;
+ AdjustWindowRectEx( &aRect2, GetWindowStyle( pFrame->mhWnd ),
+ FALSE, GetWindowExStyle( pFrame->mhWnd ) );
+ long nTopDeco = abs( aRect.top - aRect2.top );
+ long nLeftDeco = abs( aRect.left - aRect2.left );
+ long nBottomDeco = abs( aRect.bottom - aRect2.bottom );
+ long nRightDeco = abs( aRect.right - aRect2.right );
+
+ pFrame->maState.mnX = aRect.left + nLeftDeco;
+ pFrame->maState.mnY = aRect.top + nTopDeco;
+ pFrame->maState.mnWidth = aRect.right - aRect.left - nLeftDeco - nRightDeco;
+ pFrame->maState.mnHeight = aRect.bottom - aRect.top - nTopDeco - nBottomDeco;
+ }
}
else
{
@@ -1934,17 +1953,25 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState )
}
}
- // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch
- // umgesetzt werden muss, dann SetWindowPos() benutzen, da
- // SetWindowPlacement() die TaskBar mit einrechnet
+ // if a window is neither minimized nor maximized or need not be
+ // positioned visibly (that is in visible state), do not use
+ // SetWindowPlacement since it calculates including the TaskBar
if ( !IsIconic( mhWnd ) && !IsZoomed( mhWnd ) &&
(!bVisible || (aPlacement.showCmd == SW_RESTORE)) )
{
if( bUpdateHiddenFramePos )
{
+ RECT aStateRect;
+ aStateRect.left = nX;
+ aStateRect.top = nY;
+ aStateRect.right = nX+nWidth;
+ aStateRect.bottom = nY+nHeight;
// #96084 set a useful internal window size because
// the window will not be maximized (and the size updated) before show()
- SetMaximizedFrameGeometry( mhWnd, this );
+ SetMaximizedFrameGeometry( mhWnd, this, &aStateRect );
+ SetWindowPos( mhWnd, 0,
+ maGeometry.nX, maGeometry.nY, maGeometry.nWidth, maGeometry.nHeight,
+ SWP_NOZORDER | SWP_NOACTIVATE | nPosSize );
}
else
SetWindowPos( mhWnd, 0,
@@ -4197,23 +4224,27 @@ static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect )
// -----------------------------------------------------------------------
-static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame )
+static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect )
{
// calculate and set frame geometry of a maximized window - useful if the window is still hidden
// dualmonitor support:
// Get screensize of the monitor whith the mouse pointer
- POINT pt;
- GetCursorPos( &pt );
RECT aRectMouse;
- aRectMouse.left = pt.x;
- aRectMouse.top = pt.y;
- aRectMouse.right = pt.x+2;
- aRectMouse.bottom = pt.y+2;
+ if( ! pParentRect )
+ {
+ POINT pt;
+ GetCursorPos( &pt );
+ aRectMouse.left = pt.x;
+ aRectMouse.top = pt.y;
+ aRectMouse.right = pt.x+2;
+ aRectMouse.bottom = pt.y+2;
+ pParentRect = &aRectMouse;
+ }
RECT aRect;
- ImplSalGetWorkArea( hWnd, &aRect, &aRectMouse );
+ ImplSalGetWorkArea( hWnd, &aRect, pParentRect );
// a maximized window has no other borders than the caption
pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0;
diff --git a/vcl/win/source/window/salmenu.cxx b/vcl/win/source/window/salmenu.cxx
index 1eb75969ea38..47da911b012e 100644
--- a/vcl/win/source/window/salmenu.cxx
+++ b/vcl/win/source/window/salmenu.cxx
@@ -59,7 +59,7 @@ BOOL SalData::IsKnownMenuHandle( HMENU hMenu )
// WinSalInst factory methods
-SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar )
+SalMenu* WinSalInstance::CreateMenu( BOOL bMenuBar, Menu* )
{
WinSalMenu *pSalMenu = new WinSalMenu();
diff --git a/vcl/workben/makefile.mk b/vcl/workben/makefile.mk
index 67c0289cc24f..abd0c23a3607 100644
--- a/vcl/workben/makefile.mk
+++ b/vcl/workben/makefile.mk
@@ -34,6 +34,8 @@ TARGETTYPE=GUI
ENABLE_EXCEPTIONS=TRUE
+my_components = i18npool i18nsearch
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
@@ -136,16 +138,18 @@ APP5STDLIBS+=-lsocket
.ENDIF
.INCLUDE : target.mk
-.IF "$(L10N_framework)"==""
-ALLTAR : $(BIN)$/applicat.rdb
+ALLTAR : $(BIN)/applicat.rdb $(BIN)/types.rdb
+$(BIN)/applicat.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/applicat.input $(my_components:^"$(SOLARXMLDIR)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/applicat.input
-$(BIN)$/applicat.rdb : makefile.mk $(UNOUCRRDB)
- rm -f $@
- $(GNUCOPY) $(UNOUCRRDB) $@
- cd $(BIN) && \
- $(REGCOMP) -register -r applicat.rdb \
- -c i18nsearch.uno$(DLLPOST) \
- -c i18npool.uno$(DLLPOST)
-.ENDIF
+$(MISC)/applicat.input :
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
+
+$(BIN)/types.rdb : $(SOLARBINDIR)/types.rdb
+ $(COPY) $< $@
diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx
index 5822f4024a59..297660d4b8df 100644
--- a/vcl/workben/svdem.cxx
+++ b/vcl/workben/svdem.cxx
@@ -55,7 +55,7 @@ SAL_IMPLEMENT_MAIN()
tools::extendApplicationEnvironment();
Reference< XMultiServiceFactory > xMS;
- xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+ xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
InitVCL( xMS );
::Main();
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index cc7c0f2b0cce..8f901d1c200b 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -61,7 +61,7 @@ SAL_IMPLEMENT_MAIN()
tools::extendApplicationEnvironment();
Reference< XMultiServiceFactory > xMS;
- xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+ xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
InitVCL( xMS );
::Main();
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 41ca76144e5c..dafd546b3d68 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -60,7 +60,7 @@ SAL_IMPLEMENT_MAIN()
tools::extendApplicationEnvironment();
Reference< XMultiServiceFactory > xMS;
- xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
+ xMS = cppu::createRegistryServiceFactory( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "types.rdb" ) ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
InitVCL( xMS );
::Main();