Author: hdu
Date: Wed May 8 18:14:34 2013
New Revision: 1480384
URL: http://svn.apache.org/r1480384
Log:
#i122195# add VCL support for 64bit OSX>=10.7
Added:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.hxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atslayout.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/ctfonts.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/ctfonts.hxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/ctlayout.cxx
Removed:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salatslayout.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salatsuifontutils.cxx
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/salatsuifontutils.hxx
Modified:
openoffice/branches/rejuvenate01/main/vcl/Library_vcl.mk
openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/salinst.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/vclnsapp.mm
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DropTarget.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.hxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salbmp.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salgdi.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salgdiutils.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salnativewidgets.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/salprn.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/window/salframe.cxx
openoffice/branches/rejuvenate01/main/vcl/aqua/source/window/salframeview.mm
openoffice/branches/rejuvenate01/main/vcl/aqua/source/window/salmenu.cxx
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/aqua11ylistener.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/aquavcltypes.h
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/keyboardfocuslistener.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/salframe.h
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/salframeview.h
openoffice/branches/rejuvenate01/main/vcl/inc/aqua/salgdi.h
openoffice/branches/rejuvenate01/main/vcl/inc/fontsubset.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/impfont.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/os2/salgdi.h
openoffice/branches/rejuvenate01/main/vcl/inc/salgdi.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/unx/pspgraphics.h
openoffice/branches/rejuvenate01/main/vcl/inc/unx/salgdi.h
openoffice/branches/rejuvenate01/main/vcl/inc/vcl/metric.hxx
openoffice/branches/rejuvenate01/main/vcl/inc/win/salgdi.h
openoffice/branches/rejuvenate01/main/vcl/source/fontsubset/cff.cxx
openoffice/branches/rejuvenate01/main/vcl/source/fontsubset/fontsubset.cxx
openoffice/branches/rejuvenate01/main/vcl/source/gdi/metric.cxx
openoffice/branches/rejuvenate01/main/vcl/source/gdi/outdev3.cxx
openoffice/branches/rejuvenate01/main/vcl/source/gdi/pdfwriter_impl.cxx
openoffice/branches/rejuvenate01/main/vcl/source/glyphs/gcach_ftyp.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/generic/fontmanager/fontmanager.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/generic/gdi/pspgraphics.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/generic/gdi/salgdi3.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/generic/printergfx/glyphset.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/headless/svpgdi.hxx
openoffice/branches/rejuvenate01/main/vcl/unx/headless/svppspgraphics.cxx
openoffice/branches/rejuvenate01/main/vcl/unx/headless/svppspgraphics.hxx
openoffice/branches/rejuvenate01/main/vcl/unx/headless/svptext.cxx
openoffice/branches/rejuvenate01/main/vcl/util/makefile.mk
Modified: openoffice/branches/rejuvenate01/main/vcl/Library_vcl.mk
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/Library_vcl.mk?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/Library_vcl.mk (original)
+++ openoffice/branches/rejuvenate01/main/vcl/Library_vcl.mk Wed May 8
18:14:34 2013
@@ -161,8 +161,8 @@ $(eval $(call gb_Library_add_exception_o
vcl/aqua/source/dtrans/PictToBmpFlt \
vcl/aqua/source/dtrans/aqua_clipboard \
vcl/aqua/source/dtrans/service_entry \
- vcl/aqua/source/gdi/salatslayout \
- vcl/aqua/source/gdi/salatsuifontutils \
+ vcl/aqua/source/gdi/ctlayout \
+ vcl/aqua/source/gdi/ctfonts \
vcl/aqua/source/gdi/salbmp \
vcl/aqua/source/gdi/salcolorutils \
vcl/aqua/source/gdi/salgdi \
@@ -347,6 +347,7 @@ $(eval $(call gb_Library_add_exception_o
vcl/source/gdi/imagerepository \
vcl/source/gdi/impanmvw \
vcl/source/gdi/impbmp \
+ vcl/source/gdi/impfont \
vcl/source/gdi/impgraph \
vcl/source/gdi/impimage \
vcl/source/gdi/impimagetree \
@@ -521,11 +522,15 @@ $(eval $(call gb_Library_add_linked_libs
))
$(eval $(call gb_Library_set_ldflags,vcl,\
$$(LDFLAGS) \
- -framework QuickTime \
-framework Cocoa \
-framework Carbon \
-framework CoreFoundation \
))
+ifeq ($(MACOSX_DEPLOYMENT_TARGET:s/.//),107)
+$(eval $(call gb_Library_add_linked_libs,vcl,\
+ -framework QuickTime \
+))
+endif
endif
ifeq ($(OS),WNT)
Modified: openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/salinst.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/salinst.cxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/salinst.cxx
(original)
+++ openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/salinst.cxx Wed
May 8 18:14:34 2013
@@ -190,8 +190,10 @@ static void initNSApp()
else
NSLog(@"Unable to obtain system version: %ld", (long)err);
+#if 0 // disabled for now for stability problems
// Initialize Apple Remote
GetSalData()->mpMainController = [[MainController alloc] init];
+#endif
[[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
selector:
@selector(applicationWillBecomeActive:)
@@ -622,7 +624,7 @@ void AquaSalInstance::handleAppDefinedEv
std::list<AquaSalFrame*>::iterator it = pSalData->maFrames.begin();
while( (*it) && ( (it != pSalData->maFrames.end() ) || (
(*it)->mbFullScreen == false ) ) )
{
- if ( ((*it)->mbFullScreen == true) )
+ if( (*it)->mbFullScreen )
bIsFullScreenMode = true;
it++;
}
Modified: openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/vclnsapp.mm
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/vclnsapp.mm?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/vclnsapp.mm
(original)
+++ openoffice/branches/rejuvenate01/main/vcl/aqua/source/app/vclnsapp.mm Wed
May 8 18:14:34 2013
@@ -466,9 +466,9 @@
for( std::list< AquaSalFrame* >::const_iterator it =
pSalData->maPresentationFrames.begin();
it != pSalData->maPresentationFrames.end(); ++it )
{
- [(*it)->mpWindow setLevel: NSPopUpMenuWindowLevel];
- if( [(*it)->mpWindow isVisible] )
- [(*it)->mpWindow orderFront: NSApp];
+ [(*it)->mpNSWindow setLevel: NSPopUpMenuWindowLevel];
+ if( [(*it)->mpNSWindow isVisible] )
+ [(*it)->mpNSWindow orderFront: NSApp];
}
}
@@ -492,7 +492,7 @@
for( std::list< AquaSalFrame* >::const_iterator it =
pSalData->maPresentationFrames.begin();
it != pSalData->maPresentationFrames.end(); ++it )
{
- [(*it)->mpWindow setLevel: NSNormalWindowLevel];
+ [(*it)->mpNSWindow setLevel: NSNormalWindowLevel];
}
}
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
---
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
(original)
+++
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.cxx
Wed May 8 18:14:34 2013
@@ -64,7 +64,7 @@ namespace // private
typedef vector<sal_Unicode> UnicodeBuffer;
- OUString NSStringToOUString(NSString* cfString)
+ OUString NSStringToOUString( const NSString* cfString)
{
BOOST_ASSERT(cfString && "Invalid parameter");
@@ -113,7 +113,7 @@ namespace // private
struct FlavorMap
{
- NSString* SystemFlavor;
+ const NSString* SystemFlavor;
const char* OOoFlavor;
const char* HumanPresentableName;
Type DataType;
@@ -121,7 +121,7 @@ namespace // private
/* At the moment it appears as if only MS Office pastes "public.html" to the
clipboard.
*/
- FlavorMap flavorMap[] =
+ static const FlavorMap flavorMap[] =
{
{ NSStringPboardType, "text/plain;charset=utf-16", "Unicode Text
(UTF-16)", CPPUTYPE_OUSTRING },
{ NSRTFPboardType, "text/richtext", "Rich Text Format",
CPPUTYPE_SEQINT8 },
@@ -521,13 +521,13 @@ DataFlavorMapper::~DataFlavorMapper()
}
}
-DataFlavor DataFlavorMapper::systemToOpenOfficeFlavor(NSString*
systemDataFlavor) const
+DataFlavor DataFlavorMapper::systemToOpenOfficeFlavor( const NSString*
systemDataFlavor) const
{
DataFlavor oOOFlavor;
for (size_t i = 0; i < SIZE_FLAVOR_MAP; i++)
{
- if ([systemDataFlavor caseInsensitiveCompare:
flavorMap[i].SystemFlavor] == NSOrderedSame)
+ if ([systemDataFlavor
caseInsensitiveCompare:const_cast<NSString*>(flavorMap[i].SystemFlavor)] ==
NSOrderedSame)
{
oOOFlavor.MimeType = OUString::createFromAscii(
flavorMap[i].OOoFlavor);
oOOFlavor.HumanPresentableName = OUString::createFromAscii(
flavorMap[i].HumanPresentableName);
@@ -549,9 +549,9 @@ DataFlavor DataFlavorMapper::systemToOpe
return oOOFlavor;
}
-NSString* DataFlavorMapper::openOfficeToSystemFlavor(const DataFlavor&
oOOFlavor) const
+const NSString* DataFlavorMapper::openOfficeToSystemFlavor( const DataFlavor&
oOOFlavor) const
{
- NSString* sysFlavor = NULL;
+ const NSString* sysFlavor = NULL;
for( size_t i = 0; i < SIZE_FLAVOR_MAP; ++i )
{
@@ -583,7 +583,7 @@ NSString* DataFlavorMapper::openOfficeIm
return sysFlavor;
}
-DataProviderPtr_t DataFlavorMapper::getDataProvider(NSString* systemFlavor,
Reference<XTransferable> rTransferable) const
+DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString*
systemFlavor, Reference<XTransferable> rTransferable) const
{
DataProviderPtr_t dp;
@@ -607,7 +607,13 @@ DataProviderPtr_t DataFlavorMapper::getD
}
else
*/
- if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType]
== NSOrderedSame)
+#ifdef MAC_OS_X_VERSION_10_6
+ if ([systemFlavor caseInsensitiveCompare:
NSPasteboardTypePNG] == NSOrderedSame)
+ {
+ dp = DataProviderPtr_t( new PNGDataProvider( data,
NSPNGFileType));
+ } else
+#endif // MAC_OS_X_VERSION_10_5
+ if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] ==
NSOrderedSame)
{
dp = DataProviderPtr_t( new PNGDataProvider( data,
PICTImageFileType));
}
@@ -639,12 +645,12 @@ DataProviderPtr_t DataFlavorMapper::getD
return dp;
}
-DataProviderPtr_t DataFlavorMapper::getDataProvider(const NSString*
/*systemFlavor*/, NSArray* systemData) const
+DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString*
/*systemFlavor*/, NSArray* systemData) const
{
return DataProviderPtr_t(new FileListDataProvider(systemData));
}
-DataProviderPtr_t DataFlavorMapper::getDataProvider(const NSString*
systemFlavor, NSData* systemData) const
+DataProviderPtr_t DataFlavorMapper::getDataProvider( const NSString*
systemFlavor, NSData* systemData) const
{
DataProviderPtr_t dp;
@@ -656,6 +662,12 @@ DataProviderPtr_t DataFlavorMapper::getD
{
dp = DataProviderPtr_t(new HTMLFormatDataProvider(systemData));
}
+#ifdef MAC_OS_X_VERSION_10_6
+ else if ([systemFlavor caseInsensitiveCompare: NSPasteboardTypePNG] ==
NSOrderedSame)
+ {
+ dp = DataProviderPtr_t( new PNGDataProvider(systemData,
NSPNGFileType));
+ }
+#endif // MAC_OS_X_VERSION_10_6
else if ([systemFlavor caseInsensitiveCompare: NSPICTPboardType] ==
NSOrderedSame)
{
dp = DataProviderPtr_t( new PNGDataProvider(systemData,
PICTImageFileType));
@@ -708,7 +720,7 @@ NSArray* DataFlavorMapper::flavorSequenc
}
else
{
- NSString* str = openOfficeToSystemFlavor(flavors[i]);
+ const NSString* str = openOfficeToSystemFlavor(flavors[i]);
if (str == NULL)
str = internalOpenOfficeToSystemFlavor(flavors[i]);
else
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
---
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
(original)
+++
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DataFlavorMapping.hxx
Wed May 8 18:14:34 2013
@@ -78,14 +78,14 @@ public:
mapping from a system data flavor to a OpenOffice data
flavor.
*/
- com::sun::star::datatransfer::DataFlavor systemToOpenOfficeFlavor(NSString*
systemDataFlavor) const;
+ com::sun::star::datatransfer::DataFlavor systemToOpenOfficeFlavor( const
NSString* systemDataFlavor) const;
/* Map an OpenOffice data flavor to a system data flavor.
If there is no suiteable mapping available NULL will
be returned.
*/
- NSString* openOfficeToSystemFlavor(const
com::sun::star::datatransfer::DataFlavor& oooDataFlavor) const;
+ const NSString* openOfficeToSystemFlavor(const
com::sun::star::datatransfer::DataFlavor& oooDataFlavor) const;
/* Select the best available image data type
If there is no suiteable mapping available NULL will
@@ -96,19 +96,19 @@ public:
/* Get a data provider which is able to provide the data 'rTransferable'
offers in a format that can
be put on to the system clipboard.
*/
- DataProviderPtr_t getDataProvider(NSString* systemFlavor,
+ DataProviderPtr_t getDataProvider( const NSString* systemFlavor,
const
com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >
rTransferable) const;
/* Get a data provider which is able to provide 'systemData' in the OOo
expected format.
*/
- DataProviderPtr_t getDataProvider(const NSString* systemFlavor, NSArray*
systemData) const;
+ DataProviderPtr_t getDataProvider( const NSString* systemFlavor, NSArray*
systemData) const;
/* Get a data provider which is able to provide 'systemData' in the OOo
expected format.
*/
- DataProviderPtr_t getDataProvider(const NSString* systemFlavor, NSData*
systemData) const;
+ DataProviderPtr_t getDataProvider( const NSString* systemFlavor, NSData*
systemData) const;
/* Translate a sequence of DataFlavors into a NSArray of system types.
@@ -125,7 +125,7 @@ public:
/* Returns an NSArray containing all pasteboard types supported by OOo
*/
- NSArray* DataFlavorMapper::getAllSupportedPboardTypes() const;
+ NSArray* getAllSupportedPboardTypes() const;
private:
/* Determines if the provided Mime content type is valid.
@@ -136,10 +136,11 @@ private:
private:
::com::sun::star::uno::Reference<
::com::sun::star::datatransfer::XMimeContentTypeFactory> mrXMimeCntFactory;
- typedef std::hash_map< rtl::OUString, NSString*, rtl::OUStringHash >
OfficeOnlyTypes;
+ typedef ::std::hash_map< rtl::OUString, NSString*, rtl::OUStringHash >
OfficeOnlyTypes;
mutable OfficeOnlyTypes maOfficeOnlyTypes;
};
typedef boost::shared_ptr<DataFlavorMapper> DataFlavorMapperPtr_t;
-#endif
+#endif
+
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DropTarget.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DropTarget.cxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DropTarget.cxx
(original)
+++ openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/DropTarget.cxx
Wed May 8 18:14:34 2013
@@ -299,15 +299,12 @@ NSDragOperation DropTarget::draggingUpda
//NSLog(@"Drag update: Source actions: %x proposed action %x selected
action %x", mDragSourceSupportedActions, currentAction, mSelectedDropAction);
}
- // Weird but it appears as if there is no method in Cocoa
- // to create a kThemeCopyArrowCursor hence we have to use
- // Carbon to do it
if (dragOp == NSDragOperationNone)
- SetThemeCursor(kThemeNotAllowedCursor);
+ [[NSCursor operationNotAllowedCursor] set];
else if (dragOp == NSDragOperationCopy)
- SetThemeCursor(kThemeCopyArrowCursor);
+ [[NSCursor dragCopyCursor] set];
else
- SetThemeCursor(kThemeArrowCursor);
+ [[NSCursor arrowCursor] set];
return dragOp;
}
@@ -319,7 +316,7 @@ void DropTarget::draggingExited(id /*sen
fire_dragExit(dte);
mDragSourceSupportedActions = DNDConstants::ACTION_NONE;
mSelectedDropAction = DNDConstants::ACTION_NONE;
- SetThemeCursor(kThemeArrowCursor);
+ [[NSCursor arrowCursor] set];
}
@@ -373,7 +370,7 @@ void DropTarget::concludeDragOperation(i
mDragSourceSupportedActions = DNDConstants::ACTION_NONE;
mSelectedDropAction = DNDConstants::ACTION_NONE;
mXCurrentDragClipboard = uno::Reference<XClipboard>();
- SetThemeCursor(kThemeArrowCursor);
+ [[NSCursor arrowCursor] set];
}
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/PictToBmpFlt.cxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
---
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
(original)
+++
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/PictToBmpFlt.cxx
Wed May 8 18:14:34 2013
@@ -39,6 +39,9 @@
bool PICTtoPNG( com::sun::star::uno::Sequence<sal_Int8>& rPictData,
com::sun::star::uno::Sequence<sal_Int8>& rPngData)
{
+#ifdef MAC_OS_X_VERSION_10_6
+ return false;
+#else // MAC_OS_X_VERSION_10_6
ComponentInstance pngExporter = NULL;
if( OpenADefaultComponent( GraphicsExporterComponentType,
kQTFileTypePNG, &pngExporter) != noErr)
return false;
@@ -72,12 +75,16 @@ bool PICTtoPNG( com::sun::star::uno::Seq
CloseComponent( pngExporter);
return (nPngSize > 0);
+#endif // MAC_OS_X_VERSION_10_6
}
bool PNGtoPICT( com::sun::star::uno::Sequence<sal_Int8>& rPngData,
com::sun::star::uno::Sequence<sal_Int8>& rPictData)
{
+#ifdef MAC_OS_X_VERSION_10_6
+ return false;
+#else // MAC_OS_X_VERSION_10_6
ComponentInstance pictExporter;
if( OpenADefaultComponent( GraphicsImporterComponentType,
kQTFileTypePNG, &pictExporter) != noErr)
return false;
@@ -99,9 +106,11 @@ bool PNGtoPICT( com::sun::star::uno::Seq
rtl_copyMemory( rPictData.getArray(), ((sal_Int8*)*hPict),
nPictSize);
HUnlock( (Handle)hPict);
+#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
// Release the data associated with the picture
- // Note: This function is deprecated in Mac OSX 10.4
+ // Note: This function has been deprecated in OSX 10.4 and
removed in OSX 10.7
KillPicture( hPict);
+#endif
}
if( hPng)
@@ -110,15 +119,24 @@ bool PNGtoPICT( com::sun::star::uno::Seq
CloseComponent( pictExporter);
return (nPictSize > 512);
+#endif // MAC_OS_X_VERSION_10_6
}
bool ImageToPNG( com::sun::star::uno::Sequence<sal_Int8>& rImgData,
com::sun::star::uno::Sequence<sal_Int8>& rPngData,
NSBitmapImageFileType eInFormat)
{
+ // short circuit for PNG->PNG request
+ if( eInFormat == NSPNGFileType) {
+ rPngData = rImgData;
+ return true;
+ }
+
+ // special handling for old PICT images that are not supported by
NSBitmapImage
if( eInFormat == PICTImageFileType)
return PICTtoPNG( rImgData, rPngData);
+ // let Cocoa's NSBitmapImageRep do the conversion
NSData* pData = [NSData dataWithBytesNoCopy:
(void*)rImgData.getConstArray() length: rImgData.getLength() freeWhenDone: 0];
if( !pData)
return false;
@@ -131,6 +149,7 @@ bool ImageToPNG( com::sun::star::uno::Se
if( !pOut)
return false;
+ // get the conversion result
const size_t nPngSize = [pOut length];
rPngData.realloc( nPngSize);
[pOut getBytes: rPngData.getArray() length: nPngSize];
@@ -142,9 +161,17 @@ bool PNGToImage( com::sun::star::uno::Se
NSBitmapImageFileType eOutFormat
)
{
+ // short circuit for PNG->PNG request
+ if( eOutFormat == NSPNGFileType) {
+ rImgData = rPngData;
+ return true;
+ }
+
+ // special handling for old PICT images that are not supported by
NSBitmapImage
if( eOutFormat == PICTImageFileType)
return PNGtoPICT( rPngData, rImgData);
-
+
+ // let Cocoa's NSBitmapImageRep do the conversion
NSData* pData = [NSData dataWithBytesNoCopy:
const_cast<sal_Int8*>(rPngData.getConstArray()) length: rPngData.getLength()
freeWhenDone: 0];
if( !pData)
return false;
@@ -157,6 +184,7 @@ bool PNGToImage( com::sun::star::uno::Se
if( !pOut)
return false;
+ // get the conversion result
const size_t nImgSize = [pOut length];
rImgData.realloc( nImgSize);
[pOut getBytes: rImgData.getArray() length: nImgSize];
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.cxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
---
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.cxx
(original)
+++
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.cxx
Wed May 8 18:14:34 2013
@@ -57,7 +57,7 @@ using namespace comphelper;
return self;
}
--(void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString*)type
+-(void)pasteboard:(NSPasteboard*)sender provideDataForType:(const
NSString*)type
{
if( pAquaClipboard )
pAquaClipboard->provideDataForType(sender, type);
@@ -316,7 +316,7 @@ void AquaClipboard::fireLostClipboardOwn
}
-void AquaClipboard::provideDataForType(NSPasteboard* sender, NSString* type)
+void AquaClipboard::provideDataForType(NSPasteboard* sender, const NSString*
type)
{
if( mXClipboardContent.is() )
{
@@ -326,7 +326,7 @@ void AquaClipboard::provideDataForType(N
if (dp.get() != NULL)
{
pBoardData = (NSData*)dp->getSystemData();
- [sender setData: pBoardData forType: type];
+ [sender setData: pBoardData forType:const_cast<NSString*>(type)];
}
}
}
@@ -346,7 +346,7 @@ void SAL_CALL AquaClipboard::flushClipbo
for (sal_uInt32 i = 0; i < nFlavors; i++)
{
- NSString* sysType =
mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
+ const NSString* sysType =
mpDataFlavorMapper->openOfficeToSystemFlavor(flavorList[i]);
if (sysType != NULL)
{
Modified:
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.hxx?rev=1480384&r1=1480383&r2=1480384&view=diff
==============================================================================
---
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.hxx
(original)
+++
openoffice/branches/rejuvenate01/main/vcl/aqua/source/dtrans/aqua_clipboard.hxx
Wed May 8 18:14:34 2013
@@ -58,7 +58,7 @@ class AquaClipboard;
- (EventListener*)initWithAquaClipboard: (AquaClipboard*) pcb;
// Promiss resolver function
-- (void)pasteboard:(NSPasteboard*)sender provideDataForType:(NSString *)type;
+- (void)pasteboard:(NSPasteboard*)sender provideDataForType:(const NSString
*)type;
-(void)applicationDidBecomeActive:(NSNotification*)aNotification;
@@ -151,7 +151,7 @@ public:
void pasteboardChangedOwner();
- void provideDataForType(NSPasteboard* sender, NSString* type);
+ void provideDataForType(NSPasteboard* sender, const NSString* type);
void applicationDidBecomeActive(NSNotification* aNotification);
Added: openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.cxx?rev=1480384&view=auto
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.cxx
(added)
+++ openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.cxx Wed
May 8 18:14:34 2013
@@ -0,0 +1,632 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include <boost/assert.hpp>
+#include <vector>
+#include <hash_map>
+#include <set>
+
+#include "salgdi.h"
+#include "atsfonts.hxx"
+
+#include "vcl/svapp.hxx"
+#include "vcl/impfont.hxx"
+
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
+
+// =======================================================================
+
+// mac specific physically available font face
+class AtsFontData
+: public ImplMacFontData
+{
+public:
+ explicit AtsFontData( const
ImplDevFontAttributes&, ATSUFontID );
+ virtual ~AtsFontData( void );
+ virtual ImplFontData* Clone( void ) const;
+
+ virtual ImplMacTextStyle* CreateMacTextStyle( const
ImplFontSelectData& ) const;
+ virtual ImplFontEntry* CreateFontInstance( /*const*/
ImplFontSelectData& ) const;
+ virtual int GetFontTable( const
char pTagName[5], unsigned char* ) const;
+};
+
+// =======================================================================
+
+class AtsFontList
+: public SystemFontList
+{
+public:
+ explicit AtsFontList( void );
+ virtual ~AtsFontList( void );
+
+ virtual void AnnounceFonts( ImplDevFontList& ) const;
+ virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr nFontId ) const;
+
+private:
+ typedef std::hash_map<sal_IntPtr,AtsFontData*> AtsFontContainer;
+ AtsFontContainer maFontContainer;
+
+ void InitGlyphFallbacks( void );
+ ATSUFontFallbacks maFontFallbacks;
+};
+
+// =======================================================================
+
+AtsFontData::AtsFontData( const ImplDevFontAttributes& rDFA, ATSUFontID
nFontId )
+: ImplMacFontData( rDFA, (sal_IntPtr)nFontId )
+{}
+
+// -----------------------------------------------------------------------
+
+AtsFontData::~AtsFontData( void )
+{}
+
+// -----------------------------------------------------------------------
+
+ImplFontData* AtsFontData::Clone( void ) const
+{
+ AtsFontData* pClone = new AtsFontData(*this);
+ return pClone;
+}
+
+// -----------------------------------------------------------------------
+
+ImplMacTextStyle* AtsFontData::CreateMacTextStyle( const ImplFontSelectData&
rFSD ) const
+{
+ return new AtsTextStyle( rFSD );
+}
+
+// -----------------------------------------------------------------------
+
+ImplFontEntry* AtsFontData::CreateFontInstance( /*const*/ ImplFontSelectData&
rFSD ) const
+{
+ return new ImplFontEntry( rFSD );
+}
+
+// -----------------------------------------------------------------------
+
+int AtsFontData::GetFontTable( const char pTagName[5], unsigned char*
pResultBuf ) const
+{
+ DBG_ASSERT( aTagName[4]=='\0', "AtsFontData::GetFontTable with invalid
tagname!\n" );
+
+ const FourCharCode pTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) +
(pTagName[2]<<8) + (pTagName[3]<<0);
+
+ // get the byte size of the raw table
+ ATSFontRef rATSFont = FMGetATSFontRefFromFont( (ATSUFontID)mnFontId );
+ ByteCount nBufSize = 0;
+ OSStatus eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, 0, NULL,
&nBufSize );
+ if( eStatus != noErr )
+ return 0;
+
+ // get the raw table data if requested
+ if( pResultBuf && (nBufSize > 0))
+ {
+ ByteCount nRawLength = 0;
+ eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, nBufSize,
(void*)pResultBuf, &nRawLength );
+ if( eStatus != noErr )
+ return 0;
+ DBG_ASSERT( (nBufSize==nRawLength), "AtsFontData::GetFontTable
ByteCount mismatch!\n");
+ }
+
+ return nBufSize;
+}
+
+// =======================================================================
+
+AtsTextStyle::AtsTextStyle( const ImplFontSelectData& rFSD )
+: ImplMacTextStyle( rFSD )
+{
+ // create the style object for ATSUI font attributes
+ ATSUCreateStyle( &maATSUStyle );
+ const ImplFontSelectData* const pReqFont = &rFSD;
+
+ mpFontData = (AtsFontData*)rFSD.mpFontData;
+
+ // limit the ATS font size to avoid Fixed16.16 overflows
+ double fScaledFontHeight = pReqFont->mfExactHeight;
+ static const float fMaxFontHeight = 144.0;
+ if( fScaledFontHeight > fMaxFontHeight )
+ {
+ mfFontScale = fScaledFontHeight / fMaxFontHeight;
+ fScaledFontHeight = fMaxFontHeight;
+ }
+
+ // convert font rotation to radian
+ mfFontRotation = pReqFont->mnOrientation * (M_PI / 1800.0);
+
+ // determine if font stretching is needed
+ if( (pReqFont->mnWidth != 0) && (pReqFont->mnWidth !=
pReqFont->mnHeight) )
+ {
+ mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight;
+ // set text style to stretching matrix
+ CGAffineTransform aMatrix = CGAffineTransformMakeScale(
mfFontStretch, 1.0F );
+ const ATSUAttributeTag aMatrixTag = kATSUFontMatrixTag;
+ const ATSUAttributeValuePtr aAttr = &aMatrix;
+ const ByteCount aMatrixBytes = sizeof(aMatrix);
+ /*OSStatus eStatus =*/ ATSUSetAttributes( maATSUStyle, 1,
&aMatrixTag, &aMatrixBytes, &aAttr );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+AtsTextStyle::~AtsTextStyle( void )
+{
+ ATSUDisposeStyle( maATSUStyle );
+}
+
+// -----------------------------------------------------------------------
+
+void AtsTextStyle::GetFontMetric( float fDPIY, ImplFontMetricData& rMetric )
const
+{
+ // get the font metrics (in point units)
+ // of the font that has eventually been size-limited
+
+ // get the matching ATSU font handle
+ ATSUFontID fontId;
+ OSStatus err = ::ATSUGetAttribute( maATSUStyle, kATSUFontTag,
sizeof(ATSUFontID), &fontId, 0 );
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not
get font id\n");
+
+ ATSFontMetrics aMetrics;
+ ATSFontRef rFont = FMGetATSFontRefFromFont( fontId );
+ err = ATSFontGetHorizontalMetrics ( rFont, kATSOptionFlagsDefault,
&aMetrics );
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not
get font metrics\n");
+ if( err != noErr )
+ return;
+
+ // all ATS fonts are scalable fonts
+ rMetric.mbScalableFont = true;
+ // TODO: check if any kerning is possible
+ rMetric.mbKernableFont = true;
+
+ // convert into VCL font metrics (in unscaled pixel units)
+
+ Fixed ptSize;
+ err = ATSUGetAttribute( maATSUStyle, kATSUSizeTag, sizeof(Fixed),
&ptSize, 0);
+ DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not
get font size\n");
+ const double fPointSize = Fix2X( ptSize );
+
+ // convert quartz units to pixel units
+ // please see the comment in AquaSalGraphics::SetFont() for details
+ const double fPixelSize = (mfFontScale * fDPIY * fPointSize);
+ rMetric.mnAscent = static_cast<long>(+aMetrics.ascent *
fPixelSize + 0.5);
+ rMetric.mnDescent = static_cast<long>(-aMetrics.descent *
fPixelSize + 0.5);
+ const long nExtDescent = static_cast<long>((-aMetrics.descent +
aMetrics.leading) * fPixelSize + 0.5);
+ rMetric.mnExtLeading = nExtDescent - rMetric.mnDescent;
+ rMetric.mnIntLeading = 0;
+ // since ImplFontMetricData::mnWidth is only used for
stretching/squeezing fonts
+ // setting this width to the pixel height of the fontsize is good enough
+ // it also makes the calculation of the stretch factor simple
+ rMetric.mnWidth = static_cast<long>(mfFontStretch * fPixelSize +
0.5);
+}
+
+// -----------------------------------------------------------------------
+
+void AtsTextStyle::SetTextColor( const RGBAColor& rColor )
+{
+ RGBColor aAtsColor;
+ aAtsColor.red = (unsigned short)( rColor.GetRed() * 65535.0 );
+ aAtsColor.green = (unsigned short)( rColor.GetGreen() * 65535.0 );
+ aAtsColor.blue = (unsigned short)( rColor.GetColor() * 65535.0 );
+
+ ATSUAttributeTag aTag = kATSUColorTag;
+ ByteCount aValueSize = sizeof( aAtsColor );
+ ATSUAttributeValuePtr aValue = &aAtsColor;
+
+ /*OSStatus err =*/ ATSUSetAttributes( maATSUStyle, 1, &aTag,
&aValueSize, &aValue );
+}
+
+// -----------------------------------------------------------------------
+
+bool AtsTextStyle::GetGlyphBoundRect( sal_GlyphId nGlyphId, Rectangle& rRect )
const
+{
+ ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback
+ GlyphID aGlyphId = nGlyphId;
+ ATSGlyphScreenMetrics aGlyphMetrics;
+ const bool bNonAntialiasedText = false;
+ OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle,
+ 1, &aGlyphId, 0, FALSE, !bNonAntialiasedText, &aGlyphMetrics );
+ if( eStatus != noErr )
+ return false;
+
+ const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5);
+ const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) +
nMinX;
+ const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5);
+ const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) +
nMinY;
+ rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY );
+ return true;
+}
+
+// -----------------------------------------------------------------------
+
+// callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
+struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon*
mpPolyPoly; };
+
+static OSStatus GgoLineToProc( const Float32Point* pPoint, void* pData )
+{
+ basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
+ const basegfx::B2DPoint aB2DPoint( pPoint->x, pPoint->y );
+ rPolygon.append( aB2DPoint );
+ return noErr;
+}
+
+static OSStatus GgoCurveToProc( const Float32Point* pCP1, const Float32Point*
pCP2,
+ const Float32Point* pPoint, void* pData )
+{
+ basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
+ const sal_uInt32 nPointCount = rPolygon.count();
+ const basegfx::B2DPoint aB2DControlPoint1( pCP1->x, pCP1->y );
+ rPolygon.setNextControlPoint( nPointCount-1, aB2DControlPoint1 );
+ const basegfx::B2DPoint aB2DEndPoint( pPoint->x, pPoint->y );
+ rPolygon.append( aB2DEndPoint );
+ const basegfx::B2DPoint aB2DControlPoint2( pCP2->x, pCP2->y );
+ rPolygon.setPrevControlPoint( nPointCount, aB2DControlPoint2 );
+ return noErr;
+}
+
+static OSStatus GgoClosePathProc( void* pData )
+{
+ GgoData* pGgoData = static_cast<GgoData*>(pData);
+ basegfx::B2DPolygon& rPolygon = pGgoData->maPolygon;
+ if( rPolygon.count() > 0 )
+ pGgoData->mpPolyPoly->append( rPolygon );
+ rPolygon.clear();
+ return noErr;
+}
+
+static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData )
+{
+ GgoClosePathProc( pData );
+ OSStatus eStatus = GgoLineToProc( pPoint, pData );
+ return eStatus;
+}
+
+bool AtsTextStyle::GetGlyphOutline( sal_GlyphId nGlyphId,
basegfx::B2DPolyPolygon& rResult ) const
+{
+ GgoData aGgoData;
+ aGgoData.mpPolyPoly = &rResult;
+ rResult.clear();
+
+ OSStatus eGgoStatus = noErr;
+ OSStatus eStatus = ATSUGlyphGetCubicPaths( maATSUStyle, nGlyphId,
+ GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc,
+ &aGgoData, &eGgoStatus );
+ if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when
curves are involved?
+ return false;
+
+ GgoClosePathProc( &aGgoData );
+
+ // apply the font scale
+ if( mfFontScale != 1.0 ) {
+ basegfx::B2DHomMatrix aScale;
+ aScale.scale( +mfFontScale, +mfFontScale );
+ rResult.transform( aScale );
+ }
+
+ return true;
+}
+
+// =======================================================================
+
+static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes&
rDFA )
+{
+ // all ATSU fonts are device fonts that can be directly rotated
+ rDFA.mbOrientation = true;
+ rDFA.mbDevice = true;
+ rDFA.mnQuality = 0;
+
+ // reset the attributes
+ rDFA.meFamily = FAMILY_DONTKNOW;
+ rDFA.mePitch = PITCH_VARIABLE;
+ rDFA.meWidthType = WIDTH_NORMAL;
+ rDFA.meWeight = WEIGHT_NORMAL;
+ rDFA.meItalic = ITALIC_NONE;
+ rDFA.mbSymbolFlag = false;
+
+ // ignore bitmap fonts
+ ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID );
+ ByteCount nHeadLen = 0;
+ OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0,
NULL, &nHeadLen );
+ if( (rc != noErr) || (nHeadLen <= 0) )
+ return false;
+
+ // all scalable fonts on this platform are subsettable
+ rDFA.mbSubsettable = true;
+ rDFA.mbEmbeddable = false;
+ // TODO: these members are needed only for our X11 platform targets
+ rDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
+ rDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
+
+ // prepare iterating over all name strings of the font
+ ItemCount nFontNameCount = 0;
+ rc = ATSUCountFontNames( nFontID, &nFontNameCount );
+ if( rc != noErr )
+ return false;
+ int nBestNameValue = 0;
+ int nBestStyleValue = 0;
+ FontLanguageCode eBestLangCode = 0;
+ const FontLanguageCode eUILangCode =
Application::GetSettings().GetUILanguage();
+ typedef std::vector<char> NameBuffer;
+ NameBuffer aNameBuffer( 256 );
+
+ // iterate over all available name strings of the font
+ for( ItemCount nNameIndex = 0; nNameIndex < nFontNameCount;
++nNameIndex )
+ {
+ ByteCount nNameLength = 0;
+
+ FontNameCode eFontNameCode;
+ FontPlatformCode eFontNamePlatform;
+ FontScriptCode eFontNameScript;
+ FontLanguageCode eFontNameLanguage;
+ rc = ATSUGetIndFontName( nFontID, nNameIndex, 0, NULL,
+ &nNameLength, &eFontNameCode, &eFontNamePlatform,
&eFontNameScript, &eFontNameLanguage );
+ if( rc != noErr )
+ continue;
+
+ // ignore non-interesting name entries
+ if( (eFontNameCode != kFontFamilyName)
+ && (eFontNameCode != kFontStyleName)
+ && (eFontNameCode != kFontPostscriptName) )
+ continue;
+
+ // heuristic to find the most common font name
+ // prefering default language names or even better the names
matching to the UI language
+ int nNameValue = (eFontNameLanguage==eUILangCode) ? 0 :
((eFontNameLanguage==0) ? -10 : -20);
+ rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE;
+ const int nPlatformEncoding = ((int)eFontNamePlatform << 8) +
(int)eFontNameScript;
+ switch( nPlatformEncoding )
+ {
+ case 0x000: nNameValue += 23; break; // Unicode 1.0
+ case 0x001: nNameValue += 24; break; // Unicode 1.1
+ case 0x002: nNameValue += 25; break; // iso10646_1993
+ case 0x003: nNameValue += 26; break; // UCS-2
+ case 0x301: nNameValue += 27; break; // Win UCS-2
+ case 0x004: // UCS-4
+ case 0x30A: nNameValue += 0; // Win-UCS-4
+ eEncoding = RTL_TEXTENCODING_UCS4;
+ break;
+ case 0x100: nNameValue += 21; // Mac Roman
+ eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
+ break;
+ case 0x300: nNameValue = 0; // Win Symbol
encoded name!
+ rDFA.mbSymbolFlag = true; // (often
seen for symbol fonts)
+ break;
+ default: nNameValue = 0; // ignore
other encodings
+ break;
+ }
+
+ // ignore name entries with no useful encoding
+ if( nNameValue <= 0 )
+ continue;
+ if( nNameLength >= aNameBuffer.size() )
+ continue;
+
+ // get the encoded name
+ aNameBuffer.reserve( nNameLength+1 ); // extra byte helps for
debugging
+ rc = ATSUGetIndFontName( nFontID, nNameIndex, nNameLength,
&aNameBuffer[0],
+ &nNameLength, &eFontNameCode, &eFontNamePlatform,
&eFontNameScript, &eFontNameLanguage );
+ if( rc != noErr )
+ continue;
+
+ // convert to unicode name
+ UniString aUtf16Name;
+ if( eEncoding == RTL_TEXTENCODING_UNICODE ) // we are just
interested in UTF16 encoded names
+ aUtf16Name = UniString( (const
sal_Unicode*)&aNameBuffer[0], nNameLength/2 );
+ else if( eEncoding == RTL_TEXTENCODING_UCS4 )
+ aUtf16Name = UniString(); // TODO
+ else // assume the non-unicode encoded names are byte encoded
+ aUtf16Name = UniString( &aNameBuffer[0], nNameLength,
eEncoding );
+
+ // ignore empty strings
+ if( aUtf16Name.Len() <= 0 )
+ continue;
+
+ // handle the name depending on its namecode
+ switch( eFontNameCode )
+ {
+ case kFontFamilyName:
+ // ignore font names starting with '.'
+ if( aUtf16Name.GetChar(0) == '.' )
+ nNameValue = 0;
+ else if( rDFA.maName.Len() )
+ {
+ // even if a family name is not the one we are
looking for
+ // it is still useful as a font name alternative
+ if( rDFA.maMapNames.Len() )
+ rDFA.maMapNames += ';';
+ rDFA.maMapNames += (nBestNameValue <
nNameValue) ? rDFA.maName : aUtf16Name;
+ }
+ if( nBestNameValue < nNameValue )
+ {
+ // get the best family name
+ nBestNameValue = nNameValue;
+ eBestLangCode = eFontNameLanguage;
+ rDFA.maName = aUtf16Name;
+ }
+ break;
+ case kFontStyleName:
+ // get a style name matching to the family name
+ if( nBestStyleValue < nNameValue )
+ {
+ nBestStyleValue = nNameValue;
+ rDFA.maStyleName = aUtf16Name;
+ }
+ break;
+ case kFontPostscriptName:
+ // use the postscript name to get some useful info
+ UpdateAttributesFromPSName( aUtf16Name, rDFA );
+ break;
+ default:
+ // TODO: use other name entries too?
+ break;
+ }
+ }
+
+ bool bRet = (rDFA.maName.Len() > 0);
+ return bRet;
+}
+
+// =======================================================================
+
+SystemFontList* GetAtsFontList( void )
+{
+ return new AtsFontList();
+}
+
+// =======================================================================
+
+AtsFontList::AtsFontList()
+{
+ // count available system fonts
+ ItemCount nATSUICompatibleFontsAvailable = 0;
+ if( ATSUFontCount(&nATSUICompatibleFontsAvailable) != noErr )
+ return;
+ if( nATSUICompatibleFontsAvailable <= 0 )
+ return;
+
+ // enumerate available system fonts
+ typedef std::vector<ATSUFontID> AtsFontIDVector;
+ AtsFontIDVector aFontIDVector( nATSUICompatibleFontsAvailable );
+ ItemCount nFontItemsCount = 0;
+ if( ATSUGetFontIDs( &aFontIDVector[0], aFontIDVector.capacity(),
&nFontItemsCount ) != noErr )
+ return;
+
+ BOOST_ASSERT(nATSUICompatibleFontsAvailable == nFontItemsCount &&
"Strange I would expect them to be equal");
+
+ // prepare use of the available fonts
+ AtsFontIDVector::const_iterator it = aFontIDVector.begin();
+ for(; it != aFontIDVector.end(); ++it )
+ {
+ const ATSUFontID nFontID = *it;
+ ImplDevFontAttributes aDevFontAttr;
+ if( !GetDevFontAttributes( nFontID, aDevFontAttr ) )
+ continue;
+ AtsFontData* pFontData = new AtsFontData( aDevFontAttr, nFontID
);
+ maFontContainer[ nFontID ] = pFontData;
+ }
+
+ InitGlyphFallbacks();
+}
+
+// -----------------------------------------------------------------------
+
+AtsFontList::~AtsFontList()
+{
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
+ for(; it != maFontContainer.end(); ++it )
+ delete (*it).second;
+ maFontContainer.clear();
+
+ ATSUDisposeFontFallbacks( maFontFallbacks );
+}
+
+// -----------------------------------------------------------------------
+
+void AtsFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
+{
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
+ for(; it != maFontContainer.end(); ++it )
+ rFontList.Add( (*it).second->Clone() );
+}
+
+// -----------------------------------------------------------------------
+
+ImplMacFontData* AtsFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
+{
+ AtsFontContainer::const_iterator it = maFontContainer.find( nFontId );
+ if( it == maFontContainer.end() )
+ return NULL;
+ return (*it).second;
+}
+
+// -----------------------------------------------------------------------
+
+// not all fonts are suitable for glyph fallback => sort them
+struct GfbCompare{ bool operator()(const ImplMacFontData*, const
ImplMacFontData*); };
+
+inline bool GfbCompare::operator()( const ImplMacFontData* pA, const
ImplMacFontData* pB )
+{
+ // use symbol fonts only as last resort
+ bool bPreferA = !pA->IsSymbolFont();
+ bool bPreferB = !pB->IsSymbolFont();
+ if( bPreferA != bPreferB )
+ return bPreferA;
+ // prefer scalable fonts
+ bPreferA = pA->IsScalable();
+ bPreferB = pB->IsScalable();
+ if( bPreferA != bPreferB )
+ return bPreferA;
+ // prefer non-slanted fonts
+ bPreferA = (pA->GetSlant() == ITALIC_NONE);
+ bPreferB = (pB->GetSlant() == ITALIC_NONE);
+ if( bPreferA != bPreferB )
+ return bPreferA;
+ // prefer normal weight fonts
+ bPreferA = (pA->GetWeight() == WEIGHT_NORMAL);
+ bPreferB = (pB->GetWeight() == WEIGHT_NORMAL);
+ if( bPreferA != bPreferB )
+ return bPreferA;
+ // prefer normal width fonts
+ bPreferA = (pA->GetWidthType() == WIDTH_NORMAL);
+ bPreferB = (pB->GetWidthType() == WIDTH_NORMAL);
+ if( bPreferA != bPreferB )
+ return bPreferA;
+ return false;
+}
+
+// -----------------------------------------------------------------------
+
+void AtsFontList::InitGlyphFallbacks()
+{
+ // sort fonts for "glyph fallback"
+ typedef std::multiset<const ImplMacFontData*,GfbCompare> FallbackSet;
+ FallbackSet aFallbackSet;
+ AtsFontContainer::const_iterator it = maFontContainer.begin();
+ for(; it != maFontContainer.end(); ++it )
+ {
+ const ImplMacFontData* pIFD = (*it).second;
+ // TODO: subsettable/embeddable glyph fallback only for PDF
export?
+ if( pIFD->IsSubsettable() || pIFD->IsEmbeddable() )
+ aFallbackSet.insert( pIFD );
+ }
+
+ // tell ATSU about font preferences for "glyph fallback"
+ typedef std::vector<ATSUFontID> AtsFontIDVector;
+ AtsFontIDVector aFallbackVector;
+ aFallbackVector.reserve( maFontContainer.size() );
+ FallbackSet::const_iterator itFData = aFallbackSet.begin();
+ for(; itFData != aFallbackSet.end(); ++itFData )
+ {
+ const ImplMacFontData* pFontData = (*itFData);
+ ATSUFontID nFontID = (ATSUFontID)pFontData->GetFontId();
+ aFallbackVector.push_back( nFontID );
+ }
+
+ ATSUCreateFontFallbacks( &maFontFallbacks );
+ ATSUSetObjFontFallbacks( maFontFallbacks,
+ aFallbackVector.size(), &aFallbackVector[0],
kATSUSequentialFallbacksPreferred );
+}
+
+// =======================================================================
+
Added: openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.hxx?rev=1480384&view=auto
==============================================================================
--- openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.hxx
(added)
+++ openoffice/branches/rejuvenate01/main/vcl/aqua/source/gdi/atsfonts.hxx Wed
May 8 18:14:34 2013
@@ -0,0 +1,45 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// =======================================================================
+
+class AtsTextStyle
+: public ImplMacTextStyle
+{
+public:
+ explicit AtsTextStyle( const ImplFontSelectData& );
+ virtual ~AtsTextStyle( void );
+
+ virtual SalLayout* GetTextLayout( void ) const;
+
+ virtual void GetFontMetric( float fDPIY, ImplFontMetricData& ) const;
+ virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
+ virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon&
) const;
+
+ virtual void SetTextColor( const RGBAColor& );
+
+private:
+ /// ATSU text style object
+ ATSUStyle maATSUStyle;
+};
+
+// =======================================================================
+