summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-10-21 17:32:19 +0200
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM>2010-10-21 17:32:19 +0200
commit4e7fc8143e0beb20a73710ea83d85454d36d8cec (patch)
treeae1f3984c4af4a155988e9a311266ea5a08241f7 /vcl
parent9c90c77200562328c226f35cb14ee6ae9a135b71 (diff)
parent2a8b5063b765105e7092c763694bcdc59fdaf5c0 (diff)
rebase to DEV300_m90
Diffstat (limited to 'vcl')
-rwxr-xr-xvcl/aqua/inc/salframeview.h4
-rw-r--r--vcl/aqua/inc/salgdi.h6
-rw-r--r--vcl/aqua/source/a11y/aqua11yselectionwrapper.mm25
-rw-r--r--vcl/aqua/source/app/salinst.cxx1
-rw-r--r--vcl/aqua/source/dtrans/aqua_clipboard.cxx30
-rw-r--r--vcl/aqua/source/dtrans/aqua_service.cxx22
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx34
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx8
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx2
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm65
-rw-r--r--vcl/inc/cupsmgr.hxx4
-rw-r--r--vcl/inc/vcl/combobox.hxx1
-rw-r--r--vcl/inc/vcl/glyphcache.hxx3
-rw-r--r--vcl/inc/vcl/impfont.hxx8
-rw-r--r--vcl/inc/vcl/jobdata.hxx4
-rw-r--r--vcl/inc/vcl/metric.hxx4
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx27
-rw-r--r--vcl/inc/vcl/print.hxx15
-rw-r--r--vcl/inc/vcl/printerinfomanager.hxx6
-rw-r--r--vcl/inc/vcl/prntypes.hxx1
-rw-r--r--vcl/inc/vcl/saldatabasic.hxx10
-rw-r--r--vcl/inc/vcl/salgdi.hxx2
-rw-r--r--vcl/inc/vcl/svdata.hxx1
-rw-r--r--vcl/os2/inc/salgdi.h4
-rw-r--r--vcl/os2/source/gdi/salgdi3.cxx10
-rw-r--r--vcl/prj/build.lst7
-rw-r--r--vcl/prj/d.lst2
-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/components/factory.cxx56
-rw-r--r--vcl/source/control/combobox.cxx8
-rw-r--r--vcl/source/control/ilstbox.cxx16
-rw-r--r--vcl/source/gdi/gdimtf.cxx4
-rw-r--r--vcl/source/gdi/impprn.cxx584
-rw-r--r--vcl/source/gdi/metaact.cxx2
-rw-r--r--vcl/source/gdi/metric.cxx38
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/outdev2.cxx11
-rw-r--r--vcl/source/gdi/outdev3.cxx9
-rw-r--r--vcl/source/gdi/pdfwriter.cxx13
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx17
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx11
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx1003
-rwxr-xr-xvcl/source/gdi/print3.cxx24
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx57
-rw-r--r--vcl/source/glyphs/gcach_ftyp.hxx7
-rw-r--r--vcl/source/glyphs/glyphcache.cxx18
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx1
-rw-r--r--vcl/source/window/dlgctrl.cxx101
-rw-r--r--vcl/source/window/printdlg.cxx1
-rw-r--r--vcl/source/window/seleng.cxx19
-rw-r--r--vcl/source/window/syswin.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx2
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx25
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx3
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx68
-rw-r--r--vcl/unx/headless/svpgdi.hxx2
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx9
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx2
-rw-r--r--vcl/unx/headless/svptext.cxx8
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx4
-rw-r--r--vcl/unx/inc/pspgraphics.h2
-rw-r--r--vcl/unx/inc/salgdi.h2
-rw-r--r--vcl/unx/inc/salprn.h6
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx9
-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.cxx20
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx13
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx323
-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/printerinfomanager.cxx50
-rw-r--r--vcl/unx/source/printergfx/printerjob.cxx5
-rw-r--r--vcl/util/makefile.mk16
-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.h25
-rw-r--r--vcl/win/source/gdi/salbmp.cxx4
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx25
-rw-r--r--[-rwxr-xr-x]vcl/win/source/gdi/winlayout.cxx31
-rwxr-xr-x[-rw-r--r--]vcl/win/source/window/salframe.cxx57
-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
95 files changed, 3244 insertions, 1475 deletions
diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h
index 996ca54cdfce..e7d9a14b52aa 100755
--- a/vcl/aqua/inc/salframeview.h
+++ b/vcl/aqua/inc/salframeview.h
@@ -78,6 +78,10 @@
id mpMouseEventListener;
id mDraggingDestinationHandler;
NSEvent* mpLastSuperEvent;
+
+ // #i102807# used by magnify event handler
+ NSTimeInterval mfLastMagnifyTime;
+ float mfMagnifyDeltaSum;
}
+(void)unsetMouseFrame: (AquaSalFrame*)pFrame;
-(id)initWithSalFrame: (AquaSalFrame*)pFrame;
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index a3d6c2793aae..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
@@ -281,7 +281,7 @@ public:
// 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/source/a11y/aqua11yselectionwrapper.mm b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm
index 53ab6dd36128..804cf108dba8 100644
--- a/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11yselectionwrapper.mm
@@ -40,20 +40,23 @@ using namespace ::com::sun::star::uno;
+(id)selectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper
{
Reference< XAccessibleSelection > xAccessibleSelection = [ wrapper accessibleSelection ];
- NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
-
- try {
- sal_Int32 n = xAccessibleSelection -> getSelectedAccessibleChildCount();
- for ( sal_Int32 i=0 ; i < n ; ++i ) {
- [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ];
+ if( xAccessibleSelection.is() )
+ {
+ NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
+ try {
+ sal_Int32 n = xAccessibleSelection -> getSelectedAccessibleChildCount();
+ for ( sal_Int32 i=0 ; i < n ; ++i ) {
+ [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ];
+ }
+
+ return children;
+
+ } catch ( Exception& e)
+ {
}
-
- return children;
-
- } catch ( Exception& e) {
- return nil;
}
+ return nil;
}
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index cce018ac6229..2ebb24437c24 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -450,7 +450,6 @@ SalInstance* CreateSalInstance()
ImplGetSVData()->maNWFData.mbProgressNeedsErase = true;
ImplGetSVData()->maNWFData.mbCheckBoxNeedsErase = true;
ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset = 10;
- ImplGetSVData()->maGDIData.mbPrinterPullModel = true;
ImplGetSVData()->maGDIData.mbNoXORClipping = true;
ImplGetSVData()->maWinData.mbNoSaveBackground = true;
diff --git a/vcl/aqua/source/dtrans/aqua_clipboard.cxx b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
index 52fb13e1e11f..abffeebcb6c1 100644
--- a/vcl/aqua/source/dtrans/aqua_clipboard.cxx
+++ b/vcl/aqua/source/dtrans/aqua_clipboard.cxx
@@ -322,14 +322,17 @@ void AquaClipboard::fireLostClipboardOwnershipEvent(Reference<XClipboardOwner> o
void AquaClipboard::provideDataForType(NSPasteboard* sender, NSString* type)
{
- DataProviderPtr_t dp = mpDataFlavorMapper->getDataProvider(type, mXClipboardContent);
- NSData* pBoardData = NULL;
-
- if (dp.get() != NULL)
- {
- pBoardData = (NSData*)dp->getSystemData();
- [sender setData: pBoardData forType: type];
- }
+ if( mXClipboardContent.is() )
+ {
+ DataProviderPtr_t dp = mpDataFlavorMapper->getDataProvider(type, mXClipboardContent);
+ NSData* pBoardData = NULL;
+
+ if (dp.get() != NULL)
+ {
+ pBoardData = (NSData*)dp->getSystemData();
+ [sender setData: pBoardData forType: type];
+ }
+ }
}
@@ -340,20 +343,21 @@ void AquaClipboard::provideDataForType(NSPasteboard* sender, NSString* type)
void SAL_CALL AquaClipboard::flushClipboard()
throw(RuntimeException)
{
- if (mXClipboardContent.is())
+ if (mXClipboardContent.is())
{
Sequence<DataFlavor> flavorList = mXClipboardContent->getTransferDataFlavors();
sal_uInt32 nFlavors = flavorList.getLength();
for (sal_uInt32 i = 0; i < nFlavors; i++)
- {
+ {
NSString* sysType = mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
if (sysType != NULL)
- {
+ {
provideDataForType(mPasteboard, sysType);
- }
- }
+ }
+ }
+ mXClipboardContent.clear();
}
}
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/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 96569aa80120..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;
}
@@ -1453,16 +1455,24 @@ BOOL AquaSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight,
// prepare the target context
NSGraphicsContext* pOrigNSCtx = [NSGraphicsContext currentContext];
+ [pOrigNSCtx retain];
+
+ // create new context
NSGraphicsContext* pDrawNSCtx = [NSGraphicsContext graphicsContextWithGraphicsPort: mrContext flipped: IsFlipped()];
+ // set it, setCurrentContext also releases the prviously set one
[NSGraphicsContext setCurrentContext: pDrawNSCtx];
+
// draw the EPS
const NSRect aDstRect = {{nX,nY},{nWidth,nHeight}};
const BOOL bOK = [xEpsImage drawInRect: aDstRect];
+
+ // restore the NSGraphicsContext
+ [NSGraphicsContext setCurrentContext: pOrigNSCtx];
+ [pOrigNSCtx release]; // restore the original retain count
+
CGContextRestoreGState( mrContext );
// mark the destination rectangle as updated
RefreshRect( aDstRect );
- // restore the NSGraphicsContext, TODO: do we need this?
- [NSGraphicsContext setCurrentContext: pOrigNSCtx];
return bOK;
}
@@ -1984,7 +1994,7 @@ USHORT AquaSalGraphics::SetFont( ImplFontSelectData* pReqFont, int nFallbackLeve
// -----------------------------------------------------------------------
-ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
+const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
{
if( !mpMacFontData )
return ImplFontCharMap::GetDefaultMap();
@@ -2359,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/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index 6e206977b5c4..9ce2b8a5a518 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -1366,10 +1366,12 @@ BOOL AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa
w = aCtrlBoundRect.GetWidth();
if( w < 3+2*FOCUS_RING_WIDTH )
w = 3+2*FOCUS_RING_WIDTH;
- h = TEXT_EDIT_HEIGHT_NORMAL;
+ h = TEXT_EDIT_HEIGHT_NORMAL+2*FOCUS_RING_WIDTH;
+ if( h < aCtrlBoundRect.GetHeight() )
+ h = aCtrlBoundRect.GetHeight();
- rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*FOCUS_RING_WIDTH-2, h-2 ) );
- rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h+2*FOCUS_RING_WIDTH ) );
+ rNativeContentRegion = Rectangle( Point( x+FOCUS_RING_WIDTH, y+FOCUS_RING_WIDTH ), Size( w-2*(FOCUS_RING_WIDTH+1), h-2*(FOCUS_RING_WIDTH+1) ) );
+ rNativeBoundingRegion = Rectangle( Point( x, y ), Size( w, h ) );
toReturn = TRUE;
}
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/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 935c987f65cc..240a915e4e12 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -392,6 +392,7 @@ static AquaSalFrame* getMouseContainerFrame()
mpLastSuperEvent = nil;
}
+ mfLastMagnifyTime = 0.0;
return self;
}
@@ -657,21 +658,40 @@ private:
// TODO: ?? -(float)magnification;
if( AquaSalFrame::isAlive( mpFrame ) )
- {
- mpFrame->mnLastEventTime = static_cast<ULONG>( [pEvent timestamp] * 1000.0 );
+ {
+ const NSTimeInterval fMagnifyTime = [pEvent timestamp];
+ mpFrame->mnLastEventTime = static_cast<ULONG>( fMagnifyTime * 1000.0 );
mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
- float dZ = 0.0;
- for(;;)
+
+ // check if this is a new series of magnify events
+ static const NSTimeInterval fMaxDiffTime = 0.3;
+ const bool bNewSeries = (fMagnifyTime - mfLastMagnifyTime > fMaxDiffTime);
+
+ if( bNewSeries )
+ mfMagnifyDeltaSum = 0.0;
+ mfMagnifyDeltaSum += [pEvent deltaZ];
+
+ mfLastMagnifyTime = [pEvent timestamp];
+ // TODO: change to 0.1 when COMMAND_WHEEL_ZOOM handlers allow finer zooming control
+ static const float fMagnifyFactor = 0.25;
+ static const float fMinMagnifyStep = 15.0 / fMagnifyFactor;
+ if( fabs(mfMagnifyDeltaSum) <= fMinMagnifyStep )
+ return;
+
+ // adapt NSEvent-sensitivity to application expectations
+ // TODO: rather make COMMAND_WHEEL_ZOOM handlers smarter
+ const float fDeltaZ = mfMagnifyDeltaSum * fMagnifyFactor;
+ int nDeltaZ = FRound( fDeltaZ );
+ if( !nDeltaZ )
{
- dZ += [pEvent deltaZ];
- NSEvent* pNextEvent = [NSApp nextEventMatchingMask: NSScrollWheelMask
- untilDate: nil inMode: NSDefaultRunLoopMode dequeue: YES ];
- if( !pNextEvent )
- break;
- pEvent = pNextEvent;
+ // handle new series immediately
+ if( !bNewSeries )
+ return;
+ nDeltaZ = (fDeltaZ >= 0.0) ? +1 : -1;
}
-
+ // eventually give credit for delta sum
+ mfMagnifyDeltaSum -= nDeltaZ / fMagnifyFactor;
+
NSPoint aPt = [NSEvent mouseLocation];
mpFrame->CocoaToVCL( aPt );
@@ -687,18 +707,15 @@ private:
if( Application::GetSettings().GetLayoutRTL() )
aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX;
- if( dZ != 0.0 )
- {
- aEvent.mnDelta = static_cast<long>(floor(dZ));
- aEvent.mnNotchDelta = dZ < 0 ? -1 : 1;
- if( aEvent.mnDelta == 0 )
- aEvent.mnDelta = aEvent.mnNotchDelta;
- aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR;
- if( aEvent.mnScrollLines == 0 )
- aEvent.mnScrollLines = 1;
- mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
- }
+ aEvent.mnDelta = nDeltaZ;
+ aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
+ aEvent.mbHorz = FALSE;
+ aEvent.mnScrollLines = nDeltaZ;
+ if( aEvent.mnScrollLines == 0 )
+ aEvent.mnScrollLines = 1;
+ mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
}
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/combobox.hxx b/vcl/inc/vcl/combobox.hxx
index e35474a84d53..640c70e7116f 100644
--- a/vcl/inc/vcl/combobox.hxx
+++ b/vcl/inc/vcl/combobox.hxx
@@ -138,6 +138,7 @@ public:
USHORT GetEntryPos( const XubString& rStr ) const;
USHORT GetEntryPos( const void* pData ) const;
+ Image GetEntryImage( USHORT nPos ) const;
XubString GetEntry( USHORT nPos ) const;
USHORT GetEntryCount() 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/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/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/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/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx
index 204ddaa9e33c..52e4b5014120 100644
--- a/vcl/inc/vcl/pdfwriter.hxx
+++ b/vcl/inc/vcl/pdfwriter.hxx
@@ -48,6 +48,7 @@
class Font;
class Point;
class OutputDevice;
+class GDIMetaFile;
class MapMode;
class Polygon;
class LineInfo;
@@ -62,6 +63,8 @@ class Wallpaper;
namespace vcl
{
+class PDFExtOutDevData;
+
struct PDFNote
{
String Title; // optional title for the popup containing the note
@@ -594,6 +597,8 @@ The following structure describes the permissions used in PDF security
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?
@@ -620,7 +625,9 @@ The following structure describes the permissions used in PDF security
FirstPageLeft( false ),
InitialPage( 1 ),
OpenBookmarkLevels( -1 ),
- Encryption()
+ Encryption(),
+ DPIx( 0 ),
+ DPIy( 0 )
{}
};
@@ -649,6 +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 )
+ {}
+
+ };
+ 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>.
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index be7633f13d53..c389034d918f 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -514,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;
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/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/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 cbe3581bedc4..d8276406746e 100644
--- a/vcl/inc/vcl/salgdi.hxx
+++ b/vcl/inc/vcl/salgdi.hxx
@@ -239,7 +239,7 @@ public:
// 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/svdata.hxx b/vcl/inc/vcl/svdata.hxx
index 1c36f7b5d2b8..f5377491ab4d 100644
--- a/vcl/inc/vcl/svdata.hxx
+++ b/vcl/inc/vcl/svdata.hxx
@@ -210,7 +210,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
};
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/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/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 084153d8265b..4f1e102c3981 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
@@ -155,4 +156,5 @@ mkdir: %_DEST%\inc%_EXT%\vcl
..\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/components/factory.cxx b/vcl/source/components/factory.cxx
index 6bed493cacde..c4debea79001 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -84,62 +84,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,
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 8efa3404a44a..5b2e8755e5c8 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1010,6 +1010,14 @@ void ComboBox::Clear()
mpImplLB->Clear();
CallEventListeners( VCLEVENT_COMBOBOX_ITEMREMOVED, (void*) sal_IntPtr(-1) );
}
+// -----------------------------------------------------------------------
+
+Image ComboBox::GetEntryImage( USHORT nPos ) const
+{
+ if ( mpImplLB->GetEntryList()->HasEntryImage( nPos ) )
+ return mpImplLB->GetEntryList()->GetEntryImage( nPos );
+ return Image();
+}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 02c8d2b5fcb3..b4b7e3f80357 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2356,7 +2356,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 +2399,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 +2436,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/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 818a31a10c0f..d36a18a1afba 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -873,8 +873,8 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY )
{
aOffset = aMapVDev.LogicToPixel( aBaseOffset, GetPrefMapMode() );
MapMode aMap( aMapVDev.GetMapMode() );
- aOffset.Width() = aOffset.Width() * (double)aMap.GetScaleX();
- aOffset.Height() = aOffset.Height() * (double)aMap.GetScaleY();
+ aOffset.Width() = static_cast<long>(aOffset.Width() * (double)aMap.GetScaleX());
+ aOffset.Height() = static_cast<long>(aOffset.Height() * (double)aMap.GetScaleY());
}
else
aOffset = aMapVDev.LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() );
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/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 94f07b8f17d1..8c1545758c3b 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -3793,7 +3793,6 @@ MetaAction* MetaFloatTransparentAction::Clone()
void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove )
{
maPoint.Move( nHorzMove, nVertMove );
- maMtf.Move(nHorzMove, nVertMove);
}
// ------------------------------------------------------------------------
@@ -3804,7 +3803,6 @@ void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY )
ImplScaleRect( aRectangle, fScaleX, fScaleY );
maPoint = aRectangle.TopLeft();
maSize = aRectangle.GetSize();
- maMtf.Scale(fScaleX, fScaleY);
}
// ------------------------------------------------------------------------
diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx
index dffc7c82caf0..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 )
@@ -285,7 +289,7 @@ ImplFontCharMap::~ImplFontCharMap()
delete[] mpRangeCodes;
delete[] mpStartGlyphs;
delete[] mpGlyphIds;
-}
+ }
// -----------------------------------------------------------------------
@@ -293,14 +297,13 @@ namespace
{
ImplFontCharMap *GetDefaultUnicodeMap()
{
- if( pDefaultUnicodeImplFontCharMap )
- pDefaultUnicodeImplFontCharMap->AddReference();
- else
+ if( !pDefaultUnicodeImplFontCharMap )
{
const sal_uInt32* pRangeCodes = aDefaultUnicodeRanges;
int nCodesCount = sizeof(aDefaultUnicodeRanges) / sizeof(*pRangeCodes);
CmapResult aDefaultCR( false, pRangeCodes, nCodesCount/2 );
pDefaultUnicodeImplFontCharMap = new ImplFontCharMap( aDefaultCR );
+ pDefaultUnicodeImplFontCharMap->AddReference();
}
return pDefaultUnicodeImplFontCharMap;
@@ -308,14 +311,13 @@ namespace
ImplFontCharMap *GetDefaultSymbolMap()
{
- if( pDefaultSymbolImplFontCharMap )
- pDefaultSymbolImplFontCharMap->AddReference();
- else
+ 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;
@@ -329,14 +331,15 @@ ImplFontCharMap* ImplFontCharMap::GetDefaultMap( bool bSymbols)
// -----------------------------------------------------------------------
-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 != pDefaultUnicodeImplFontCharMap) && (this != pDefaultSymbolImplFontCharMap) )
@@ -833,7 +836,9 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
FontCharMap::FontCharMap()
: mpImpl( ImplFontCharMap::GetDefaultMap() )
-{}
+{
+ mpImpl->AddReference();
+}
// -----------------------------------------------------------------------
@@ -859,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/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index bea307a4c38d..06dcd73cc3d4 100644..100755
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1988,7 +1988,15 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
const long nSrcWidth = aBmpRect.GetWidth(), nSrcHeight = aBmpRect.GetHeight();
const long nDstWidth = aDstRect.GetWidth(), nDstHeight = aDstRect.GetHeight();
const long nOutWidth = aOutSz.Width(), nOutHeight = aOutSz.Height();
- const long nOffX = aDstRect.Left() - aOutPt.X(), nOffY = aDstRect.Top() - aOutPt.Y();
+ // calculate offset in original bitmap
+ // in RTL case this is a little more complicated since the contents of the
+ // bitmap is not mirrored (it never is), however the paint region and bmp region
+ // are in mirrored coordinates, so the intersection of (aOutPt,aOutSz) with these
+ // is content wise somewhere else and needs to take mirroring into account
+ const long nOffX = IsRTLEnabled()
+ ? aOutSz.Width() - aDstRect.GetWidth() - (aDstRect.Left() - aOutPt.X())
+ : aDstRect.Left() - aOutPt.X(),
+ nOffY = aDstRect.Top() - aOutPt.Y();
long nX, nOutX, nY, nOutY;
long nMirrOffX = 0;
long nMirrOffY = 0;
@@ -2002,7 +2010,6 @@ void OutputDevice::ImplDrawAlpha( const Bitmap& rBmp, const AlphaMask& rAlpha,
for( nX = 0L, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
pMapX[ nX ] = aBmpRect.Left() + nOutX * nSrcWidth / nOutWidth;
-
if( bHMirr )
pMapX[ nX ] = nMirrOffX - pMapX[ nX ];
}
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 63bc233ef4e0..8eb4dec3c92a 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1531,7 +1531,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();
@@ -8017,7 +8017,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;
@@ -8035,10 +8035,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;
@@ -8049,6 +8051,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 98627b448aed..2d9412cc93b4 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -40,7 +40,7 @@ PDFWriter::AnyWidget::~AnyWidget()
PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc )
:
- pImplementation( new PDFWriterImpl( rContext, xEnc ) )
+ pImplementation( new PDFWriterImpl( rContext, xEnc, *this ) )
{
}
@@ -560,12 +560,23 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors()
return ((PDFWriterImpl*)pImplementation)->getErrors();
}
+<<<<<<< local
com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
PDFWriter::InitEncryption( const rtl::OUString& i_rOwnerPassword,
const rtl::OUString& i_rUserPassword,
bool b128Bit
)
+=======
+void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData )
+>>>>>>> other
{
+<<<<<<< local
return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword, b128Bit );
+=======
+ ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL);
+>>>>>>> other
}
+<<<<<<< local
+=======
+>>>>>>> other
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 1e39f0e46260..821eeae9fa55 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1698,7 +1698,8 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
*/
PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
- const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc )
+ 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) ) ),
@@ -1721,7 +1722,8 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
m_bEncryptThisStream( false ),
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;
@@ -2162,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 );
@@ -8529,6 +8534,7 @@ void PDFWriterImpl::beginRedirect( SvStream* pStream, const Rectangle& rTargetRe
{
push( PUSH_ALL );
+ // force reemitting clip region
clearClipRegion();
updateGraphicsState();
@@ -8572,7 +8578,10 @@ SvStream* PDFWriterImpl::endRedirect()
}
pop();
- // force reemitting colors
+ // force reemitting colors and clip region
+ clearClipRegion();
+ m_aCurrentPDFState.m_bClipRegion = m_aGraphicsStack.front().m_bClipRegion;
+ m_aCurrentPDFState.m_aClipRegion = m_aGraphicsStack.front().m_aClipRegion;
m_aCurrentPDFState.m_aLineColor = Color( COL_TRANSPARENT );
m_aCurrentPDFState.m_aFillColor = Color( COL_TRANSPARENT );
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 212a45c77033..5702bee23ea5 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -1016,6 +1016,7 @@ i12626
/* true if PDF/A-1a or PDF/A-1b is output */
sal_Bool m_bIsPDF_A1;
+ PDFWriter& m_rOuterFace;
/*
i12626
@@ -1049,8 +1050,15 @@ i12626
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, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& );
+ 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 >
@@ -1079,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
{
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index c0e9d905db3b..ee1fe1cc6bc5 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -25,11 +25,24 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#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>
@@ -37,6 +50,994 @@
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
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 8b4bf5163839..9d8f3bf2f9a0 100755
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -175,6 +175,7 @@ public:
// if set, pages are centered and trimmed onto the fixed page
Size maFixedPageSize;
sal_Int32 mnDefaultPaperBin;
+ sal_Int32 mnFixedPaperBin;
ImplPrinterControllerData() :
mbFirstPage( sal_True ),
@@ -182,7 +183,8 @@ public:
mbReversePageOrder( sal_False ),
meJobState( view::PrintableState_JOB_STARTED ),
mpProgress( NULL ),
- mnDefaultPaperBin( -1 )
+ mnDefaultPaperBin( -1 ),
+ mnFixedPaperBin( -1 )
{}
~ImplPrinterControllerData() { delete mpProgress; }
@@ -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
@@ -728,6 +730,7 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
makeAny( rtl::OUString( i_rPrinter->GetName() ) ) );
mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin();
+ mpImplData->mnFixedPaperBin = -1;
}
bool PrinterController::setupPrinter( Window* i_pParent )
@@ -735,15 +738,20 @@ bool PrinterController::setupPrinter( Window* i_pParent )
bool bRet = false;
if( mpImplData->mpPrinter.get() )
{
+ // get old data
Size aPaperSize( mpImplData->mpPrinter->PixelToLogic(
mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ USHORT nPaperBin = mpImplData->mpPrinter->GetPaperBin();
+
+ // call driver setup
bRet = mpImplData->mpPrinter->Setup( i_pParent );
if( bRet )
{
- // was the papersize overridden ? if so we need to take action
+ // was papersize or bin overridden ? if so we need to take action
Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic(
mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
- if( aNewPaperSize != aPaperSize )
+ USHORT nNewPaperBin = mpImplData->mpPrinter->GetPaperBin();
+ if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin )
{
mpImplData->maFixedPageSize = aNewPaperSize;
mpImplData->maPageCache.invalidate();
@@ -752,6 +760,7 @@ bool PrinterController::setupPrinter( Window* i_pParent )
aOverrideSize.Height = aNewPaperSize.Height();
setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ),
makeAny( aOverrideSize ) );
+ mpImplData->mnFixedPaperBin = nNewPaperBin;
}
}
}
@@ -1149,8 +1158,13 @@ void PrinterController::printFilteredPage( int i_nPage )
mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM );
// aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile()
mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() );
+ if( mpImplData->mnFixedPaperBin != -1 &&
+ mpImplData->mpPrinter->GetPaperBin() != mpImplData->mnFixedPaperBin )
+ {
+ mpImplData->mpPrinter->SetPaperBin( mpImplData->mnFixedPaperBin );
+ }
- // if full paper are is meant, move the output to accomodate for pageoffset
+ // if full paper is meant to be used, move the output to accomodate for pageoffset
if( aPageSize.bFullPaper )
{
Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() );
diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx
index aeb928c46608..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
+ }
}
// -----------------------------------------------------------------------
@@ -1733,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_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 9d4d2529249d..8a011606ab41 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -1085,6 +1085,7 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
mvCharDxs[i] = FRound( fXFactor * mvCharDxs[i] );
}
}
+ mnWidth = rArgs.mnLayoutWidth;
}
void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth)
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 64f2b7e0d2a1..055b7e9fe80b 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -1058,29 +1058,10 @@ static sal_Unicode getAccel( const String& rStr )
return nChar;
}
-Window* Window::GetLabelFor() const
+static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window* pLabel, sal_Unicode nAccel )
{
- if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
- return NULL;
-
Window* pWindow = NULL;
- Window* pFrameWindow = ImplGetFrameWindow();
-
- WinBits nFrameStyle = pFrameWindow->GetStyle();
- if( ! ( nFrameStyle & WB_DIALOGCONTROL )
- || ( nFrameStyle & WB_NODIALOGCONTROL )
- )
- return NULL;
-
- if ( mpWindowImpl->mpRealParent )
- pWindow = mpWindowImpl->mpRealParent->GetParentLabelFor( this );
-
- if( pWindow )
- return pWindow;
- sal_Unicode nAccel = getAccel( GetText() );
-
- WindowType nMyType = GetType();
if( nMyType == WINDOW_FIXEDTEXT ||
nMyType == WINDOW_FIXEDLINE ||
nMyType == WINDOW_GROUPBOX )
@@ -1092,7 +1073,7 @@ Window* Window::GetLabelFor() const
// get index, form start and form end
USHORT nIndex=0, nFormStart=0, nFormEnd=0;
pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
- const_cast<Window*>(this),
+ pLabel,
nIndex,
nFormStart,
nFormEnd );
@@ -1139,32 +1120,39 @@ Window* Window::GetLabelFor() const
return pWindow;
}
-// -----------------------------------------------------------------------
-
-Window* Window::GetLabeledBy() const
+Window* Window::GetLabelFor() const
{
- if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
+ if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
return NULL;
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
+ WinBits nFrameStyle = pFrameWindow->GetStyle();
+ if( ! ( nFrameStyle & WB_DIALOGCONTROL )
+ || ( nFrameStyle & WB_NODIALOGCONTROL )
+ )
+ return NULL;
+
if ( mpWindowImpl->mpRealParent )
- pWindow = mpWindowImpl->mpRealParent->GetParentLabeledBy( this );
+ pWindow = mpWindowImpl->mpRealParent->GetParentLabelFor( this );
if( pWindow )
return pWindow;
- // #i62723#, #104191# checkboxes and radiobuttons are not supposed to have labels
- if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON )
- return NULL;
+ sal_Unicode nAccel = getAccel( GetText() );
-// if( ! ( GetType() == WINDOW_FIXEDTEXT ||
-// GetType() == WINDOW_FIXEDLINE ||
-// GetType() == WINDOW_GROUPBOX ) )
- // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text.
- // See tools/options/print for example.
- WindowType nMyType = GetType();
+ pWindow = ImplGetLabelFor( pFrameWindow, GetType(), const_cast<Window*>(this), nAccel );
+ if( ! pWindow && mpWindowImpl->mpRealParent )
+ pWindow = ImplGetLabelFor( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this), nAccel );
+ return pWindow;
+}
+
+// -----------------------------------------------------------------------
+
+static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Window* pLabeled )
+{
+ Window* pWindow = NULL;
if ( (nMyType != WINDOW_GROUPBOX) && (nMyType != WINDOW_FIXEDLINE) )
{
// search for a control that labels this window
@@ -1176,16 +1164,16 @@ Window* Window::GetLabeledBy() const
// get form start and form end and index of this control
USHORT nIndex, nFormStart, nFormEnd;
Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
- const_cast<Window*>(this),
+ pLabeled,
nIndex,
nFormStart,
nFormEnd );
if( pSWindow && nIndex != nFormStart )
{
- if( GetType() == WINDOW_PUSHBUTTON ||
- GetType() == WINDOW_HELPBUTTON ||
- GetType() == WINDOW_OKBUTTON ||
- GetType() == WINDOW_CANCELBUTTON )
+ if( nMyType == WINDOW_PUSHBUTTON ||
+ nMyType == WINDOW_HELPBUTTON ||
+ nMyType == WINDOW_OKBUTTON ||
+ nMyType == WINDOW_CANCELBUTTON )
{
nFormStart = nIndex-1;
}
@@ -1217,6 +1205,39 @@ Window* Window::GetLabeledBy() const
return pWindow;
}
+Window* Window::GetLabeledBy() const
+{
+ if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
+ return NULL;
+
+ Window* pWindow = NULL;
+ Window* pFrameWindow = ImplGetFrameWindow();
+
+ if ( mpWindowImpl->mpRealParent )
+ {
+ pWindow = mpWindowImpl->mpRealParent->GetParentLabeledBy( this );
+
+ if( pWindow )
+ return pWindow;
+ }
+
+ // #i62723#, #104191# checkboxes and radiobuttons are not supposed to have labels
+ if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON )
+ return NULL;
+
+// if( ! ( GetType() == WINDOW_FIXEDTEXT ||
+// GetType() == WINDOW_FIXEDLINE ||
+// GetType() == WINDOW_GROUPBOX ) )
+ // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text.
+ // See tools/options/print for example.
+
+ pWindow = ImplGetLabeledBy( pFrameWindow, GetType(), const_cast<Window*>(this) );
+ if( ! pWindow && mpWindowImpl->mpRealParent )
+ pWindow = ImplGetLabeledBy( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this) );
+
+ return pWindow;
+}
+
// -----------------------------------------------------------------------
KeyEvent Window::GetActivationKey() const
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 68e0c402d80f..390b9493a057 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -2542,6 +2542,7 @@ void PrintProgressDialog::tick()
void PrintProgressDialog::reset()
{
+ mbCanceled = false;
setProgress( 0 );
}
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index d4ee01c26d61..322b2937b5c9 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -218,8 +218,15 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
Point aPos = rMEvt.GetPosPixel();
aLastMove = rMEvt;
- pWin->CaptureMouse();
- nFlags |= SELENG_IN_SEL;
+ if( !rMEvt.IsRight() )
+ {
+ pWin->CaptureMouse();
+ nFlags |= SELENG_IN_SEL;
+ }
+ else
+ {
+ nModifier = 0;
+ }
switch ( nModifier )
{
@@ -327,7 +334,7 @@ BOOL SelectionEngine::SelMouseButtonDown( const MouseEvent& rMEvt )
|*
*************************************************************************/
-BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ )
+BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& rMEvt )
{
aWTimer.Stop();
//DbgOut("Up");
@@ -336,7 +343,11 @@ BOOL SelectionEngine::SelMouseButtonUp( const MouseEvent& /* rMEvt */ )
nFlags &= ~(SELENG_CMDEVT | SELENG_WAIT_UPEVT | SELENG_IN_SEL);
return FALSE;
}
- pWin->ReleaseMouse();
+
+ if( !rMEvt.IsRight() )
+ {
+ pWin->ReleaseMouse();
+ }
if( (nFlags & SELENG_WAIT_UPEVT) && !(nFlags & SELENG_CMDEVT) &&
eSelMode != SINGLE_SELECTION)
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index f3624ef56f59..f6a37658b79f 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -773,7 +773,7 @@ void SystemWindow::SetWindowStateData( const WindowStateData& rData )
BOOL bWrapped = FALSE;
while( pWin )
{
- if( !pWin->ImplIsRealParentPath( this ) &&
+ if( !pWin->ImplIsRealParentPath( this ) && ( pWin != this ) &&
pWin->ImplGetWindow()->IsTopWindow() && pWin->mpWindowImpl->mbReallyVisible )
{
SalFrameGeometry g = pWin->mpWindowImpl->mpFrame->GetGeometry();
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index ad33cdf67de6..076e36291ae6 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -91,7 +91,7 @@ atk_wrapper_focus_idle_handler (gpointer data)
// also emit state-changed:focused event under the same condition.
{
AtkObjectWrapper* wrapper_obj = ATK_OBJECT_WRAPPER (atk_obj);
- if( !wrapper_obj->mpText && wrapper_obj->mpContext )
+ if( wrapper_obj && !wrapper_obj->mpText && wrapper_obj->mpContext )
{
uno::Any any = wrapper_obj->mpContext->queryInterface( accessibility::XAccessibleText::static_type(NULL) );
if ( typelib_TypeClass_INTERFACE == any.pType->eTypeClass &&
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index faedc7e5e600..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
@@ -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 b8a3ac773a8f..447a970f6bcd 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1047,8 +1047,9 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType,
GtkRequisition aReq;
gtk_widget_size_request( widget, &aReq );
Rectangle aEditRect = rControlRegion;
+ long nHeight = (aEditRect.GetHeight() > aReq.height+1) ? aEditRect.GetHeight() : aReq.height+1;
aEditRect = Rectangle( aEditRect.TopLeft(),
- Size( aEditRect.GetWidth(), aReq.height+1 ) );
+ Size( aEditRect.GetWidth(), nHeight ) );
rNativeBoundingRegion = aEditRect;
rNativeContentRegion = rNativeBoundingRegion;
returnVal = TRUE;
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index c6ff16f8395b..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,7 +1448,7 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
}
- if( m_bFullscreen )
+ if( m_bFullscreen && m_aMaxSize.Width() && m_aMaxSize.Height() )
{
aGeo.max_width = m_aMaxSize.Width();
aGeo.max_height = m_aMaxSize.Height();
@@ -1832,7 +1828,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
// workaround different legacy version window managers have different opinions about
// _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
+ }
if( bVisible )
Show( TRUE );
}
@@ -1863,11 +1863,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
if( bFullScreen )
{
- if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
- {
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
- }
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
gtk_window_fullscreen( GTK_WINDOW(m_pWindow) );
moveToScreen( nScreen );
Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
@@ -1879,11 +1876,8 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
else
{
gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
- if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
- {
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
- }
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
moveToScreen( nScreen );
}
}
@@ -2849,12 +2843,52 @@ gboolean GtkSalFrame::signalFocus( GtkWidget*, GdkEventFocus* pEvent, gpointer f
return FALSE;
}
+IMPL_LINK( GtkSalFrame, ImplDelayedFullScreenHdl, void*, EMPTYARG )
+{
+ Atom nStateAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE);
+ Atom nFSAtom = getDisplay()->getWMAdaptor()->getAtom(vcl_sal::WMAdaptor::NET_WM_STATE_FULLSCREEN );
+ if( nStateAtom && nFSAtom )
+ {
+ /* #i110881# workaround a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
+ gtk_window_fullscreen can fail due to a race condition, request an additional status change
+ to fullscreen to be safe
+ */
+ XEvent aEvent;
+ aEvent.type = ClientMessage;
+ aEvent.xclient.display = getDisplay()->GetDisplay();
+ aEvent.xclient.window = GDK_WINDOW_XWINDOW(m_pWindow->window);
+ aEvent.xclient.message_type = nStateAtom;
+ aEvent.xclient.format = 32;
+ aEvent.xclient.data.l[0] = 1;
+ aEvent.xclient.data.l[1] = nFSAtom;
+ aEvent.xclient.data.l[2] = 0;
+ aEvent.xclient.data.l[3] = 0;
+ aEvent.xclient.data.l[4] = 0;
+ XSendEvent( getDisplay()->GetDisplay(),
+ getDisplay()->GetRootWindow( m_nScreen ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ }
+
+ return 0;
+}
+
gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
{
GtkSalFrame* pThis = (GtkSalFrame*)frame;
GTK_YIELD_GRAB();
+ if( pThis->m_bFullscreen )
+ {
+ /* #i110881# workaorund a gtk issue (see https://bugzilla.redhat.com/show_bug.cgi?id=623191#c8)
+ gtk_window_fullscreen can run into a race condition with the window's showstate
+ */
+ Application::PostUserEvent( LINK( pThis, GtkSalFrame, ImplDelayedFullScreenHdl ) );
+ }
+
bool bSetFocus = pThis->m_bSetFocusOnMap;
pThis->m_bSetFocusOnMap = false;
if( ImplGetSVData()->mbIsTestTool )
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index 1ad9eca9d272..93ec080d0136 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -88,7 +88,7 @@ public:
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
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/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 86f356031f52..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 )
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 987923eb40ff..138198239621 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -107,7 +107,7 @@ public:
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
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 34941fc777db..dff1fd4d6ca7 100644
--- a/vcl/unx/headless/svptext.cxx
+++ b/vcl/unx/headless/svptext.cxx
@@ -272,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/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 18dd476fc2c4..d47e5fb50fca 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -38,6 +38,8 @@
#include <vcl/salframe.hxx>
#include <vcl/sysdata.hxx>
+#include "tools/link.hxx"
+
#include <list>
#include <vector>
@@ -265,6 +267,8 @@ class GtkSalFrame : public SalFrame
void setMinMaxSize();
void createNewWindow( XLIB_Window aParent, bool bXEmbed, int nScreen );
void askForXEmbedFocus( sal_Int32 nTimecode );
+
+ DECL_LINK( ImplDelayedFullScreenHdl, void* );
public:
GtkSalFrame( SalFrame* pParent, ULONG nStyle );
GtkSalFrame( SystemParentData* pSysData );
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index a91029e34580..d4f5a9f156e0 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -104,7 +104,7 @@ public:
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
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/salgdi.h b/vcl/unx/inc/salgdi.h
index 33e6be054d48..b5fdce50eee9 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -255,7 +255,7 @@ public:
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
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/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/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index 1a116fcbe8d6..aa2e4c84ef24 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -2180,6 +2180,15 @@ void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const
if( m_aWMAtoms[ NET_WM_STATE_FULLSCREEN ] )
{
pFrame->mbFullScreen = bFullScreen;
+ if( bFullScreen )
+ {
+ if( m_aWMAtoms[ MOTIF_WM_HINTS ] )
+ {
+ XDeleteProperty( m_pDisplay,
+ pFrame->GetShellWindow(),
+ m_aWMAtoms[ MOTIF_WM_HINTS ] );
+ }
+ }
if( pFrame->bMapped_ )
{
// window already mapped, send WM a message
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 03816857f27c..ecb4aa54549b 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,31 @@ 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];
+ // create a pattern to find eventually better alternatives
+ FcPattern* pTestPattern = FcPatternDuplicate( pOrigPattern );
+ FcPatternAddBool( pTestPattern, FC_OUTLINE, FcTrue );
+ // TODO: use pattern->ImplFontAttr->pattern to filter out
+ // all attribute that are not interesting for finding dupes
+ FcPatternDel( pTestPattern, FC_FONTVERSION );
+ FcPatternDel( pTestPattern, FC_CHARSET );
+ FcPatternDel( pTestPattern, FC_FILE );
+ // find the font face for the dupe-search pattern
+ FcResult eFcResult = FcResultMatch;
+ FcPattern* pBetterPattern = FcFontMatch( FcConfigGetCurrent(), pTestPattern, &eFcResult );
+ FcPatternDestroy( pTestPattern );
+ if( eFcResult != FcResultMatch )
continue;
- FcPatternReference(pOutlinePattern);
- FcFontSetAdd(m_pOutlineSet, pOutlinePattern);
+ // 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
@@ -509,22 +544,29 @@ namespace
std::vector<lang_and_family>::const_iterator aEnd = families.end();
bool alreadyclosematch = false;
- for (std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter)
+ for( std::vector<lang_and_family>::const_iterator aIter = families.begin(); aIter != aEnd; ++aIter )
{
const char *pLang = (const char*)aIter->first;
- //perfect
- if( rtl_str_compare(pLang,sFullMatch.getStr() ) == 0)
+ if( rtl_str_compare( pLang, sFullMatch.getStr() ) == 0)
{
+ // both language and country match
candidate = aIter->second;
break;
}
- else if( (rtl_str_compare(pLang,sLangMatch.getStr()) == 0) && (!alreadyclosematch))
+ else if( alreadyclosematch )
+ continue;
+ else if( rtl_str_compare( pLang, sLangMatch.getStr()) == 0)
{
+ // just the language matches
candidate = aIter->second;
alreadyclosematch = true;
}
+ else if( rtl_str_compare( pLang, "en") == 0)
+ {
+ // fallback to the english family name
+ candidate = aIter->second;
+ }
}
-
return candidate;
}
}
@@ -701,7 +743,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 )
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index 220d7bbcae87..bab78b0cb2df 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -694,7 +694,7 @@ void PspServerFontLayout::InitFont() const
static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx, bool bIsPspServerFontLayout )
{
const int nMaxGlyphs = 200;
- sal_GlyphId aGlyphAry[ nMaxGlyphs ];
+ sal_uInt32 aGlyphAry[ nMaxGlyphs ]; // TODO: use sal_GlyphId
sal_Int32 aWidthAry[ nMaxGlyphs ];
sal_Int32 aIdxAry [ nMaxGlyphs ];
sal_Unicode aUnicodes[ nMaxGlyphs ];
@@ -720,15 +720,20 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx
#ifdef ENABLE_GRAPHITE
else if (pGrLayout)
{
+ #if 0 // HACK: disabled for now due to #i114460#, see #desc12 there
+ // TODO: get rid of glyph->string mapping altogether for printing
+ // TODO: fix GraphiteServerFontLayout's returned aCharPosAry
+ // TODO: fix PrinterGfx's caching?
pText = pGrLayout->getTextPtr();
nMinCharPos = pGrLayout->getMinCharPos();
nMaxCharPos = pGrLayout->getMaxCharPos();
+ #endif
}
#endif
}
for( int nStart = 0;; )
{
- int nGlyphCount = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart, aWidthAry, bIsPspServerFontLayout ? aCharPosAry : NULL );
+ int nGlyphCount = rLayout.GetNextGlyphs( nMaxGlyphs, aGlyphAry, aPos, nStart, aWidthAry, pText ? aCharPosAry : NULL );
if( !nGlyphCount )
break;
@@ -738,7 +743,7 @@ static void DrawPrinterLayout( const SalLayout& rLayout, ::psp::PrinterGfx& rGfx
nXOffset += aWidthAry[ i ];
aIdxAry[ i ] = nXOffset / nUnitsPerPixel;
sal_Int32 nGlyphIdx = aGlyphAry[i] & (GF_IDXMASK | GF_ROTMASK);
- if( bIsPspServerFontLayout )
+ if( pText )
aUnicodes[i] = (aCharPosAry[i] >= nMinCharPos && aCharPosAry[i] <= nMaxCharPos) ? pText[ aCharPosAry[i] ] : 0;
else
aUnicodes[i] = (aGlyphAry[i] & GF_ISCHAR) ? nGlyphIdx : 0;
@@ -770,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 )
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 16529d3ce78f..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;
}
// ----------------------------------------------------------------------------
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index 8617bc4e5bfa..417704eb3b69 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,274 @@ 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.Encrypt = false;
+ aContext.DocumentLocale = Application::GetSettings().GetLocale();
+
+ // prepare doc info
+ vcl::PDFDocInfo aDocInfo;
+ aDocInfo.Title = i_rJobName;
+ aDocInfo.Creator = i_rAppName;
+ aDocInfo.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 ) );
+ #if defined __SUNPRO_CC
+ #pragma enable_warn
+ #endif
+ pWriter->SetDocInfo( aDocInfo );
+ }
+
+ 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/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index e1d499c40ca5..bd6ce761e989 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;
@@ -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..26a1d75f68c2 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);
}
@@ -610,7 +611,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/util/makefile.mk b/vcl/util/makefile.mk
index 04bc3f13ce4d..d21e9dcb3eed 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -391,9 +391,6 @@ SHL4STDLIBS+= $(XRANDR_LIBS)
.ENDIF
.ENDIF
-.IF "$(OS)$(CPU)" == "LINUXX"
-EXTRALIBPATHS+=-L$(LIBRARY_PATH)
-.ENDIF # "$(OS)$(CPU)" == "LINUXX"
.ENDIF # "$(ENABLE_GTK)" != ""
# KDE plugin
@@ -464,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/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 5b8cfb099756..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:
@@ -287,7 +287,7 @@ public:
// 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/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 01fecec94b2f..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();
}
// =======================================================================
@@ -2060,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();
@@ -2882,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
@@ -2906,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 )
{
@@ -2913,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() );
@@ -3167,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();
@@ -3184,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 806d3b420b33..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;
+ }
}
// -----------------------------------------------------------------------
@@ -2203,7 +2210,9 @@ void UniscribeLayout::Simplify( bool /*bIsBase*/ )
const int k = mpGlyphs2Chars[ i ];
mpGlyphs2Chars[ j ] = k;
const int nRelGlyphPos = (j++) - rVI.mnMinGlyphPos;
- mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos);
+ if( k < 0) // extra glyphs are already mapped
+ continue;
+ mpLogClusters[ k ] = static_cast<WORD>(nRelGlyphPos);
}
rVI.mnEndGlyphPos = j;
@@ -2362,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 )
@@ -2395,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/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();