summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/inc/comphelper/mediadescriptor.hxx1
-rw-r--r--comphelper/inc/comphelper/storagehelper.hxx9
-rw-r--r--comphelper/qa/complex/makefile.mk14
-rw-r--r--comphelper/source/misc/mediadescriptor.cxx6
-rw-r--r--comphelper/source/misc/storagehelper.cxx27
-rw-r--r--i18npool/source/isolang/isolang.cxx3
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java30
-rw-r--r--padmin/source/padialog.cxx5
-rw-r--r--rsc/inc/rsctools.hxx1
-rw-r--r--rsc/source/tools/rscchar.cxx133
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx4
-rw-r--r--svl/inc/svl/zforlist.hxx13
-rw-r--r--svl/inc/svl/zformat.hxx7
-rw-r--r--svl/source/items/style.cxx22
-rw-r--r--svl/source/misc/urihelper.cxx3
-rw-r--r--svl/source/numbers/zforlist.cxx20
-rw-r--r--svl/source/numbers/zformat.cxx182
-rw-r--r--svl/source/numbers/zforscan.cxx2
-rw-r--r--svl/source/numbers/zforscan.hxx6
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/accessibletable.hxx9
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx18
-rw-r--r--svtools/inc/svtools/table/defaultinputhandler.hxx1
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx8
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx152
-rw-r--r--svtools/inc/svtools/table/tabledatawindow.hxx12
-rw-r--r--svtools/inc/svtools/table/tablemodel.hxx108
-rw-r--r--svtools/inc/svtools/table/tablerenderer.hxx44
-rw-r--r--svtools/inc/svtools/table/tabletypes.hxx10
-rw-r--r--svtools/prj/d.lst2
-rw-r--r--svtools/qa/unoapi/svtools.sce12
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.cxx12
-rw-r--r--svtools/source/filter.vcl/wmf/winmtf.hxx3
-rw-r--r--svtools/source/inc/accessibletableimp.hxx62
-rw-r--r--svtools/source/table/defaultinputhandler.cxx57
-rw-r--r--svtools/source/table/gridtablerenderer.cxx276
-rw-r--r--svtools/source/table/tablecontrol.cxx130
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx1415
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx161
-rw-r--r--svtools/source/table/tabledatawindow.cxx84
-rw-r--r--svtools/source/table/tablegeometry.cxx8
-rwxr-xr-x[-rw-r--r--]svtools/source/uno/svtxgridcontrol.cxx629
-rwxr-xr-x[-rw-r--r--]svtools/source/uno/svtxgridcontrol.hxx44
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx239
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx77
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx10
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx4
-rw-r--r--toolkit/qa/unoapi/knownissues.xcl10
-rw-r--r--toolkit/qa/unoapi/toolkit.sce8
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx121
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx37
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx99
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx23
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx148
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx29
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx112
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx18
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx5
-rw-r--r--toolkit/source/helper/property.cxx8
-rw-r--r--toolkit/source/layout/core/box-base.cxx5
-rw-r--r--toolkit/source/layout/core/box-base.hxx2
-rw-r--r--toolkit/src2xml/include.lst1
-rw-r--r--tools/inc/tools/solar.h2
-rw-r--r--tools/inc/tools/urlobj.hxx31
-rw-r--r--tools/source/fsys/urlobj.cxx64
-rw-r--r--tools/workben/urltest.cxx14
-rw-r--r--ucbhelper/inc/ucbhelper/configureucb.hxx201
-rw-r--r--ucbhelper/inc/ucbhelper/contentbroker.hxx2
-rw-r--r--ucbhelper/inc/ucbhelper/registerucb.hxx129
-rw-r--r--ucbhelper/prj/d.lst2
-rw-r--r--ucbhelper/source/client/contentbroker.cxx16
-rw-r--r--ucbhelper/source/provider/makefile.mk2
-rw-r--r--ucbhelper/source/provider/registerucb.cxx40
-rw-r--r--ucbhelper/source/provider/registerucb.hxx96
-rw-r--r--ucbhelper/source/provider/simpleauthenticationrequest.cxx9
-rw-r--r--vcl/aqua/inc/salframe.h2
-rw-r--r--vcl/aqua/inc/salinst.h2
-rw-r--r--vcl/aqua/source/a11y/aqua11yfactory.mm3
-rw-r--r--vcl/aqua/source/a11y/aqua11ytablewrapper.h10
-rw-r--r--vcl/aqua/source/a11y/aqua11ytablewrapper.mm182
-rw-r--r--vcl/aqua/source/a11y/aqua11ywrapper.mm31
-rw-r--r--vcl/aqua/source/app/salinst.cxx15
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx7
-rw-r--r--vcl/aqua/source/window/salframe.cxx17
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm78
-rw-r--r--vcl/inc/vcl/button.hxx2
-rw-r--r--vcl/inc/vcl/cmdevt.hxx8
-rw-r--r--vcl/inc/vcl/glyphcache.hxx5
-rw-r--r--vcl/inc/vcl/outfont.hxx6
-rw-r--r--vcl/inc/vcl/salwtype.hxx5
-rw-r--r--vcl/inc/vcl/vclevent.hxx1
-rw-r--r--vcl/os2/source/window/salframe.cxx7
-rwxr-xr-x[-rw-r--r--]vcl/source/app/settings.cxx2
-rw-r--r--vcl/source/control/button.cxx25
-rw-r--r--vcl/source/control/tabctrl.cxx2
-rw-r--r--vcl/source/fontsubset/cff.cxx60
-rw-r--r--vcl/source/gdi/bitmap.cxx18
-rw-r--r--vcl/source/gdi/outdev3.cxx12
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx2
-rwxr-xr-xvcl/source/gdi/sallayout.cxx4
-rw-r--r--vcl/source/glyphs/glyphcache.cxx6
-rw-r--r--vcl/source/src/print.src2
-rw-r--r--vcl/source/window/printdlg.cxx2
-rw-r--r--vcl/source/window/winproc.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atkbridge.cxx3
-rw-r--r--vcl/unx/gtk/a11y/atktext.cxx136
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx63
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.hxx5
-rw-r--r--vcl/unx/gtk/a11y/atkwindow.cxx26
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx4
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx21
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx87
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx1
-rw-r--r--vcl/unx/inc/saldata.hxx4
-rw-r--r--vcl/unx/inc/wmadaptor.hxx24
-rw-r--r--vcl/unx/source/app/saldata.cxx1
-rw-r--r--vcl/unx/source/app/saldisp.cxx6
-rw-r--r--vcl/unx/source/app/wmadaptor.cxx89
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx4
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx38
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx8
-rw-r--r--vcl/unx/source/window/salframe.cxx142
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx313
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx29
123 files changed, 4613 insertions, 2219 deletions
diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx
index ac9661c76ebc..e20440a3d30d 100644
--- a/comphelper/inc/comphelper/mediadescriptor.hxx
+++ b/comphelper/inc/comphelper/mediadescriptor.hxx
@@ -83,6 +83,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
static const ::rtl::OUString& PROP_FILTERNAME();
static const ::rtl::OUString& PROP_FILTEROPTIONS();
static const ::rtl::OUString& PROP_FORMAT();
+ static const ::rtl::OUString& PROP_FRAME();
static const ::rtl::OUString& PROP_FRAMENAME();
static const ::rtl::OUString& PROP_HIDDEN();
static const ::rtl::OUString& PROP_INPUTSTREAM();
diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx
index 796c0ad47142..b613ddd2c5f1 100644
--- a/comphelper/inc/comphelper/storagehelper.hxx
+++ b/comphelper/inc/comphelper/storagehelper.hxx
@@ -136,7 +136,8 @@ public:
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
@@ -144,7 +145,8 @@ public:
const ::rtl::OUString& aFormat,
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
@@ -153,7 +155,8 @@ public:
const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory
- = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() )
+ = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(),
+ sal_Bool bRepairStorage = sal_False )
throw ( ::com::sun::star::uno::Exception );
static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
diff --git a/comphelper/qa/complex/makefile.mk b/comphelper/qa/complex/makefile.mk
index 341b6868e1ec..ec0efdd1188c 100644
--- a/comphelper/qa/complex/makefile.mk
+++ b/comphelper/qa/complex/makefile.mk
@@ -32,9 +32,6 @@ PRJNAME = comphelper
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
-
-.IF "$(BUILD_QADEVOOO)" == "YES"
-
#----- compile .java files -----------------------------------------
JARFILES := ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
@@ -63,8 +60,6 @@ RUNNER_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,
RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex $(RUNNER_APPEXECCOMMAND)
-.END # "$(BUILD_QADEVOOO)" == "YES"
-
# --- Targets ------------------------------------------------------
.IF "$(depend)" == ""
@@ -78,7 +73,6 @@ ALL: ALLDEP
.INCLUDE : target.mk
-.IF "$(BUILD_QADEVOOO)" == "YES"
show_targets:
+@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s#.java##:s#./#complex.#))
@@ -87,11 +81,3 @@ run:
run_%:
+java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//)
-
-.ELSE
-run: show_targets
-
-show_targets:
- +@echo "Built without qadevOOo, no QA tests"
-
-.ENDIF
diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx
index 7e3be338992b..1710a43027cf 100644
--- a/comphelper/source/misc/mediadescriptor.cxx
+++ b/comphelper/source/misc/mediadescriptor.cxx
@@ -183,6 +183,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_FORMAT()
return sProp;
}
+const ::rtl::OUString& MediaDescriptor::PROP_FRAME()
+{
+ static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Frame"));
+ return sProp;
+}
+
const ::rtl::OUString& MediaDescriptor::PROP_FRAMENAME()
{
static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("FrameName"));
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index eda42ec98abb..e2557523f674 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -328,12 +328,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
const ::rtl::OUString& aFormat,
const ::rtl::OUString& aURL,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= aURL;
@@ -352,12 +359,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XInputStream >& xStream,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
@@ -377,12 +391,19 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
const ::rtl::OUString& aFormat,
const uno::Reference < io::XStream >& xStream,
sal_Int32 nStorageMode,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ sal_Bool bRepairStorage )
throw ( uno::Exception )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StorageFormat" ) );
aProps[0].Value <<= aFormat;
+ if ( bRepairStorage )
+ {
+ aProps.realloc( 2 );
+ aProps[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RepairPackage" ) );
+ aProps[1].Value <<= bRepairStorage;
+ }
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index 28c86d39673e..9d80bf7050e6 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -287,7 +287,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_BELARUSIAN, "be", "BY" },
{ LANGUAGE_CATALAN, "ca", "ES" }, // Spain (default)
{ LANGUAGE_CATALAN, "ca", "AD" }, // Andorra
- { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; workaround for UI localization only, do not use in document content!
+ { LANGUAGE_USER_CATALAN_VALENCIAN, "ca", "XV" }, // XV: ISO 3166 user-assigned; old workaround for UI localization only, do not use in document content! Kept just in case..
+ { LANGUAGE_USER_CATALAN_VALENCIAN, "qcv", "ES" }, // qcv: ISO 639-3 reserved-for-local-use; for UI localization, use in document content on own risk!
{ LANGUAGE_FRENCH_CAMEROON, "fr", "CM" },
{ LANGUAGE_FRENCH_COTE_D_IVOIRE, "fr", "CI" },
{ LANGUAGE_FRENCH_HAITI, "fr", "HT" },
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 1245247c3c9a..2a49f964d48f 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -69,6 +69,7 @@ public class HelpIndexerTool
String aModule = "";
String aTargetZipFileStr = "";
String aCfsName = "";
+ String aSegmentName = "";
// Scan arguments
boolean bLang = false;
@@ -77,6 +78,7 @@ public class HelpIndexerTool
boolean bSrcDir = false;
boolean bOutput = false;
boolean bCfsName = false;
+ boolean bSegmentName = false;
int nArgCount = args.length;
for( int i = 0 ; i < nArgCount ; i++ )
@@ -126,7 +128,7 @@ public class HelpIndexerTool
}
i++;
}
- else if( "-checkcfsname".equals(args[i]) )
+ else if( "-checkcfsandsegname".equals(args[i]) )
{
if( i + 1 < nArgCount )
{
@@ -134,6 +136,17 @@ public class HelpIndexerTool
bCfsName = true;
}
i++;
+ if( i + 1 < nArgCount )
+ {
+ aSegmentName = "segments" + args[i + 1];
+ bSegmentName = true;
+ }
+ i++;
+ if (!(bCfsName && bSegmentName))
+ {
+ System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
+ System.exit( -1 );
+ }
}
}
@@ -173,12 +186,17 @@ public class HelpIndexerTool
writer.close();
boolean bCfsFileOk = true;
- if( bCfsName && !bExtensionMode && nRet != -1 )
+ boolean bSegmentFileOk = true;
+ if( bCfsName && bSegmentName && !bExtensionMode && nRet != -1 )
{
String aCompleteCfsFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aCfsName;
+ String aCompleteSegmentFileName = aDirToZipStr + File.separator + aIndexDirName + File.separator + aSegmentName;
File aCfsFile = new File( aCompleteCfsFileName );
+ File aSegmentFile = new File( aCompleteSegmentFileName );
bCfsFileOk = aCfsFile.exists();
+ bSegmentFileOk = aSegmentFile.exists();
System.out.println( "Checking cfs file " + aCfsName+ ": " + (bCfsFileOk ? "Found" : "Not found") );
+ System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") );
}
if( bExtensionMode )
@@ -194,7 +212,7 @@ public class HelpIndexerTool
if( nRet == -1 )
deleteRecursively( aIndexDir );
- if( bCfsFileOk )
+ if( bCfsFileOk && bSegmentFileOk )
System.out.println( "Zipping ..." );
File aDirToZipFile = new File( aDirToZipStr );
createZipFile( aDirToZipFile, aTargetZipFileStr );
@@ -207,6 +225,12 @@ public class HelpIndexerTool
System.exit( -1 );
}
+ if( !bSegmentFileOk )
+ {
+ System.out.println( "segment file check failed, terminating..." );
+ System.exit( -1 );
+ }
+
Date end = new Date();
if( !bExtensionMode )
System.out.println(end.getTime() - start.getTime() + " total milliseconds");
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
index 3ea15e28141c..583e14c06caa 100644
--- a/padmin/source/padialog.cxx
+++ b/padmin/source/padialog.cxx
@@ -147,6 +147,11 @@ void PADialog::Init()
::psp::PrintFontManager& rFontManager( ::psp::PrintFontManager::get() );
if( ! rFontManager.checkImportPossible() )
m_aFontsPB.Enable( FALSE );
+ if( rFontManager.hasFontconfig() )
+ {
+ m_aFontsPB.Enable( FALSE );
+ m_aFontsPB.Show( FALSE );
+ }
}
PADialog::~PADialog()
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index 287a079f63c8..3a3eff653cd7 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.hxx
@@ -68,7 +68,6 @@ class RscChar
{
public:
static char * MakeUTF8( char * pStr, UINT16 nTextEncoding );
- static char * MakeUTF8FromL( char * pStr );
};
/****************** R s c P t r P t r ************************************/
diff --git a/rsc/source/tools/rscchar.cxx b/rsc/source/tools/rscchar.cxx
index ca421dde372a..c23022e4222e 100644
--- a/rsc/source/tools/rscchar.cxx
+++ b/rsc/source/tools/rscchar.cxx
@@ -194,136 +194,3 @@ char * RscChar::MakeUTF8( char * pStr, UINT16 nTextEncoding )
return pUtf8;
};
-
-/*************************************************************************
-|*
-|* RscChar::MakeChar()
-|*
-|* Beschreibung Der String wird nach C-Konvention umgesetzt
-|* Ersterstellung MM 20.03.91
-|* Letzte Aenderung MM 20.03.91
-|*
-*************************************************************************/
-char * RscChar::MakeUTF8FromL( char * pStr )
-{
- sal_Size nUniPos = 0;
- sal_Unicode * pUniCode = new sal_Unicode[ strlen( pStr ) + 1 ];
-
- char cOld = '1';
- while( cOld != 0 )
- {
- sal_Unicode c;
- if( *pStr == '\\' )
- {
- ++pStr;
- switch( *pStr )
- {
- case 'a':
- c = '\a';
- break;
- case 'b':
- c = '\b';
- break;
- case 'f':
- c = '\f';
- break;
- case 'n':
- c = '\n';
- break;
- case 'r':
- c = '\r';
- break;
- case 't':
- c = '\t';
- break;
- case 'v':
- c = '\v';
- break;
- case '\\':
- c = '\\';
- break;
- case '?':
- c = '\?';
- break;
- case '\'':
- c = '\'';
- break;
- case '\"':
- c = '\"';
- break;
- default:
- {
- if( '0' <= *pStr && '7' >= *pStr )
- {
- UINT32 nChar = 0;
- int i = 0;
- while( '0' <= *pStr && '7' >= *pStr && i != 6 )
- {
- nChar = nChar * 8 + (BYTE)*pStr - (BYTE)'0';
- ++pStr;
- i++;
- }
- if( nChar > 0xFFFF )
- // Wert zu gross, oder kein 3 Ziffern
- return( FALSE );
- c = (UINT16)nChar;
- pStr--;
- }
- else if( 'x' == *pStr || 'X' == *pStr )
- {
- UINT32 nChar = 0;
- int i = 0;
- ++pStr;
- while( isxdigit( *pStr ) && i != 4 )
- {
- if( isdigit( *pStr ) )
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'0';
- else if( isupper( *pStr ) )
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'A' +10;
- else
- nChar = nChar * 16 + (BYTE)*pStr - (BYTE)'a' +10;
- ++pStr;
- i++;
- }
- c = (UINT16)nChar;
- pStr--;
- }
- else
- c = *pStr;
- };
- }
- }
- else
- c = *pStr;
-
- pUniCode[ nUniPos++ ] = c;
- cOld = *pStr;
- pStr++;
- }
-
- // factor fo 6 is the maximum size of an UNICODE character as utf8
- sal_Size nMaxUtf8Len = nUniPos * 6;
- if( nUniPos * 6 > 0x0FFFFF )
- RscExit( 10 );
-
- char * pUtf8 = (char *)rtl_allocateMemory( nMaxUtf8Len );
- rtl_TextToUnicodeConverter hConv = rtl_createUnicodeToTextConverter( RTL_TEXTENCODING_UTF8 );
-
- sal_uInt32 nInfo;
- sal_Size nSrcCvtBytes;
- rtl_convertUnicodeToText( hConv, 0,
- pUniCode, nUniPos,
- pUtf8, nMaxUtf8Len,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT
- | RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT
- | RTL_UNICODETOTEXT_FLAGS_FLUSH,
- &nInfo,
- &nSrcCvtBytes );
-
- rtl_destroyUnicodeToTextConverter( hConv );
-
- delete[] pUniCode;
-
- return pUtf8;
-};
-
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 68686ff8c8f5..1780e45c5ed6 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -199,9 +199,9 @@ void OLESimpleStorage::InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::
uno::Reference< container::XNameAccess > xSubNameAccess;
uno::Any aAny = xNameAccess->getByName( aElements[nInd] );
if ( aAny >>= xInputStream )
- InsertInputStreamToStorage_Impl( pNewStorage, aName, xInputStream );
+ InsertInputStreamToStorage_Impl( pNewStorage, aElements[nInd], xInputStream );
else if ( aAny >>= xSubNameAccess )
- InsertNameAccessToStorage_Impl( pNewStorage, aName, xSubNameAccess );
+ InsertNameAccessToStorage_Impl( pNewStorage, aElements[nInd], xSubNameAccess );
}
}
catch( uno::Exception& )
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 00f2dbe92b4c..598295797ea6 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -333,6 +333,17 @@ class SvNumberFormatterRegistry_Impl;
class SVL_DLLPUBLIC SvNumberFormatter
{
public:
+ /**
+ * We can't technically have an "infinite" value, so we use an arbitrary
+ * upper precision threshold to represent the "unlimited" precision.
+ */
+ static const sal_uInt16 UNLIMITED_PRECISION;
+
+ /**
+ * Precision suitable for numbers displayed in input bar, for instance
+ * Calc's formula input bar.
+ */
+ static const sal_uInt16 INPUTSTRING_PRECISION;
/// Preferred ctor with service manager and language/country enum
SvNumberFormatter(
@@ -583,7 +594,7 @@ public:
/// Return the reference date
Date* GetNullDate();
/// Return the standard decimal precision
- short GetStandardPrec();
+ sal_uInt16 GetStandardPrec();
/// Return whether zero suppression is switched on
BOOL GetNoZero() { return bNoZero; }
/** Get the type of a format (or NUMBERFORMAT_UNDEFINED if no entry),
diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx
index 7cdcf4db518d..7c361382796a 100644
--- a/svl/inc/svl/zformat.hxx
+++ b/svl/inc/svl/zformat.hxx
@@ -236,6 +236,12 @@ public:
// in fact that could be any string used in number formats.
static void LoadString( SvStream& rStream, String& rStr );
+ /**
+ * Get output string from a numeric value that fits the number of
+ * characters specified.
+ */
+ bool GetOutputString( double fNumber, sal_uInt16 nCharCount, String& rOutString ) const;
+
BOOL GetOutputString( double fNumber, String& OutString, Color** ppColor );
BOOL GetOutputString( String& sString, String& OutString, Color** ppColor );
@@ -487,6 +493,7 @@ private:
// standard number output
SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString );
+ SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const;
// numbers in input line
SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString );
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index b8bed49b603b..60c622208d53 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -28,7 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svl.hxx"
-#ifndef GCC
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
#endif
#define _SVSTDARR_STRINGS
@@ -808,6 +809,16 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
{
// Alle Styles umsetzen, deren Parent dieser hier ist
ChangeParent( p->GetName(), p->GetParent() );
+
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
+ if( xComp.is() ) try
+ {
+ xComp->dispose();
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+
aStyles.erase(aIter);
Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
}
@@ -838,6 +849,15 @@ void SfxStyleSheetBasePool::Clear()
SfxStyles::iterator aIter( aClearStyles.begin() );
while( aIter != aClearStyles.end() )
{
+ com::sun::star::uno::Reference< com::sun::star::lang::XComponent > xComp( static_cast< ::cppu::OWeakObject* >((*aIter).get()), com::sun::star::uno::UNO_QUERY );
+ if( xComp.is() ) try
+ {
+ xComp->dispose();
+ }
+ catch( com::sun::star::uno::Exception& )
+ {
+ }
+
Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) );
}
}
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index a3a3f63367c1..46063564193d 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -123,8 +123,7 @@ inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
eStyle);
if (bCheckFileExists
&& !bWasAbsolute
- && (aAbsURIRef.GetProtocol() == INET_PROT_FILE
- || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS))
+ && (aAbsURIRef.GetProtocol() == INET_PROT_FILE))
{
INetURLObject aNonFileURIRef;
aNonFileURIRef.SetSmartURL(rTheRelURIRef,
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 05dab66754e1..cb66a75558c2 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -61,6 +61,7 @@
#include <rtl/instance.hxx>
#include <math.h>
+#include <limits>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -178,6 +179,9 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* );
/***********************Funktionen SvNumberFormatter**************************/
+const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max();
+const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits<sal_uInt16>::max()-1;
+
SvNumberFormatter::SvNumberFormatter(
const Reference< XMultiServiceFactory >& xSMgr,
LanguageType eLang )
@@ -338,7 +342,7 @@ void SvNumberFormatter::ChangeStandardPrec(short nPrec)
pFormatScanner->ChangeStandardPrec(nPrec);
}
-short SvNumberFormatter::GetStandardPrec()
+sal_uInt16 SvNumberFormatter::GetStandardPrec()
{
return pFormatScanner->GetStandardPrec();
}
@@ -1473,7 +1477,6 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
String& sOutString)
{
SvNumberformat* pFormat;
- short nOldPrec;
Color* pColor;
pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
if (!pFormat)
@@ -1483,7 +1486,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
if (eType == 0)
eType = NUMBERFORMAT_DEFINED;
- nOldPrec = -1;
+ sal_uInt16 nOldPrec = pFormatScanner->GetStandardPrec();
+ bool bPrecChanged = false;
if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
|| eType == NUMBERFORMAT_CURRENCY
|| eType == NUMBERFORMAT_SCIENTIFIC
@@ -1491,8 +1495,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
{
if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
eType = NUMBERFORMAT_NUMBER;
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
+ ChangeStandardPrec(INPUTSTRING_PRECISION);
+ bPrecChanged = true;
}
sal_uInt32 nKey = nFIndex;
switch ( eType )
@@ -1512,12 +1516,12 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
{
if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
{
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
+ ChangeStandardPrec(INPUTSTRING_PRECISION);
+ bPrecChanged = true;
}
pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
}
- if (nOldPrec != -1)
+ if (bPrecChanged)
ChangeStandardPrec(nOldPrec);
}
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 5b7821aa457e..707b2362f0ed 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -54,6 +54,9 @@
#include "numhead.hxx"
#include <unotools/digitgroupingiterator.hxx>
#include "nfsymbol.hxx"
+
+#include <cmath>
+
using namespace svt;
namespace {
@@ -63,6 +66,10 @@ struct Gregorian
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian"));
}
};
+
+const sal_uInt16 UPPER_PRECISION = 300; // entirely arbitrary...
+const double EXP_LOWER_BOUND = 1.0E-4; // prefer scientific notation below this value.
+
}
const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0
@@ -675,7 +682,7 @@ SvNumberformat::SvNumberformat(String& rString,
xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr);
if (nAnzChars > 0)
{
- short F_Type;
+ short F_Type = NUMBERFORMAT_UNDEFINED;
if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) ||
( F_Type != NUMBERFORMAT_NUMBER &&
F_Type != NUMBERFORMAT_SCIENTIFIC) )
@@ -1774,47 +1781,62 @@ void SvNumberformat::Build50Formatstring( String& rStr ) const
void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
{
- USHORT nStandardPrec = rScan.GetStandardPrec();
+ sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
+
if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16
+ {
+ nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals
OutString = ::rtl::math::doubleToUString( fNumber,
rtl_math_StringFormat_E, nStandardPrec /*2*/,
GetFormatter().GetNumDecimalSep().GetChar(0));
+ }
else
- {
+ ImpGetOutputStdToPrecision(fNumber, OutString, nStandardPrec);
+}
+
+void SvNumberformat::ImpGetOutputStdToPrecision(double& rNumber, String& rOutString, sal_uInt16 nPrecision) const
+{
+ // Make sure the precision doesn't go over the maximum allowable precision.
+ nPrecision = ::std::min(UPPER_PRECISION, nPrecision);
+
#if 0
{
- // debugger test case for ANSI standard correctness
- ::rtl::OUString aTest;
- // expect 0.00123 OK
- aTest = ::rtl::math::doubleToUString( 0.001234567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123.5 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 4, '.', sal_True );
- // expect 1e+03 (as 999.6 rounded to 3 significant digits results in
- // 1000 with an exponent equal to significant digits)
- // Currently (24-Jan-2003) we do fail in this case and output 1000
- // instead, negligible.
- aTest = ::rtl::math::doubleToUString( 999.6,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect what? result is 1.2e+004
- aTest = ::rtl::math::doubleToUString( 12345.6789,
- rtl_math_StringFormat_G, -3, '.', sal_True );
+ // debugger test case for ANSI standard correctness
+ ::rtl::OUString aTest;
+ // expect 0.00123 OK
+ aTest = ::rtl::math::doubleToUString( 0.001234567,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect 123 OK
+ aTest = ::rtl::math::doubleToUString( 123.4567,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect 123.5 OK
+ aTest = ::rtl::math::doubleToUString( 123.4567,
+ rtl_math_StringFormat_G, 4, '.', sal_True );
+ // expect 1e+03 (as 999.6 rounded to 3 significant digits results in
+ // 1000 with an exponent equal to significant digits)
+ // Currently (24-Jan-2003) we do fail in this case and output 1000
+ // instead, negligible.
+ aTest = ::rtl::math::doubleToUString( 999.6,
+ rtl_math_StringFormat_G, 3, '.', sal_True );
+ // expect what? result is 1.2e+004
+ aTest = ::rtl::math::doubleToUString( 12345.6789,
+ rtl_math_StringFormat_G, -3, '.', sal_True );
}
#endif
- OutString = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, nStandardPrec /*2*/,
- GetFormatter().GetNumDecimalSep().GetChar(0), sal_True );
- if (OutString.GetChar(0) == '-' &&
- OutString.GetTokenCount('0') == OutString.Len())
- OutString.EraseLeadingChars('-'); // nicht -0
- }
- ImpTransliterate( OutString, NumFor[0].GetNatNum() );
- return;
+ // We decided to strip trailing zeros unconditionally, since binary
+ // double-precision rounding error makes it impossible to determine e.g.
+ // whether 844.10000000000002273737 is what the user has typed, or the
+ // user has typed 844.1 but IEEE 754 represents it that way internally.
+
+ rOutString = ::rtl::math::doubleToUString( rNumber,
+ rtl_math_StringFormat_F, nPrecision /*2*/,
+ GetFormatter().GetNumDecimalSep().GetChar(0), true );
+ if (rOutString.GetChar(0) == '-' &&
+ rOutString.GetTokenCount('0') == rOutString.Len())
+ rOutString.EraseLeadingChars('-'); // nicht -0
+
+ ImpTransliterate( rOutString, NumFor[0].GetNatNum() );
}
void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString)
@@ -1955,6 +1977,71 @@ ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y)
}
}
+namespace {
+
+void lcl_GetOutputStringScientific(
+ double fNumber, sal_uInt16 nCharCount, const SvNumberFormatter& rFormatter, String& rOutString)
+{
+ bool bSign = ::rtl::math::isSignBitSet(fNumber);
+
+ // 1.000E+015 (one digit and the decimal point, and the five chars for the exponential part, totalling 7).
+ sal_uInt16 nPrec = nCharCount > 7 ? nCharCount - 7 : 0;
+ if (nPrec && bSign)
+ // Make room for the negative sign.
+ --nPrec;
+
+ nPrec = ::std::min(nPrec, static_cast<sal_uInt16>(14)); // limit to 14 decimals.
+
+ rOutString = ::rtl::math::doubleToUString(
+ fNumber, rtl_math_StringFormat_E, nPrec, rFormatter.GetNumDecimalSep().GetChar(0));
+}
+
+}
+
+bool SvNumberformat::GetOutputString(double fNumber, sal_uInt16 nCharCount, String& rOutString) const
+{
+ using namespace std;
+
+ if (eType != NUMBERFORMAT_NUMBER)
+ return false;
+
+ double fTestNum = fNumber;
+ bool bSign = ::rtl::math::isSignBitSet(fTestNum);
+ if (bSign)
+ fTestNum = -fTestNum;
+
+ if (fTestNum < EXP_LOWER_BOUND)
+ {
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+ return true;
+ }
+
+ double fExp = log10(fTestNum);
+ // Values < 1.0 always have one digit before the decimal point.
+ sal_uInt16 nDigitPre = fExp >= 0.0 ? static_cast<sal_uInt16>(ceil(fExp)) : 1;
+
+ if (nDigitPre > 15)
+ {
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+ return true;
+ }
+
+ sal_uInt16 nPrec = nCharCount >= nDigitPre ? nCharCount - nDigitPre : 0;
+ if (nPrec && bSign)
+ // Subtract the negative sign.
+ --nPrec;
+ if (nPrec)
+ // Subtract the decimal point.
+ --nPrec;
+
+ ImpGetOutputStdToPrecision(fNumber, rOutString, nPrec);
+ if (rOutString.Len() > nCharCount)
+ // String still wider than desired. Switch to scientific notation.
+ lcl_GetOutputStringScientific(fNumber, nCharCount, GetFormatter(), rOutString);
+
+ return true;
+}
+
BOOL SvNumberformat::GetOutputString(double fNumber,
String& OutString,
Color** ppColor)
@@ -1978,16 +2065,43 @@ BOOL SvNumberformat::GetOutputString(double fNumber,
BOOL bHadStandard = FALSE;
if (bStandard) // einzelne Standardformate
{
- if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine
+ if (rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION) // alle Zahlformate InputLine
{
ImpGetOutputInputLine(fNumber, OutString);
- return FALSE;
+ return false;
}
switch (eType)
{
case NUMBERFORMAT_NUMBER: // Standardzahlformat
+ {
+ if (rScan.GetStandardPrec() == SvNumberFormatter::UNLIMITED_PRECISION)
+ {
+ bool bSign = ::rtl::math::isSignBitSet(fNumber);
+ if (bSign)
+ fNumber = -fNumber;
+ ImpGetOutputStdToPrecision(fNumber, OutString, 10); // Use 10 decimals for general 'unlimited' format.
+ if (fNumber < EXP_LOWER_BOUND)
+ {
+ xub_StrLen nLen = OutString.Len();
+ if (!nLen)
+ return false;
+
+ if (nLen > 11)
+ {
+ sal_uInt16 nStandardPrec = rScan.GetStandardPrec();
+ nStandardPrec = ::std::min(nStandardPrec, static_cast<sal_uInt16>(14)); // limits to 14 decimals
+ OutString = ::rtl::math::doubleToUString( fNumber,
+ rtl_math_StringFormat_E, nStandardPrec /*2*/,
+ GetFormatter().GetNumDecimalSep().GetChar(0), true);
+ }
+ }
+ if (bSign)
+ OutString.Insert('-', 0);
+ return false;
+ }
ImpGetOutputStandard(fNumber, OutString);
bHadStandard = TRUE;
+ }
break;
case NUMBERFORMAT_DATE:
bRes |= ImpGetDateOutput(fNumber, 0, OutString);
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 5ed78bd69108..fb59e4289ad1 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -465,7 +465,7 @@ void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nY
pNullDate = new Date(nDay, nMonth, nYear);
}
-void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec)
+void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)
{
nStandardPrec = nPrec;
}
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index fb9e40488e24..d623a3f50026 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -54,7 +54,7 @@ public:
void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
// tauscht Referenzdatum aus
- void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus
+ void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus
xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
@@ -93,7 +93,7 @@ public:
InitKeywords();
return sNameStandardFormat;
}
- short GetStandardPrec() const { return nStandardPrec; }
+ sal_uInt16 GetStandardPrec() const { return nStandardPrec; }
const Color& GetRedColor() const { return StandardColor[4]; }
Color* GetColor(String& sStr); // Setzt Hauptfarben oder
// definierte Farben
@@ -158,7 +158,7 @@ private: // ---- privater Teil
// Array der Standardfarben
Date* pNullDate; // 30Dec1899
String sNameStandardFormat; // "Standard"
- short nStandardPrec; // default Precision fuer Standardformat (2)
+ sal_uInt16 nStandardPrec; // default Precision for Standardformat
SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx
index b08a7f04f1da..7098d2b0d4ef 100644..100755
--- a/svtools/inc/svtools/accessibletable.hxx
+++ b/svtools/inc/svtools/accessibletable.hxx
@@ -94,9 +94,8 @@ public:
virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
/** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
- the accessible object), depending on the specified object type. */
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
+ the accessible object), depending on the specified object type. */
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const= 0;
// Window
@@ -122,8 +121,10 @@ public:
virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0;
virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
- virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
+ virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
virtual std::vector<sal_Int32>& GetSelectedRows() = 0;
+ virtual void RemoveSelectedRow(sal_Int32 _nRowPos) = 0;
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
index 8e92abc6c04c..2b3951f6aaf3 100644
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx
@@ -30,6 +30,7 @@
#include <sal/types.h>
#include <vcl/event.hxx>
#include <vcl/seleng.hxx>
+#include "tabletypes.hxx"
//........................................................................
namespace svt { namespace table
{
@@ -112,14 +113,15 @@ namespace svt { namespace table
@see TableControlAction
*/
virtual bool dispatchAction( TableControlAction _eAction ) = 0;
- /** to be called on mouse button up/down
- @return
- <TRUE/> if the click was in the visible area of the table control,
- <FALSE/> otherwise.*/
- virtual bool isClickInVisibleArea( const Point& _rPoint ) = 0;
- /** returns selection engine*/
- virtual SelectionEngine* getSelEngine() = 0;
- virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
+ /** returns selection engine*/
+ virtual SelectionEngine* getSelEngine() = 0;
+ virtual void setCursorAtCurrentCell(const Point& rPoint) = 0;
+ virtual rtl::OUString& setTooltip(const Point& rPoint ) = 0;
+ virtual RowPos getCurrentRow(const Point& rPoint ) = 0;
+ virtual void resizeColumn(const Point& rPoint ) = 0;
+ virtual bool startResizeColumn(const Point& rPoint) = 0;
+ virtual bool endResizeColumn(const Point& rPoint) = 0;
+ virtual bool isRowSelected(RowPos _nRow) = 0;
virtual ~IAbstractTableControl() {};
};
diff --git a/svtools/inc/svtools/table/defaultinputhandler.hxx b/svtools/inc/svtools/table/defaultinputhandler.hxx
index b9e2db31ca01..ca760896d539 100644
--- a/svtools/inc/svtools/table/defaultinputhandler.hxx
+++ b/svtools/inc/svtools/table/defaultinputhandler.hxx
@@ -44,6 +44,7 @@ namespace svt { namespace table
friend class TableDataWindow;
private:
DefaultInputHandler_Impl* m_pImpl;
+ bool m_bResize;
public:
DefaultInputHandler();
diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index 13d44617d523..e474306c0423 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -90,10 +90,14 @@ namespace svt { namespace table
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText );
- virtual void PaintCell( ColPos _nColumn,
+ virtual void PaintCellImage( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText );
+ const StyleSettings& _rStyle, Image* _pCellData );
+ virtual void PaintCellString( ColPos _nColumn,
+ bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle, rtl::OUString& _rText );
virtual void ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect);
virtual void HideCellCursor( Window& _rView, const Rectangle& _rCursorRect);
};
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index c1381e3b3c0b..313b2b7b7735 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -27,12 +27,14 @@
#ifndef SVTOOLS_INC_TABLE_TABLECONTROL_HXX
#define SVTOOLS_INC_TABLE_TABLECONTROL_HXX
+#include "svtools/svtdllapi.h"
#include <svtools/table/tablemodel.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/seleng.hxx>
#include <svtools/table/tabledatawindow.hxx>
#include <svtools/accessibletable.hxx>
-#include "svtaccessiblefactory.hxx"
+#include <com/sun/star/util/Color.hpp>
+#include <svtools/accessiblefactory.hxx>
//........................................................................
namespace svt { namespace table
@@ -64,13 +66,19 @@ namespace svt { namespace table
// TODO: scrolling?
*/
- class TableControl : public Control, public IAccessibleTable
+ class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
{
private:
- DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* );
- DECL_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
TableControl_Impl* m_pImpl;
+ ::com::sun::star::uno::Sequence< sal_Int32 > m_nCols;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aText;
+ Link m_aSelectHdl;
+ bool m_bSelectionChanged;
public:
::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable;
@@ -78,7 +86,7 @@ namespace svt { namespace table
~TableControl();
/// sets a new table model
- void SetModel( PTableModel _pModel );
+ SVT_DLLPRIVATE void SetModel( PTableModel _pModel );
/// retrieves the current table model
PTableModel GetModel() const;
@@ -148,65 +156,72 @@ namespace svt { namespace table
{
return GoTo( GetCurrentColumn(), _nRow );
}
- virtual void Resize();
+ SVT_DLLPRIVATE virtual void Resize();
+ virtual void Select();
+ SVT_DLLPRIVATE void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
+ const Link& GetSelectHdl() const { return m_aSelectHdl; }
- /**invalidates the table if table has been changed e.g. new row added
- */
- void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved);
- /**gets the vector, which contains the selected rows
- */
- std::vector<sal_Int32>& GetSelectedRows();
- /**after removing a row, updates the vector which contains the selected rows
- if the row, which should be removed, is selected, it will be erased from the vector
- */
- void removeSelectedRow(RowPos _nRowPos);
- SelectionEngine* getSelEngine();
- TableDataWindow* getDataWindow();
+ /**invalidates the table if table has been changed e.g. new row added
+ */
+ void InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved);
+ /**gets the vector, which contains the selected rows
+ */
+ std::vector<sal_Int32>& GetSelectedRows();
+ /**after removing a row, updates the vector which contains the selected rows
+ if the row, which should be removed, is selected, it will be erased from the vector
+ */
+ SelectionEngine* getSelEngine();
+ TableDataWindow* getDataWindow();
// Window overridables
virtual void GetFocus();
virtual void LoseFocus();
virtual void KeyInput( const KeyEvent& rKEvt );
- //virtual long Notify(NotifyEvent& rNEvt);
-
- /** Creates and returns the accessible object of the whole BrowseBox. */
- virtual XACC CreateAccessible();
- virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
- virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
- virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
- virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
- virtual void FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
- AccessibleTableControlObjType eObjType ) const;
-
- //// Window
- virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
- virtual void GrabFocus();
- virtual XACC GetAccessible( BOOL bCreate = TRUE );
- virtual Window* GetAccessibleParentWindow() const;
- virtual Window* GetWindowInstance();
- virtual sal_Int32 GetAccessibleControlCount() const;
- virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
- virtual long GetRowCount() const;
- virtual long GetColumnCount() const;
- virtual sal_Bool HasRowHeader() const;
- virtual sal_Int32 GetSelectedRowCount() const;
- virtual bool IsRowSelected( long _nRow ) const;
- virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
- virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE );
- virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE );
- virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
- virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
- virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
- virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
- virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
- virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
- virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
- virtual sal_Bool HasRowHeader();
- virtual sal_Bool HasColHeader();
- virtual sal_Bool isAccessibleAlive( ) const;
- virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
+ //virtual long Notify(NotifyEvent& rNEvt);
+
+ /** Creates and returns the accessible object of the whole GridControl. */
+ SVT_DLLPRIVATE virtual XACC CreateAccessible();
+ SVT_DLLPRIVATE virtual XACC CreateAccessibleControl( sal_Int32 _nIndex );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const;
+ SVT_DLLPRIVATE virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow );
+ SVT_DLLPRIVATE virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const;
+ virtual void FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const;
+ //// Window
+ virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
+ virtual void GrabFocus();
+ virtual XACC GetAccessible( BOOL bCreate = TRUE );
+ virtual Window* GetAccessibleParentWindow() const;
+ virtual Window* GetWindowInstance();
+ virtual sal_Int32 GetAccessibleControlCount() const;
+ virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint );
+ virtual long GetRowCount() const;
+ virtual long GetColumnCount() const;
+ virtual sal_Bool HasRowHeader() const;
+ virtual sal_Int32 GetSelectedRowCount() const;
+ virtual bool IsRowSelected( long _nRow ) const;
+ virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint );
+ virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE );
+ virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE );
+ virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex);
+ virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint);
+ virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const;
+ virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const;
+ virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const;
+ virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const;
+ virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const;
+ virtual sal_Bool HasRowHeader();
+ virtual sal_Bool HasColHeader();
+ virtual sal_Bool isAccessibleAlive( ) const;
+ virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue );
+ virtual void RemoveSelectedRow(RowPos _nRowPos);
+ virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos);
+ ::com::sun::star::uno::Sequence< sal_Int32 >& getColumnsForTooltip();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& getTextForTooltip();
+ void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
+ void selectionChanged(bool _bChanged);
protected:
@@ -219,27 +234,6 @@ namespace svt { namespace table
TableControl& operator=( const TableControl& ); // never implemented
};
- class AccessibleTableControl_Impl
- {
- public:
- AccessibleFactoryAccess m_aFactoryAccess;
- IAccessibleTableControl* m_pAccessible;
-
- public:
- AccessibleTableControl_Impl() : m_pAccessible(NULL)
- {
- }
-
-
- /// @see AccessibleTableControl::getTableRowHeader
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
- /// @see AccessibleTableControl::getTable
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- getAccessibleTable( );
-
- };
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx
index d14a25289c99..c9f96483d943 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/inc/svtools/table/tabledatawindow.hxx
@@ -53,21 +53,27 @@ namespace svt { namespace table
private:
TableControl_Impl& m_rTableControl;
Link m_aMouseButtonDownHdl;
- Link m_aMouseButtonUpHdl;
-
+ Link m_aMouseButtonUpHdl;
+ Link m_aSelectHdl;
+ RowPos m_nRowAlreadySelected;
public:
TableDataWindow( TableControl_Impl& _rTableControl );
inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; }
inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; }
inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; }
inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; }
+ inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
+ inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
// Window overridables
virtual void Paint( const Rectangle& rRect );
virtual void MouseMove( const MouseEvent& rMEvt);
virtual void MouseButtonDown( const MouseEvent& rMEvt);
virtual void MouseButtonUp( const MouseEvent& rMEvt);
-
+ virtual void SetPointer( const Pointer& rPointer );
+ virtual void CaptureMouse();
+ virtual void ReleaseMouse();
+ virtual long Notify(NotifyEvent& rNEvt);
};
//........................................................................
} } // namespace svt::table
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index 34a89cb03e6b..3da396d9d86c 100644
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -27,13 +27,16 @@
#ifndef SVTOOLS_INC_TABLE_TABLEMODEL_HXX
#define SVTOOLS_INC_TABLE_TABLEMODEL_HXX
+#include "svtools/svtdllapi.h"
#include <svtools/table/tabletypes.hxx>
#include <svtools/table/tablerenderer.hxx>
#include <svtools/table/tableinputhandler.hxx>
-
+#include <rtl/ref.hxx>
#include <sal/types.h>
-
+#include <com/sun/star/util/Color.hpp>
#include <boost/shared_ptr.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
//........................................................................
namespace svt { namespace table
@@ -44,21 +47,16 @@ namespace svt { namespace table
//====================================================================
//= cell data
//====================================================================
- struct CellEntryType
+ struct TableContentType
{
- String m_aStr;
- //Image m_aImage;
- //Control m_aControl;
- CellEntryType( const String& _rStr ) :
- m_aStr( _rStr )
- {}
+ ::rtl::OUString sContent;
+ Image* pImage;
+ TableContentType() :
+ sContent(),
+ pImage( )
+ {
+ }
};
-
- //typedef ::std::vector<CellEntryType*> CellColumnContent;
- //vector, which contains text data for each cell
- typedef ::std::vector<String> CellColumnContent;
- //vector, which contains data for rows
- typedef ::std::vector<CellColumnContent> CellContent;
//====================================================================
//= ScrollbarVisibility
//====================================================================
@@ -285,7 +283,24 @@ namespace svt { namespace table
*/
virtual void setMaxWidth( TableMetrics _nMaxWidth ) = 0;
+ /** returns the preferred width of the column, or 0 if the column
+ does not have a preferred width.
+
+ @see setMaxWidth
+ @see getMinWidth
+ @see getWidth
+ */
+ virtual TableMetrics getPreferredWidth() const = 0;
+ /** sets the preferred width of the column, to be used when user resizes column
+
+ @see getMaxWidth
+ @see setMinWidth
+ @see setWidth
+ */
+ virtual void setPreferredWidth( TableMetrics _nPrefWidth ) = 0;
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign() = 0;
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign) = 0;
/// deletes the column model instance
virtual ~IColumnModel() { }
};
@@ -296,7 +311,7 @@ namespace svt { namespace table
//====================================================================
/** declares the interface to implement by an abtract table model
*/
- class SAL_NO_VTABLE ITableModel
+ class SAL_NO_VTABLE SVT_DLLPUBLIC ITableModel
{
public:
/** returns the number of columns in the table
@@ -307,8 +322,8 @@ namespace svt { namespace table
*/
virtual TableSize getRowCount() const = 0;
- virtual void setColumnCount(TableSize _nColCount) = 0;
- virtual void setRowCount(TableSize _nRowCount) = 0;
+ SVT_DLLPRIVATE virtual void setColumnCount(TableSize _nColCount) = 0;
+ SVT_DLLPRIVATE virtual void setRowCount(TableSize _nRowCount) = 0;
/** determines whether the table has column headers
@@ -321,12 +336,12 @@ namespace svt { namespace table
/** sets whether the table should have row headers
@see IColumnRenderer
*/
- virtual void setRowHeaders( bool rowHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeaders( bool rowHeaders) = 0;
/** sets whether the table should have column headers
@see IColumnRenderer
*/
- virtual void setColumnHeaders( bool columnHeaders) = 0;
+ SVT_DLLPRIVATE virtual void setColumnHeaders( bool columnHeaders) = 0;
/** determines whether the table has row headers
@@ -346,11 +361,11 @@ namespace svt { namespace table
/** adds the given listener to the list of ->ITableModelListener's
*/
- virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void addTableModelListener( const PTableModelListener& listener ) = 0;
/** revokes the given listener from the list of ->ITableModelListener's
*/
- virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
+ SVT_DLLPRIVATE virtual void removeTableModelListener( const PTableModelListener& listener ) = 0;
/** returns a model for a certain column
@@ -380,7 +395,7 @@ namespace svt { namespace table
@return the renderer to use. Must not be <NULL/>
*/
- virtual PTableRenderer getRenderer() const = 0;
+ SVT_DLLPRIVATE virtual PTableRenderer getRenderer() const = 0;
/** returns the component handling input in a view associated with the model
*/
@@ -392,9 +407,9 @@ namespace svt { namespace table
the logical height of rows in the table, in 1/100 millimeters. The height must be
greater 0.
*/
- virtual TableMetrics getRowHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getRowHeight() const = 0;
- virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
+ SVT_DLLPRIVATE virtual void setRowHeight(TableMetrics _nRowHeight) = 0;
/** determines the height of the column header row
@@ -405,7 +420,7 @@ namespace svt { namespace table
the logical height of the column header row, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getColumnHeaderHeight() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getColumnHeaderHeight() const = 0;
/** determines the width of the row header column
@@ -416,7 +431,7 @@ namespace svt { namespace table
the logical width of the row header column, in 1/100 millimeters.
Must be greater than 0.
*/
- virtual TableMetrics getRowHeaderWidth() const = 0;
+ SVT_DLLPRIVATE virtual TableMetrics getRowHeaderWidth() const = 0;
/** determines the visibility of the vertical scrollbar of the table control
@param overAllHeight the height of the table with all rows
@@ -429,19 +444,32 @@ namespace svt { namespace table
@param actWidth the given width of the table
*/
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0;
-
- /** fills cells with content
- */
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)=0;
- /** gets the content of the cells
- */
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent() = 0;
- /**sets title of header rows
- */
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)=0;
- /** gets title of header rows
- */
- virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
+ virtual bool hasVerticalScrollbar() =0;
+ virtual bool hasHorizontalScrollbar() = 0;
+ /** fills cells with content
+ */
+ virtual void setCellContent(const std::vector< std::vector< ::com::sun::star::uno::Any > >& cellContent)=0;
+ /** gets the content of the cells
+ */
+ virtual std::vector< std::vector< ::com::sun::star::uno::Any > >& getCellContent() = 0;
+ /**sets title of header rows
+ */
+ SVT_DLLPRIVATE virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)=0;
+ /** gets title of header rows
+ */
+ virtual std::vector<rtl::OUString>& getRowHeaderName() = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getLineColor() = 0;
+ SVT_DLLPRIVATE virtual void setLineColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getTextColor() = 0;
+ SVT_DLLPRIVATE virtual void setTextColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0;
+ SVT_DLLPRIVATE virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor) = 0;
+ SVT_DLLPRIVATE virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0;
+ SVT_DLLPRIVATE virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _xAlign) = 0;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/inc/svtools/table/tablerenderer.hxx b/svtools/inc/svtools/table/tablerenderer.hxx
index cf8cd20680c2..f81771dd22e6 100644
--- a/svtools/inc/svtools/table/tablerenderer.hxx
+++ b/svtools/inc/svtools/table/tablerenderer.hxx
@@ -45,7 +45,7 @@ namespace svt { namespace table
*/
class SAL_NO_VTABLE ITableRenderer
{
- public:
+ public:
/** paints a (part of) header area
There are two header areas in a table control:
@@ -178,10 +178,9 @@ namespace svt { namespace table
@param _rText
the title of the header row
*/
- virtual void PaintRowHeader(
- bool _bActive, bool _bSelected,
+ virtual void PaintRowHeader( bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** paints a certain cell
@@ -208,13 +207,46 @@ namespace svt { namespace table
the are into which the cell should be painted
@param _rStyle
the style to be used for drawing
+ @param _pCellData
+ the content of the cell
+ */
+ virtual void PaintCellImage( ColPos _nColumn,
+ bool _bActive, bool _bSelected,
+ OutputDevice& _rDevice, const Rectangle& _rArea,
+ const StyleSettings& _rStyle, Image* _pCellData ) = 0;
+
+ /** paints a certain cell
+
+ The row to be painted is denoted by the most recent call to
+ ->PrepareRow.
+
+ @param _bSelected
+ <TRUE/> if and only if the cell to be painted is
+ selected currently. This is the case if either
+ the row or the column of the cell is currently selected.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _bActive
+ <TRUE/> if the cell is currently active.
+ <br/>
+ Note that this flag is equal to the respective flag in the
+ previous ->PrepareRow call, it's passed here for convinience
+ only.
+ @param _rDevice
+ denotes the device to paint onto
+ @param _rArea
+ the are into which the cell should be painted
+ @param _rStyle
+ the style to be used for drawing
@param _rText
the content of the cell
*/
- virtual void PaintCell( ColPos _nColumn,
+ virtual void PaintCellString( ColPos _nColumn,
bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea,
- const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
+ const StyleSettings& _rStyle, rtl::OUString& _rText ) = 0;
/** draws a cell cursor in the given rectangle
diff --git a/svtools/inc/svtools/table/tabletypes.hxx b/svtools/inc/svtools/table/tabletypes.hxx
index f423b64c2faa..645120e30d4b 100644
--- a/svtools/inc/svtools/table/tabletypes.hxx
+++ b/svtools/inc/svtools/table/tabletypes.hxx
@@ -56,17 +56,17 @@ namespace svt { namespace table
/** special column width value which indicates that the column should be
automatically resized to fit the view
*/
-#define COLWIDTH_FIT_TO_VIEW ((TableMetrics)-1)
+#define COLWIDTH_FIT_TO_VIEW ((::svt::table::TableMetrics)-1)
/// denotes the column containing the row headers
-#define COL_ROW_HEADERS ((ColPos)-1)
+#define COL_ROW_HEADERS ((::svt::table::ColPos)-1)
/// denotes the row containing the column headers
-#define ROW_COL_HEADERS ((RowPos)-1)
+#define ROW_COL_HEADERS ((::svt::table::RowPos)-1)
/// denotes an invalid column index
-#define COL_INVALID ((ColPos)-2)
+#define COL_INVALID ((::svt::table::ColPos)-2)
/// denotes an invalid row index
-#define ROW_INVALID ((RowPos)-2)
+#define ROW_INVALID ((::svt::table::RowPos)-2)
//........................................................................
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index 0a3ccd8a9819..4a9e8314e0d8 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -1,6 +1,7 @@
mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %COMMON_DEST%\res%_EXT%
mkdir: %_DEST%\inc%_EXT%\svtools
+mkdir: %_DEST%\inc%_EXT%\svtools\table
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs
@@ -25,6 +26,7 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\table\*.hxx %_DEST%\inc%_EXT%\svtools\table\*.hxx
..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx
..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
diff --git a/svtools/qa/unoapi/svtools.sce b/svtools/qa/unoapi/svtools.sce
index 53d53e0e6824..90fb50358f99 100644
--- a/svtools/qa/unoapi/svtools.sce
+++ b/svtools/qa/unoapi/svtools.sce
@@ -1,12 +1,12 @@
#i88276 -o svtools.AccessibleIconChoiceCtrlEntry
#i88647 -o svtools.AccessibleTabBarPage
--o svtools.AccessibleBrowseBox
--o svtools.AccessibleBrowseBoxHeaderBar
--o svtools.AccessibleBrowseBoxHeaderCell
--o svtools.AccessibleBrowseBoxTable
+#i110988 -o svtools.AccessibleBrowseBox
+#i110988 -o svtools.AccessibleBrowseBoxHeaderBar
+#i110988 -o svtools.AccessibleBrowseBoxHeaderCell
+#i110988 -o svtools.AccessibleBrowseBoxTable
#i85245 -o svtools.AccessibleBrowseBoxTableCell
#i88276 -o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
#i85246 -o svtools.AccessibleTabBarPageList
--o svtools.AccessibleTreeListBox
--o svtools.AccessibleTreeListBoxEntry \ No newline at end of file
+#i110988 -o svtools.AccessibleTreeListBox
+#i110988 -o svtools.AccessibleTreeListBoxEntry
diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx
index 21f6e69c8d9e..bf176015fd77 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.cxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.cxx
@@ -36,7 +36,7 @@
// ------------------------------------------------------------------------
-#define WIN_MTF_MAX_POLYPOLYCOUNT 16
+#define WIN_MTF_MAX_CLIP_DEPTH 16
void WinMtfClipPath::ImpUpdateType()
{
@@ -54,26 +54,28 @@ void WinMtfClipPath::IntersectClipRect( const Rectangle& rRect )
{
if ( !aPolyPoly.Count() )
aPolyPoly = Polygon( rRect );
- else if ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
+ else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH )
{
Polygon aPolygon( rRect );
PolyPolygon aIntersection;
PolyPolygon aPolyPolyRect( aPolygon );
aPolyPoly.GetIntersection( aPolyPolyRect, aIntersection );
aPolyPoly = aIntersection;
+ nDepth++;
}
ImpUpdateType();
}
void WinMtfClipPath::ExcludeClipRect( const Rectangle& rRect )
{
- if ( aPolyPoly.Count() && ( aPolyPoly.Count() < WIN_MTF_MAX_POLYPOLYCOUNT ) )
+ if ( aPolyPoly.Count() && ( nDepth < WIN_MTF_MAX_CLIP_DEPTH ) )
{
Polygon aPolygon( rRect );
PolyPolygon aPolyPolyRect( aPolygon );
PolyPolygon aDifference;
aPolyPoly.GetDifference( aPolyPolyRect, aDifference );
aPolyPoly = aDifference;
+ nDepth++;
}
ImpUpdateType();
}
@@ -82,8 +84,10 @@ void WinMtfClipPath::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nCl
{
if ( !rPolyPolygon.Count() )
aPolyPoly = rPolyPolygon;
- else if ( rPolyPolygon.Count() < WIN_MTF_MAX_POLYPOLYCOUNT )
+ else if ( nDepth < WIN_MTF_MAX_CLIP_DEPTH )
{
+ nDepth++;
+
PolyPolygon aNewClipPath;
// #115345# Watch out for empty aPolyPoly here - conceptually,
diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx
index beb1f62e22d6..fb4fd2fe0c57 100644
--- a/svtools/source/filter.vcl/wmf/winmtf.hxx
+++ b/svtools/source/filter.vcl/wmf/winmtf.hxx
@@ -314,6 +314,7 @@ class WinMtfClipPath
{
PolyPolygon aPolyPoly;
WinMtfClipPathType eType;
+ sal_Int32 nDepth;
void ImpUpdateType();
@@ -321,7 +322,7 @@ class WinMtfClipPath
sal_Bool bNeedsUpdate;
- WinMtfClipPath(): eType(EMPTY), bNeedsUpdate( sal_False ){};
+ WinMtfClipPath(): eType(EMPTY), nDepth( 0 ), bNeedsUpdate( sal_False ){};
void SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode );
void IntersectClipRect( const Rectangle& rRect );
diff --git a/svtools/source/inc/accessibletableimp.hxx b/svtools/source/inc/accessibletableimp.hxx
new file mode 100644
index 000000000000..3a01c01567d3
--- /dev/null
+++ b/svtools/source/inc/accessibletableimp.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#ifndef SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+#define SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
+
+#include "svtaccessiblefactory.hxx"
+
+namespace svt { namespace table
+{
+//........................................................................
+
+
+ class AccessibleTableControl_Impl
+ {
+ public:
+ AccessibleFactoryAccess m_aFactoryAccess;
+ IAccessibleTableControl* m_pAccessible;
+
+ public:
+ AccessibleTableControl_Impl() : m_pAccessible(NULL)
+ {
+ }
+
+
+ /// @see AccessibleTableControl::getTableRowHeader
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTableHeader( AccessibleTableControlObjType _eObjType );
+ /// @see AccessibleTableControl::getTable
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleTable( );
+
+ };
+
+//........................................................................
+} } // namespace svt::table
+//........................................................................
+
+#endif // SVTOOLS_SOURCE_INC_ACCESSIBLETABLEIMP_HXX
diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx
index b11357db95d1..ad8f7a7562d3 100644
--- a/svtools/source/table/defaultinputhandler.cxx
+++ b/svtools/source/table/defaultinputhandler.cxx
@@ -50,6 +50,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
DefaultInputHandler::DefaultInputHandler()
:m_pImpl( new DefaultInputHandler_Impl )
+ ,m_bResize(false)
{
}
@@ -62,8 +63,12 @@ namespace svt { namespace table
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseMove( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
- (void)_rControl;
- (void)_rMEvt;
+ Point aPoint = _rMEvt.GetPosPixel();
+ if(m_bResize)
+ {
+ _rControl.resizeColumn(aPoint);
+ return true;
+ }
return false;
}
@@ -72,41 +77,60 @@ namespace svt { namespace table
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ RowPos nRow = _rControl.getCurrentRow(aPoint);
+ if(nRow == -1)
+ {
+ m_bResize = _rControl.startResizeColumn(aPoint);
+ bHandled = true;
+ }
+ else if(nRow >= 0)
{
if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- LoseFocus(_rControl);
_rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
{
- bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ if(!_rControl.isRowSelected(nRow))
+ bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ else
+ bHandled = true;
}
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::MouseButtonUp( IAbstractTableControl& _rControl, const MouseEvent& _rMEvt )
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.isClickInVisibleArea(aPoint))
+ if(_rControl.getCurrentRow(aPoint) >= 0)
{
- if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
+ else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- GetFocus(_rControl);
- _rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
+ {
bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt);
+ }
+ }
+ else
+ {
+ if(m_bResize)
+ {
+ m_bResize = _rControl.endResizeColumn(aPoint);
+ bHandled = true;
+ }
}
return bHandled;
}
-
//--------------------------------------------------------------------
bool DefaultInputHandler::KeyInput( IAbstractTableControl& _rControl, const KeyEvent& rKEvt )
{
@@ -134,11 +158,11 @@ namespace svt { namespace table
{ KEY_PAGEDOWN, KEY_MOD1, cursorToLastLine },
{ KEY_HOME, KEY_MOD1, cursorTopLeft },
{ KEY_END, KEY_MOD1, cursorBottomRight },
- { KEY_SPACE, KEY_MOD1, cursorSelectRow },
- { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
- { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
- { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
- { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
+ { KEY_SPACE, KEY_MOD1, cursorSelectRow },
+ { KEY_UP, KEY_SHIFT, cursorSelectRowUp },
+ { KEY_DOWN, KEY_SHIFT, cursorSelectRowDown },
+ { KEY_END, KEY_SHIFT, cursorSelectRowAreaBottom },
+ { KEY_HOME, KEY_SHIFT, cursorSelectRowAreaTop },
{ 0, 0, invalidTableControlAction }
};
@@ -205,7 +229,6 @@ namespace svt { namespace table
// TODO
return false;
}
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index ada2e463c8af..a3f954e0bef5 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -31,6 +31,7 @@
#include <tools/debug.hxx>
#include <vcl/window.hxx>
+#include <vcl/image.hxx>
//........................................................................
namespace svt { namespace table
@@ -78,15 +79,15 @@ namespace svt { namespace table
OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
- _rDevice.SetFillColor( _rStyle.GetDialogColor() );
+ _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ Color background = m_pImpl->rModel.getHeaderBackgroundColor();
+ if( background != 0xFFFFFF)
+ _rDevice.SetFillColor(background);
+ else
+ _rDevice.SetFillColor(_rStyle.GetDialogColor());
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawRect( _rArea );
-
// delimiter lines at bottom/right
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
@@ -99,31 +100,38 @@ namespace svt { namespace table
void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
String sHeaderText;
-
PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol );
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- Color aRowBackground = _rStyle.GetFieldColor();
- if ( _bSelected )
- {
- aRowBackground = COL_BLUE;
- }
- _rDevice.DrawText( _rArea, sHeaderText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP );
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Bottom()-=2;
+ _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.Pop();
(void)_bActive;
// no special painting for the active column at the moment
- //(void)_bSelected;
- // TODO: selection not yet implemented
+ (void)_bSelected;
+ //selection for column header not yet implemented
}
//--------------------------------------------------------------------
@@ -133,86 +141,218 @@ namespace svt { namespace table
// remember the row for subsequent calls to the other ->ITableRenderer methods
m_pImpl->nCurrentRow = _nRow;
- // fill the rows with alternating background colors
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor();
-
- Color aRowBackground = _rStyle.GetFieldColor();
+ _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
+ Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ //if row is selected background color becomes blue, and lines should be also blue
+ //if they aren't user defined
+ if(_bSelected)
+ {
+ Color aSelected(_rStyle.GetHighlightColor());
+ aRowBackground = aSelected;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //if row not selected, check the cases whether user defined backgrounds are set
+ //and set line color to be the same
+ else
+ {
+ if(aRowBackground2 != 0xFFFFFF && _nRow%2)
+ {
+ aRowBackground = aRowBackground2;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //fill the rows with alternating background colors if second background color is specified
+ else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ {
+ //if Line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
+ }
_rDevice.SetFillColor( aRowBackground );
-
_rDevice.DrawRect( _rRowArea );
- // TODO: active? selected?
+ // TODO: active?
_rDevice.Pop();
- (void) _bSelected;
(void)_bActive;
-
- // no special painting for the active row at the moment
-
- //(void)_bSelected;
- // TODO: selection not yet implemented
}
//--------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText )
{
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
-
- _rDevice.SetLineColor( _rStyle.GetDialogTextColor() );
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- _rDevice.DrawText( _rArea, _rText, TEXT_DRAW_LEFT);
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Bottom()-=2;
+ _rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
// TODO: active? selected?
(void)_bActive;
(void)_bSelected;
-
+ //at the moment no special paint for selected row header
_rDevice.Pop();
}
//--------------------------------------------------------------------
- void GridTableRenderer::PaintCell( ColPos _nColumn, bool _bSelected, bool _bActive,
- OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
+ void GridTableRenderer::PaintCellImage( ColPos _nColumn, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, Image* _pCellData )
{
- _rDevice.Push( PUSH_LINECOLOR );
-
- // draw the grid
- _rDevice.SetLineColor( COL_LIGHTGRAY );
- // TODO: the LIGHTGRAY should probably be a property/setting
- _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
- _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
-
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION);
+ _rDevice.IntersectClipRegion( _rArea );
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
{
+ //if line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
+ }
+ }
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ {
// TODO: remove those temporary place holders
Rectangle aRect( _rArea );
++aRect.Left(); --aRect.Right();
- ++aRect.Top(); --aRect.Bottom();
+ aRect.Top(); aRect.Bottom();
+ Point imagePos(Point(aRect.Left(), aRect.Top()));
+ Size imageSize = _pCellData->GetSizePixel();
+ if(aRect.GetWidth() > imageSize.Width())
+ {
+ if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
+ imagePos.X() = aRect.Left()+((double)(aRect.GetWidth() - imageSize.Width()))/2;
+ else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
+ imagePos.X() = aRect.Right() - imageSize.Width();
+ }
+ else
+ imageSize.Width() = aRect.GetWidth();
+ if(aRect.GetHeight() > imageSize.Height())
+ {
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ imagePos.Y() = aRect.Top()+((double)(aRect.GetHeight() - imageSize.Height()))/2;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ imagePos.Y() = aRect.Bottom() - imageSize.Height();
+ }
+ else
+ imageSize.Height() = aRect.GetHeight()-1;
+ Image& image (*_pCellData);
+ _rDevice.DrawImage(imagePos, imageSize, image, 0);
+ }
+ _rDevice.Pop();
- String sText;
- if(_bSelected)
- {
- Color aRed(COL_BLUE);
- _rDevice.SetFillColor( aRed );
- _rDevice.SetTextColor(COL_WHITE);
- }
- _rDevice.DrawRect( _rArea );
- (void)_nColumn;
- _rDevice.DrawText( aRect, _rText, TEXT_DRAW_LEFT | TEXT_DRAW_TOP);
+ (void)_bActive;
+ // no special painting for the active cell at the moment
+ }
+
+ //--------------------------------------------------------------------
+ void GridTableRenderer::PaintCellString( ColPos _nColumn, bool _bSelected, bool _bActive,
+ OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle, rtl::OUString& _rText )
+ {
+ _rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
+ Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ Color line = m_pImpl->rModel.getLineColor();
+ //if row is selected and line color isn't user specified, set it blue
+ if(_bSelected)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(_rStyle.GetHighlightColor());
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //else set line color to the color of row background
+ else
+ {
+ if(background2 != 0xFFFFFF && m_pImpl->nCurrentRow%2)
+ {
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(background2);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ else if(background1 != 0xFFFFFF && line == 0xFFFFFF)
+ _rDevice.SetLineColor(background1);
+ else
+ {
+ //if Line color is set, then it was user defined and should be visible
+ //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
+ _rDevice.SetLineColor(line);
}
+ }
+ _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+ {
+ // TODO: remove those temporary place holders
+ Rectangle aRect( _rArea );
+ ++aRect.Left(); --aRect.Right();
+ aRect.Top(); aRect.Bottom();
if(_bSelected)
{
- _rDevice.SetFillColor( _rStyle.GetFieldColor() );
- _rDevice.SetTextColor(COL_BLACK);
+ _rDevice.SetTextColor(_rStyle.GetHighlightTextColor());
+ }
+ else
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(_nColumn)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle textRect(_rArea);
+ textRect.Left()+=4; textRect.Right()-=4;
+ textRect.Bottom()-=2;
+ _rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
}
-
_rDevice.Pop();
-
(void)_bActive;
-// // no special painting for the active cell at the moment
- (void)_rStyle;
-// // TODO: do we need this?
+ // no special painting for the active cell at the moment
}
//--------------------------------------------------------------------
@@ -224,7 +364,7 @@ namespace svt { namespace table
//--------------------------------------------------------------------
void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
- (void)_rCursorRect;
+ (void)_rCursorRect;
_rView.HideFocus();
}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 71c753d3ea86..418348c81b7d 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
+#include "accessibletableimp.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -68,15 +69,19 @@ namespace svt { namespace table
TableControl::TableControl( Window* _pParent, WinBits _nStyle )
:Control( _pParent, _nStyle )
,m_pImpl( new TableControl_Impl( *this ) )
+ ,m_bSelectionChanged(false)
{
- m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
- m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ TableDataWindow* aTableData = m_pImpl->getDataWindow();
+ aTableData->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
+ aTableData->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ aTableData->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
}
//--------------------------------------------------------------------
TableControl::~TableControl()
{
+ ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
DELETEZ( m_pImpl );
if ( m_pAccessTable->m_pAccessible )
{
@@ -106,6 +111,14 @@ namespace svt { namespace table
{
if ( !m_pImpl->getInputHandler()->KeyInput( *m_pImpl, rKEvt ) )
Control::KeyInput( rKEvt );
+ else
+ {
+ if(m_bSelectionChanged)
+ {
+ Select();
+ m_bSelectionChanged = false;
+ }
+ }
}
//--------------------------------------------------------------------
void TableControl::Resize()
@@ -162,13 +175,21 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColPos, _nRowPos );
}
//--------------------------------------------------------------------
- void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved)
+ void TableControl::InvalidateDataWindow(RowPos _nRowStart, RowPos _nRowEnd, bool _bRemoved)
{
Rectangle _rRect;
if(_bRemoved)
- return m_pImpl->invalidateRows(_nRowStart, _rRect);
+ m_pImpl->invalidateRows();
else
- return m_pImpl->invalidateRow(_nRowStart, _rRect);
+ {
+ if(m_bSelectionChanged)
+ {
+ m_pImpl->invalidateSelectedRegion(_nRowStart, _nRowEnd, _rRect);
+ m_bSelectionChanged = false;
+ }
+ else
+ m_pImpl->invalidateRow(_nRowStart, _rRect);
+ }
}
//--------------------------------------------------------------------
std::vector<sal_Int32>& TableControl::GetSelectedRows()
@@ -176,7 +197,7 @@ namespace svt { namespace table
return m_pImpl->getSelectedRows();
}
//--------------------------------------------------------------------
- void TableControl::removeSelectedRow(RowPos _nRowPos)
+ void TableControl::RemoveSelectedRow(RowPos _nRowPos)
{
m_pImpl->removeSelectedRow(_nRowPos);
}
@@ -187,20 +208,6 @@ namespace svt { namespace table
return m_pImpl->getCurrentRow( rPoint );
}
- //--------------------------------------------------------------------
-
- IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
- {
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
- return 1;
- }
-
- IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
- {
- CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
- return 1;
- }
-
SelectionEngine* TableControl::getSelEngine()
{
return m_pImpl->getSelEngine();
@@ -240,6 +247,7 @@ namespace svt { namespace table
::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
{
::rtl::OUString aRetText;
+ //Window* pWin;
switch( eObjType )
{
case TCTYPE_GRIDCONTROL:
@@ -255,7 +263,7 @@ namespace svt { namespace table
aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
break;
case TCTYPE_TABLECELL:
- aRetText = GetCellContent(_nRow, _nCol);
+ aRetText = GetRowName(_nRow);
break;
case TCTYPE_ROWHEADERCELL:
aRetText = GetRowName(_nRow);
@@ -328,20 +336,23 @@ namespace svt { namespace table
// -----------------------------------------------------------------------------
-::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
{
- ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii("");
- std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent();
+ ::com::sun::star::uno::Any cellContent(::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")));
+ std::vector<std::vector< ::com::sun::star::uno::Any > >& aTableContent = GetModel()->getCellContent();
if(&aTableContent)
- {
- std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos];
- if(&aRowContent)
- cellContent = aRowContent[_nColPos];
- }
+ cellContent = aTableContent[_nRowPos][_nColPos];
return cellContent;
}
// -----------------------------------------------------------------------------
+::rtl::OUString TableControl::GetAccessibleCellText( sal_Int32 _nRowPos, sal_Int32 _nColPos)
+{
+ ::com::sun::star::uno::Any cellContent = GetCellContent(_nRowPos, _nColPos);
+ return m_pImpl->convertToString(cellContent);
+}
+// -----------------------------------------------------------------------------
+
void TableControl::FillAccessibleStateSet(
::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const
@@ -374,10 +385,6 @@ void TableControl::FillAccessibleStateSet(
break;
case TCTYPE_TABLECELL:
{
- //sal_Int32 nRow = GetCurRow();
- //sal_uInt16 nColumn = GetCurColumnId();
- //if ( IsFieldVisible(nRow,nColumn) )
- // rStateSet.AddState( AccessibleStateType::VISIBLE );
rStateSet.AddState( AccessibleStateType::TRANSIENT );
rStateSet.AddState( AccessibleStateType::SELECTABLE);
if( GetSelectedRowCount()>0)
@@ -516,25 +523,56 @@ void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNew
Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRectTable, aRectTableWithHeaders;
- m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
- m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
- Size aSizeTable(aRectTable.GetSize());
- Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
- if(_bIsColumnBar)
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
- else
- return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ return m_pImpl->calcHeaderRect(_bIsColumnBar);
}
// -----------------------------------------------------------------------------
Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
{
(void)_bOnScreen;
- Rectangle aRect;
- m_pImpl->impl_getAllVisibleDataCellArea(aRect);
- return aRect;
+ return m_pImpl->calcTableRect();
+}
+//--------------------------------------------------------------------
+::com::sun::star::uno::Sequence< sal_Int32 >& TableControl::getColumnsForTooltip()
+{
+ return m_nCols;
+}
+//--------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::rtl::OUString >& TableControl::getTextForTooltip()
+{
+ return m_aText;
+}
+//--------------------------------------------------------------------
+void TableControl::setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols )
+{
+ m_aText = aText;
+ m_nCols = nCols;
+}
+// -----------------------------------------------------------------------
+void TableControl::selectionChanged(bool _bChanged)
+{
+ m_bSelectionChanged = _bChanged;
+}
+// -----------------------------------------------------------------------
+IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
+{
+ Select();
+ return 1;
+}
+IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
+ return 1;
+}
+IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
+ return 1;
+}
+// -----------------------------------------------------------------------
+void TableControl::Select()
+{
+ ImplCallEventListenersAndHandler( VCLEVENT_TABLEROW_SELECT, m_aSelectHdl, this );
}
-
//........................................................................
}} // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index aacfc28d05be..1526dbdb778d 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -33,9 +33,13 @@
#include "tablecontrol_impl.hxx"
#include "tablegeometry.hxx"
#include "svtools/table/tabledatawindow.hxx"
-
+#include <com/sun/star/awt/XControl.hpp>
#include <vcl/scrbar.hxx>
#include <vcl/seleng.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/image.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <functional>
#include <stdlib.h>
@@ -98,22 +102,22 @@ namespace svt { namespace table
{
return false;
}
- virtual void setRowHeaders(bool _bRowHeaders)
+ virtual void setRowHeaders(bool _bRowHeaders)
{
(void)_bRowHeaders;
}
- virtual void setColumnHeaders(bool _bColumnHeaders)
- {
- (void)_bColumnHeaders;
- }
- void setColumnCount(TableSize _nColCount)
- {
- (void) _nColCount;
- }
- void setRowCount(TableSize _nRowCount)
+ virtual void setColumnHeaders(bool _bColumnHeaders)
{
- (void)_nRowCount;
+ (void)_bColumnHeaders;
}
+ void setColumnCount(TableSize _nColCount)
+ {
+ (void) _nColCount;
+ }
+ void setRowCount(TableSize _nRowCount)
+ {
+ (void)_nRowCount;
+ }
virtual bool isCellEditable( ColPos col, RowPos row ) const
{
(void)col;
@@ -166,39 +170,83 @@ namespace svt { namespace table
{
return 0;
}
- virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
- {
- (void)overAllHeight;
- (void)actHeight;
- return ScrollbarShowNever;
- }
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
- {
- (void)overAllWidth;
- (void)actWidth;
- return ScrollbarShowNever;
- }
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > pCellEntryType)
- {
- (void)pCellEntryType;
- }
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent()
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility(int , int ) const
{
- return *( new std::vector<std::vector<rtl::OUString> >);
+ return ScrollbarShowNever;
}
- virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType)
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int , int ) const
{
- (void)pCellEntryType;
+ return ScrollbarShowNever;
}
- virtual std::vector<rtl::OUString>& getRowHeaderName()
- {
- aRowHeaderNames.clear();
- aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
- return aRowHeaderNames;
- }
-
- private:
- std::vector<rtl::OUString> aRowHeaderNames;
+ virtual bool hasVerticalScrollbar()
+ {
+ return false;
+ }
+ virtual bool hasHorizontalScrollbar()
+ {
+ return false;
+ }
+ virtual void setCellContent(const std::vector<std::vector< ::com::sun::star::uno::Any > >& )
+ {
+ }
+ virtual ::com::sun::star::util::Color getLineColor()
+ {
+ return 0;
+ }
+ virtual void setLineColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getHeaderBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setHeaderBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getTextColor()
+ {
+ return 0;
+ }
+ virtual void setTextColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::util::Color getOddRowBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setOddRowBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign()
+ {
+ return com::sun::star::style::VerticalAlignment(0);
+ }
+ virtual void setVerticalAlign(com::sun::star::style::VerticalAlignment )
+ {
+ }
+ virtual ::com::sun::star::util::Color getEvenRowBackgroundColor()
+ {
+ return -1;
+ }
+ virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color )
+ {
+ }
+ virtual std::vector<std::vector< ::com::sun::star::uno::Any > >& getCellContent()
+ {
+ return m_aCellContent;
+ }
+ virtual void setRowHeaderName(const std::vector<rtl::OUString>& )
+ {
+ }
+ virtual std::vector<rtl::OUString>& getRowHeaderName()
+ {
+ aRowHeaderNames.clear();
+ aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
+ return aRowHeaderNames;
+ }
+ private:
+ std::vector<rtl::OUString> aRowHeaderNames;
+ std::vector<std::vector< ::com::sun::star::uno::Any > > m_aCellContent;
};
@@ -222,8 +270,8 @@ namespace svt { namespace table
:m_rTable( _rTable )
,m_nSuspendFlags( _nSuspendFlags )
{
- DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
- "SuspendInvariants: cannot suspend what is already suspended!" );
+ //DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
+ // "SuspendInvariants: cannot suspend what is already suspended!" );
const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants &= ~m_nSuspendFlags;
}
~SuspendInvariants()
@@ -303,7 +351,7 @@ namespace svt { namespace table
// m_nColHeaderHeightPixel consistent with the model's value?
{
TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0;
- nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_100TH_MM ).Height();
+ nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height();
if ( nHeaderHeight != m_nColHeaderHeightPixel )
return "column header heights are inconsistent!";
}
@@ -312,7 +360,7 @@ namespace svt { namespace table
if ( !isDummyModel )
{
TableMetrics nRowHeight = m_pModel->getRowHeight();
- nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_100TH_MM ).Height();
+ nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height();
if ( nRowHeight != m_nRowHeightPixel )
return "row heights are inconsistent!";
}
@@ -320,13 +368,12 @@ namespace svt { namespace table
// m_nRowHeaderWidthPixel consistent with the model's value?
{
TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0;
- nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_100TH_MM ).Width();
+ nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width();
if ( nHeaderWidth != m_nRowHeaderWidthPixel )
return "row header widths are inconsistent!";
}
// TODO: check m_aColumnWidthsPixel and m_aAccColumnWidthsPixel
-
if ( m_nCursorHidden < 0 )
return "invalid hidden count for the cursor!";
@@ -369,30 +416,33 @@ namespace svt { namespace table
,m_pModel ( new EmptyTableModel )
,m_pInputHandler ( )
,m_nRowHeightPixel ( 15 )
- ,m_nColHeaderHeightPixel( 0 )
+ ,m_nColHeaderHeightPixel( 0 )
,m_nRowHeaderWidthPixel ( 0 )
,m_nColumnCount ( 0 )
,m_nRowCount ( 0 )
,m_nCurColumn ( COL_INVALID )
,m_nCurRow ( ROW_INVALID )
,m_nLeftColumn ( 0 )
- ,m_nTopRow ( 0 )
+ ,m_nTopRow ( 0 )
,m_nCursorHidden ( 1 )
,m_pDataWindow ( new TableDataWindow( *this ) )
- ,m_pVScroll ( NULL )
+ ,m_pVScroll ( NULL )
,m_pHScroll ( NULL )
,m_pScrollCorner ( NULL )
- ,m_pSelEngine ( )
- ,m_nRowSelected ( )
- ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
- ,m_nAnchor (-1 )
+ ,m_pSelEngine ( )
+ ,m_nRowSelected ( )
+ ,m_pTableFunctionSet ( new TableFunctionSet(this ) )
+ ,m_nAnchor (-1 )
+ ,m_bResizing ( false )
+ ,m_nResizingColumn ( 0 )
+ ,m_bResizingGrid ( false )
#if DBG_UTIL
,m_nRequiredInvariants ( INV_SCROLL_POSITION )
#endif
{
DBG_CTOR( TableControl_Impl, TableControl_Impl_checkInvariants );
- m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet);
- m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
+ m_pSelEngine = new SelectionEngine(m_pDataWindow, m_pTableFunctionSet);
+ m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
m_pDataWindow->SetPosPixel( Point( 0, 0 ) );
m_pDataWindow->Show();
}
@@ -427,14 +477,10 @@ namespace svt { namespace table
TempHideCursor aHideCursor( *this );
- // TODO: revoke as table listener from the model
-
m_pModel = _pModel;
- if ( !m_pModel )
+ if ( !m_pModel)
m_pModel.reset( new EmptyTableModel );
- // TODO: register as table listener
- //m_pModel->addTableModelListener(PTableModelListener(m_pTableModelListener));
m_nCurRow = ROW_INVALID;
m_nCurColumn = COL_INVALID;
@@ -504,11 +550,11 @@ namespace svt { namespace table
m_pInputHandler.reset();
m_nColumnCount = m_nRowCount = 0;
- m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_100TH_MM ).Height();
- if ( m_pModel->hasColumnHeaders() )
- m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_100TH_MM ).Height();
+ m_nRowHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getRowHeight() ), MAP_APPFONT ).Height();
+ if ( m_pModel->hasColumnHeaders() )
+ m_nColHeaderHeightPixel = m_rAntiImpl.LogicToPixel( Size( 0, m_pModel->getColumnHeaderHeight() ), MAP_APPFONT ).Height();
if ( m_pModel->hasRowHeaders() )
- m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_100TH_MM ).Width();
+ m_nRowHeaderWidthPixel = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT).Width();
impl_ni_updateColumnWidths();
@@ -529,34 +575,116 @@ namespace svt { namespace table
return;
TableSize colCount = m_pModel->getColumnCount();
+
m_aColumnWidthsPixel.reserve( colCount );
m_aAccColumnWidthsPixel.reserve( colCount );
- long accumulatedPixelWidth = 0;
- for ( ColPos col = 0; col < colCount; ++col )
+ if(colCount>0)
{
- PColumnModel pColumn = m_pModel->getColumnModel( col );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
-
- TableMetrics colWidth = pColumn->getWidth();
- DBG_ASSERT( ( colWidth == COLWIDTH_FIT_TO_VIEW ) || ( colWidth > 0 ),
- "TableControl_Impl::impl_ni_updateColumnWidths: invalid column width!" );
-
- long pixelWidth = 0;
- if ( colWidth == COLWIDTH_FIT_TO_VIEW )
+ std::vector<sal_Int32> aPrePixelWidths(0);
+ long accumulatedPixelWidth = 0;
+ int lastResizableCol = -1;
+ double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width();
+ if(m_pModel->hasRowHeaders())
+ {
+ TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth();
+ gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width();
+ }
+ if(m_pModel->hasVerticalScrollbar())
{
- // TODO
- DBG_ERROR( "TableControl_Impl::impl_ni_updateColumnWidths: COLWIDTH_FIT_TO_VIEW not implemented, yet!" );
+ sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
+ gridWidth-=scrollbarWidth;
+ }
+ double colWidthsSum = 0.0;
+ double colWithoutFixedWidthsSum = 0.0;
+ double minColWithoutFixedSum = 0.0;
+ for ( ColPos col = 0; col < colCount; ++col )
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel( col );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ TableMetrics colWidth = 0;
+ TableMetrics colPrefWidth = pColumn->getPreferredWidth();
+ bool bResizable = pColumn->isResizable();
+ if(pColumn->getMinWidth() == 0 && bResizable)
+ {
+ pColumn->setMinWidth(1);
+ minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width();
+ }
+ if(pColumn->getMaxWidth() == 0 && bResizable)
+ pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
+ if( colPrefWidth != 0)
+ {
+ if(m_bResizingGrid)
+ {
+ colWidth = pColumn->getWidth();
+ pColumn->setPreferredWidth(0);
+ }
+ else
+ {
+ colWidth = colPrefWidth;
+ pColumn->setWidth(colPrefWidth);
+ }
+ }
+ else
+ colWidth = pColumn->getWidth();
+ long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ if(bResizable && colPrefWidth == 0)
+ {
+ colWithoutFixedWidthsSum+=pixelWidth;
+ lastResizableCol = col;
+ }
+ colWidthsSum+=pixelWidth;
+ aPrePixelWidths.push_back(pixelWidth);
+ }
+ double gridWidthWithoutFixed = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
+ double scalingFactor = 1.0;
+ if(m_bResizingGrid)
+ {
+ if(gridWidthWithoutFixed > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
}
else
{
- pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_100TH_MM ).Width();
+ if(colWidthsSum < gridWidthWithoutFixed)
+ {
+ if(colWithoutFixedWidthsSum>0)
+ scalingFactor = gridWidthWithoutFixed/colWithoutFixedWidthsSum;
+ }
+ }
+ for ( ColPos i = 0; i < colCount; ++i )
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel( i );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0)
+ {
+ aPrePixelWidths[i]*=scalingFactor;
+ TableMetrics logicColWidth = m_rAntiImpl.PixelToLogic( Size( aPrePixelWidths[i], 0 ), MAP_APPFONT ).Width();
+ pColumn->setWidth(logicColWidth);
+ }
+ m_aColumnWidthsPixel.push_back( aPrePixelWidths[i] );
+ m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += aPrePixelWidths[i] );
+ }
+ if(gridWidth > m_aAccColumnWidthsPixel[colCount-1])
+ {
+ if(lastResizableCol >= 0)
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel(lastResizableCol);
+ m_aColumnWidthsPixel[lastResizableCol]+=gridWidth-m_aAccColumnWidthsPixel[colCount-1];
+ TableMetrics logicColWidth1 = m_rAntiImpl.PixelToLogic( Size( m_aColumnWidthsPixel[lastResizableCol], 0 ), MAP_APPFONT ).Width();
+ pColumn->setWidth(logicColWidth1);
+ while(lastResizableCol < colCount)
+ {
+ if(lastResizableCol == 0)
+ m_aAccColumnWidthsPixel[0] = m_aColumnWidthsPixel[lastResizableCol];
+ else
+ m_aAccColumnWidthsPixel[lastResizableCol]=m_aAccColumnWidthsPixel[lastResizableCol-1]+m_aColumnWidthsPixel[lastResizableCol];
+ ++lastResizableCol;
+ }
+ }
}
-
- m_aColumnWidthsPixel.push_back( pixelWidth );
-
- m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth );
}
}
@@ -678,6 +806,13 @@ namespace svt { namespace table
Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
aDataCellPlayground.Left() = m_nRowHeaderWidthPixel;
aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
+ m_nRowCount = m_pModel->getRowCount();
+ m_nColumnCount = m_pModel->getColumnCount();
+
+ if(m_aAccColumnWidthsPixel.empty())
+ {
+ impl_ni_updateColumnWidths();
+ }
// do we need a vertical scrollbar?
bool bFirstRoundVScrollNeed = false;
@@ -709,15 +844,6 @@ namespace svt { namespace table
aDataCellPlayground.Right() -= nScrollbarMetrics;
}
}
- else
- {
- Size regionWithoutHeader = m_rAntiImpl.PixelToLogic(Size(aDataCellPlayground.Right() - aDataCellPlayground.Left(),0),MAP_100TH_MM);
- TableMetrics nColWidth = regionWithoutHeader.Width()/m_nColumnCount;
- for ( ColPos col = 0; col < m_nColumnCount; ++col )
- m_pModel->getColumnModel(col)->setWidth(nColWidth);
- m_rAntiImpl.SetModel(m_pModel);
- }
-
// create or destroy the vertical scrollbar, as needed
lcl_updateScrollbar(
m_rAntiImpl,
@@ -780,6 +906,11 @@ namespace svt { namespace table
m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
}
+ else if(bHaveScrollCorner && bNeedScrollCorner)
+ {
+ m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
+ m_pScrollCorner->Show();
+ }
// resize the data window
m_pDataWindow->SetSizePixel( Size(
@@ -792,10 +923,26 @@ namespace svt { namespace table
void TableControl_Impl::onResize()
{
DBG_CHECK_ME();
- impl_ni_updateScrollbars();
- //Rectangle aAllCells;
- // impl_getAllVisibleCellsArea( aAllCells );
- //m_pSelEngine->SetVisibleArea(aAllCells);
+ if(m_nRowCount != 0)
+ {
+ if(m_nColumnCount != 0)
+ {
+ if(m_bResizingGrid)
+ impl_ni_updateColumnWidths();
+ invalidateRows();
+ m_bResizingGrid = true;
+ }
+ }
+ else
+ {
+ //In the case that column headers are defined but data hasn't yet been set,
+ //only column headers will be shown
+ if(m_pModel->hasColumnHeaders())
+ if(m_nColHeaderHeightPixel>1)
+ m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel());
+ if(m_nColumnCount != 0)
+ impl_ni_updateScrollbars();
+ }
}
//--------------------------------------------------------------------
@@ -805,7 +952,6 @@ namespace svt { namespace table
if ( !getModel() )
return;
-
PTableRenderer pRenderer = getModel()->getRenderer();
DBG_ASSERT( !!pRenderer, "TableDataWindow::Paint: invalid renderer!" );
if ( !pRenderer )
@@ -813,21 +959,28 @@ namespace svt { namespace table
// our current style settings, to be passed to the renderer
const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
-
+ m_nRowCount = m_pModel->getRowCount();
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nActualRows = m_nRowCount;
+ if(m_nRowCount>nVisibleRows)
+ nActualRows = nVisibleRows;
// the area occupied by all (at least partially) visible cells, including
// headers
Rectangle aAllCellsWithHeaders;
impl_getAllVisibleCellsArea( aAllCellsWithHeaders );
- m_nRowCount = m_pModel->getRowCount();
// ............................
// draw the header column area
- if ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableRowGeometry aHeaderRow( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS );
+ Rectangle aColRect(aHeaderRow.getRect());
+ //to avoid double lines when scrolling horizontally
+ if(m_nLeftColumn != 0)
+ --aColRect.Left();
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aHeaderRow.getRect(), true, false, rStyle
+ *m_pDataWindow, aColRect, true, false, rStyle
);
// Note that strictly, aHeaderRow.getRect() also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
@@ -850,14 +1003,18 @@ namespace svt { namespace table
// the area occupied by the row header, if any
Rectangle aRowHeaderArea;
- if ( getModel()->hasRowHeaders() )
+ if ( m_pModel->hasRowHeaders() )
{
aRowHeaderArea = aAllCellsWithHeaders;
aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * m_nRowCount + m_nColHeaderHeightPixel - 1;
- pRenderer->PaintHeaderArea(
- *m_pDataWindow, aRowHeaderArea, false, true, rStyle
- );
+ if(m_nTopRow+nActualRows>m_nRowCount)
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1;
+ else
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1;
+ //to avoid double lines when scrolling vertically
+ if(m_nTopRow != 0)
+ --aRowHeaderArea.Top();
+ pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
// Note that strictly, aRowHeaderArea also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
// so this hopefully doesn't hurt if we already paint it here.
@@ -866,8 +1023,15 @@ namespace svt { namespace table
{
TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
+ Rectangle aInters(aIntersection.getRect());
+ //to avoid double line when scrolling vertically
+ if( m_nTopRow != 0 )
+ {
+ --aInters.Top();
+ --aInters.Bottom();
+ }
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aIntersection.getRect(), true, true, rStyle
+ *m_pDataWindow, aInters, true, true, rStyle
);
}
}
@@ -880,113 +1044,69 @@ namespace svt { namespace table
// paint all rows
Rectangle aAllDataCellsArea;
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
-
- //get the vector, which contains row vectors, each containing the data for the cells in this row
- std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent();
- //if the vector is empty, fill it with empty data, so the table can be painted
- if(aCellContent.empty())
- {
- std::vector<rtl::OUString> emptyCells;
- while(m_nRowCount!=0)
- {
- aCellContent.push_back(emptyCells);
- --m_nRowCount;
- }
- }
- std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow;
- //get the vector, which contains the row header titles
- std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName();
- ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin();
-
- if(m_pModel->hasRowHeaders())
- {
- aRowHeaderContent = m_pModel->getRowHeaderName();
- //if the vector is empty, fill it with empty strings, so the table can be painted
- if(aRowHeaderContent.empty())
- {
- while(m_nRowCount!=0)
- {
- aRowHeaderContent.push_back(rtl::OUString::createFromAscii(""));
- --m_nRowCount;
- }
- }
- itRowName = aRowHeaderContent.begin()+m_nTopRow;
- }
+ ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
aRowIterator.isValid();
aRowIterator.moveDown() )
{
if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
- {
- if(m_pModel->hasRowHeaders())
- ++itRowName;
- ++it;
continue;
- }
bool isActiveRow = ( aRowIterator.getRow() == getCurRow() );
bool isSelectedRow = false;
if(!m_nRowSelected.empty())
{
for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin();
- itSel!=m_nRowSelected.end();++itSel)
+ itSel!=m_nRowSelected.end();++itSel)
{
if(*itSel == aRowIterator.getRow())
isSelectedRow = true;
}
}
- std::vector<rtl::OUString> aCellData;
- if(it != aCellContent.end())
- {
- aCellData = *it;
- ++it;
- }
- ::std::vector<rtl::OUString>::iterator iter = aCellData.begin()+m_nLeftColumn;
-
+ Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+ //to avoid double lines
+ if( aRowIterator.getRow() != 0 )
+ --aRect.Top();
+ if(m_nLeftColumn != 0)
+ --aRect.Left();
// give the redenderer a chance to prepare the row
pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
- *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle );
+ *m_pDataWindow, aRect, rStyle );
// paint the row header
if ( m_pModel->hasRowHeaders() )
{
- rtl::OUString rowHeaderName;
- if(itRowName != aRowHeaderContent.end())
- {
- rowHeaderName = *itRowName;
- ++itRowName;
- }
Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
+ rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
rStyle, rowHeaderName );
}
if ( !colCount )
continue;
-
// paint all cells in this row
for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn );
aCell.isValid();
aCell.moveRight()
)
{
- // if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() )
- // continue;
-
- //bool isActiveCell = isActiveRow && ( aCell.getColumn() == getCurColumn() );
bool isSelectedColumn = false;
- rtl::OUString cellData;
- if(aCellData.empty())
- cellData=rtl::OUString::createFromAscii("");
- else if(iter != aCellData.end())
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
+ ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()];
+ if(rCellData>>=xGraphic)
+ {
+ Image* pImage = new Image(xGraphic);
+ if(pImage!=NULL)
+ pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ *m_pDataWindow, aCell.getRect(), rStyle, pImage );
+ }
+ else
{
- cellData = *iter;
- ++iter;
+ ::rtl::OUString sContent = convertToString(rCellData);
+ pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ *m_pDataWindow, aCell.getRect(), rStyle, sContent );
}
- pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
- *m_pDataWindow, aCell.getRect(), rStyle, cellData );
- }
+ }
}
}
-
//--------------------------------------------------------------------
void TableControl_Impl::hideCursor()
{
@@ -1016,70 +1136,70 @@ namespace svt { namespace table
switch ( _eAction )
{
case cursorDown:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ //if other rows already selected, deselect them
+ if(m_nRowSelected.size()>0)
{
- //if other rows already selected, deselect them
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow < m_nRowCount-1)
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ it!=m_nRowSelected.end();++it)
{
- ++m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
}
- else
+ if(m_nCurRow < m_nRowCount-1)
{
- if ( m_nCurRow < m_nRowCount - 1 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ ++m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
}
+ else
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow < m_nRowCount - 1 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow + 1 );
+ }
break;
case cursorUp:
- if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- }
- if(m_nCurRow>0)
{
- --m_nCurRow;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ invalidateSelectedRegion(*it, *it, rCells);
}
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- ensureVisible(m_nCurColumn,m_nCurRow,false);
- bSuccess = true;
+ m_nRowSelected.clear();
+ }
+ if(m_nCurRow>0)
+ {
+ --m_nCurRow;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
else
{
- if ( m_nCurRow > 0 )
- bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- break;
+ ensureVisible(m_nCurColumn,m_nCurRow,false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ else
+ {
+ if ( m_nCurRow > 0 )
+ bSuccess = goTo( m_nCurColumn, m_nCurRow - 1 );
+ }
+ break;
case cursorLeft:
if ( m_nCurColumn > 0 )
bSuccess = goTo( m_nCurColumn - 1, m_nCurRow );
@@ -1133,225 +1253,251 @@ namespace svt { namespace table
case cursorBottomRight:
bSuccess = goTo( m_nColumnCount - 1, m_nRowCount - 1 );
break;
-
- case cursorSelectRow:
+ case cursorSelectRow:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ //pos is the position of the current row in the vector of selected rows, if current row is selected
+ int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ //if current row is selected, it should be deselected, when ALT+SPACE are pressed
+ if(pos>-1)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+pos);
+ if(m_nRowSelected.empty() && m_nAnchor != -1)
+ m_nAnchor = -1;
+ }
+ //else select the row->put it in the vector
+ else
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
+ break;
+ case cursorSelectRowUp:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- //pos is the position of the current row in the vector of selected rows, if current row is selected
- int pos = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- //if current row is selected, it should be deselected, when ALT+SPACE are pressed
- if(pos>-1)
- m_nRowSelected.erase(m_nRowSelected.begin()+pos);
- //else select the row->put it in the vector
- else
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- bSuccess = true;
+ //if there are other selected rows, deselect them
+ return false;
}
- break;
- case cursorSelectRowUp:
+ else
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ //there are other selected rows
+ if(m_nRowSelected.size()>0)
{
- //if there are other selected rows, deselect them
- return false;
- }
- else
- {
- //there are other selected rows
- if(m_nRowSelected.size()>0)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ {
+ invalidateSelectedRegion(*it, *it, rCells);
}
+ m_nRowSelected.clear();
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ else
+ {
+ //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the upper one, can move up, otherwise not
+ if(m_nCurRow>0)
+ m_nCurRow--;
+ else
+ return bSuccess = true;
+ //if nextRow already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow+1, rCells);
+ }
+ else
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
+ }
else
{
- //a region is already selected, prevRow is last selected row and the row above - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow-1);
- if(prevRow>-1)
+ if(m_nCurRow>0)
{
- //if m_nCurRow isn't the upper one, can move up, otherwise not
- if(m_nCurRow>0)
- m_nCurRow--;
- else
- return bSuccess = true;
- //if nextRow already selected, deselect it, otherwise select it
- if(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow+1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
}
}
}
+ }
+ else
+ {
+ //if nothing is selected and the current row isn't the upper one
+ //select the current and one row above
+ //otherwise select only the upper row
+ if(m_nCurRow>0)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow--;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
+ }
else
{
- //if nothing is selected and the current row isn't the upper one
- //select the current and one row above
- //otherwise select only the upper row
- if(m_nCurRow>0)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow--;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow+1, m_nCurRow, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- m_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
- break;
- case cursorSelectRowDown:
+ }
+ break;
+ case cursorSelectRowDown:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- {
- bSuccess = false;
- }
- else
+ bSuccess = false;
+ }
+ else
+ {
+ if(m_nRowSelected.size()>0)
{
- if(m_nRowSelected.size()>0)
+ //the anchor wasn't set -> a region is not selected, that's why clear all selection
+ //and select the current row
+ if(m_nAnchor==-1)
{
- //the anchor wasn't set -> a region is not selected, that's why clear all selection
- //and select the current row
- if(m_nAnchor==-1)
- {
- for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
+ for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
it!=m_nRowSelected.end();++it)
- {
- invalidateSelectedRow(*it,rCells);
- m_pDataWindow->Invalidate(rCells);
- }
- m_nRowSelected.clear();
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- else
{
- //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
- int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
- int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1);
- if(prevRow>-1)
- {
- //if m_nCurRow isn't the last one, can move down, otherwise not
- if(m_nCurRow<m_nRowCount)
- m_nCurRow++;
- else
- return bSuccess = true;
- //if net row already selected, deselect it, otherwise select it
- if(m_nRowSelected[nextRow] == m_nCurRow)
- {
- m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
- invalidateSelectedRow(m_nCurRow-1, rCells);
- }
- else
- {
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
- }
- }
+ invalidateSelectedRegion(*it, *it, rCells);
+ }
+ m_nRowSelected.clear();
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- }
else
{
- //there wasn't any selection, select curennt and row beneath, otherwise onlyrow beneath
- if(m_nCurRow<m_nRowCount-1)
- {
- m_nRowSelected.push_back(m_nCurRow);
- m_nCurRow++;
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ //a region is already selected, prevRow is last selected row and the row beneath - nextRow - should be selected
+ int prevRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow);
+ int nextRow = getRowSelectedNumber(m_nRowSelected, m_nCurRow+1);
+ if(prevRow>-1)
+ {
+ //if m_nCurRow isn't the last one, can move down, otherwise not
+ if(m_nCurRow<m_nRowCount-1)
+ m_nCurRow++;
+ else
+ return bSuccess = true;
+ //if next row already selected, deselect it, otherwise select it
+ if(nextRow>-1 && m_nRowSelected[nextRow] == m_nCurRow)
+ {
+ m_nRowSelected.erase(m_nRowSelected.begin()+prevRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow-1, rCells);
+ }
+ else
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
+ }
}
else
{
- m_nRowSelected.push_back(m_nCurRow);
- invalidateSelectedRow(m_nCurRow, rCells);
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ }
}
}
- m_pSelEngine->SetAnchor(TRUE);
- m_nAnchor = m_nCurRow;
- ensureVisible(m_nCurColumn, m_nCurRow, false);
- bSuccess = true;
}
- }
- break;
- case cursorSelectRowAreaTop:
- {
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- bSuccess = false;
else
{
- //select the region between the current and the upper row
- RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, 0, rCells);
- //put the rows in vector
- while(iter>=0)
+ //there wasn't any selection, select current and row beneath, otherwise only row beneath
+ if(m_nCurRow<m_nRowCount-1)
+ {
+ m_nRowSelected.push_back(m_nCurRow);
+ m_nCurRow++;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow-1, m_nCurRow, rCells);
+ }
+ else
{
- if(!isRowSelected(m_nRowSelected, iter))
- m_nRowSelected.push_back(iter);
- --iter;
+ m_nRowSelected.push_back(m_nCurRow);
+ invalidateSelectedRegion(m_nCurRow, m_nCurRow, rCells);
}
- m_nCurRow = 0;
- m_nAnchor = m_nCurRow;
- m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, 0, false);
- bSuccess = true;
}
+ m_pSelEngine->SetAnchor(TRUE);
+ m_nAnchor = m_nCurRow;
+ ensureVisible(m_nCurColumn, m_nCurRow, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
}
+ }
break;
- case cursorSelectRowAreaBottom:
+ case cursorSelectRowAreaTop:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ bSuccess = false;
+ else
{
- if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
- return bSuccess = false;
- else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
- return bSuccess = false;
- //select the region between the current and the last row
+ //select the region between the current and the upper row
RowPos iter = m_nCurRow;
- invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
- //put the rows in the vector
- while(iter<=m_nRowCount)
+ invalidateSelectedRegion(m_nCurRow, 0, rCells);
+ //put the rows in vector
+ while(iter>=0)
{
if(!isRowSelected(m_nRowSelected, iter))
m_nRowSelected.push_back(iter);
- ++iter;
+ --iter;
}
- m_nCurRow = m_nRowCount-1;
+ m_nCurRow = 0;
m_nAnchor = m_nCurRow;
m_pSelEngine->SetAnchor(TRUE);
- ensureVisible(m_nCurColumn, m_nRowCount, false);
+ ensureVisible(m_nCurColumn, 0, false);
+ m_rAntiImpl.selectionChanged(true);
bSuccess = true;
}
+ }
+ break;
+ case cursorSelectRowAreaBottom:
+ {
+ if(m_pSelEngine->GetSelectionMode() == NO_SELECTION)
+ return bSuccess = false;
+ else if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION)
+ return bSuccess = false;
+ //select the region between the current and the last row
+ RowPos iter = m_nCurRow;
+ invalidateSelectedRegion(m_nCurRow, m_nRowCount-1, rCells);
+ //put the rows in the vector
+ while(iter<=m_nRowCount)
+ {
+ if(!isRowSelected(m_nRowSelected, iter))
+ m_nRowSelected.push_back(iter);
+ ++iter;
+ }
+ m_nCurRow = m_nRowCount-1;
+ m_nAnchor = m_nCurRow;
+ m_pSelEngine->SetAnchor(TRUE);
+ ensureVisible(m_nCurColumn, m_nRowCount-1, false);
+ m_rAntiImpl.selectionChanged(true);
+ bSuccess = true;
+ }
break;
default:
DBG_ERROR( "TableControl_Impl::dispatchAction: unsupported action!" );
@@ -1367,16 +1513,12 @@ namespace svt { namespace table
{
Rectangle aCellRect;
impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect );
-
- // const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
+ if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0)
+ aCellRect.Left()++;
if ( _bShow )
- {
pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
- }
else
- {
pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
- }
}
}
@@ -1394,16 +1536,12 @@ namespace svt { namespace table
return;
}
- DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_pModel->getColumnCount() ),
- "TableControl_Impl::impl_getCellRect: invalid column index!" );
- DBG_ASSERT( ( _nRow >= 0 ) && ( _nRow < m_pModel->getRowCount() ),
- "TableControl_Impl::impl_getCellRect: invalid row index!" );
-
Rectangle aAllCells;
impl_getAllVisibleCellsArea( aAllCells );
TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow );
_rCellRect = aCell.getRect();
+ _rCellRect.Top()--;_rCellRect.Left()--;
}
//-------------------------------------------------------------------------------
RowPos TableControl_Impl::getCurrentRow(const Point& rPoint)
@@ -1412,8 +1550,7 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
- for(int i=0;i<m_nRowCount;i++)
+ for(int i=-1;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
{
@@ -1422,9 +1559,7 @@ namespace svt { namespace table
{
newRowPos = i;
newColPos = j;
- if(newColPos == -1)
- m_nCurColumn = 0;
- else
+ if(newColPos != -1)
m_nCurColumn = newColPos;
return newRowPos;
}
@@ -1432,7 +1567,7 @@ namespace svt { namespace table
}
return newRowPos;
}
- //-------------------------------------------------------------------------------
+ //-------------------------------------------------------------------------------
void TableControl_Impl::setCursorAtCurrentCell(const Point& rPoint)
{
DBG_CHECK_ME();
@@ -1440,7 +1575,6 @@ namespace svt { namespace table
Rectangle rCellRect;
RowPos newRowPos = -2;//-1 is HeaderRow
ColPos newColPos = 0;
- //To Do: when only row position needed, the second loop isn't necessary, Please proove this!!!
for(int i=0;i<m_nRowCount;i++)
{
for(int j=-1;j<m_nColumnCount;j++)
@@ -1460,7 +1594,6 @@ namespace svt { namespace table
}
showCursor();
}
-
//-------------------------------------------------------------------------------
void TableControl_Impl::invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect)
{
@@ -1475,14 +1608,14 @@ namespace svt { namespace table
if(_nPrevRow == _nCurRow)
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()=--rCells.Top();
_rCellRect.Bottom()=rCells.Bottom();
}
//if the region is above the current row
else if(_nPrevRow < _nCurRow )
{
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
@@ -1490,46 +1623,31 @@ namespace svt { namespace table
else
{
impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
+ _rCellRect.Top()= --rCells.Top();
impl_getCellRect(m_nCurColumn,_nPrevRow,rCells);
_rCellRect.Bottom()=rCells.Bottom();
}
m_pDataWindow->Invalidate(_rCellRect);
}
-
- //-------------------------------------------------------------------------------
- //To Do: not really needed, because in method above one row can be invalidate. Please Prove this!!!
- void TableControl_Impl::invalidateSelectedRow(RowPos _nCurRow, Rectangle& _rCellRect)
- {
- DBG_CHECK_ME();
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- _rCellRect.Left() = aAllCells.Left();
- _rCellRect.Right() = aAllCells.Right();
- Rectangle rCells;
- impl_getCellRect(m_nCurColumn,_nCurRow,rCells);
- _rCellRect.Top()=rCells.Top();
- _rCellRect.Bottom()=rCells.Bottom();
- m_pDataWindow->Invalidate(_rCellRect);
- }
//-------------------------------------------------------------------------------
//this method is to be called, when a new row is added
void TableControl_Impl::invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect)
{
- //DBG_CHECK_ME();
- TempHideCursor aHideCursor( *this );
+ if(m_nCurRow < 0)
+ m_nCurRow = 0;
+ if(m_nCursorHidden == 2)
+ --m_nCursorHidden;
impl_getAllVisibleCellsArea( _rCellRect );
TableRowGeometry _rRow( *this, _rCellRect, _nRowPos);
impl_ni_updateScrollbars();
m_pDataWindow->Invalidate(_rRow.getRect());
}
-
//-------------------------------------------------------------------------------
std::vector<RowPos>& TableControl_Impl::getSelectedRows()
{
return m_nRowSelected;
}
-
+ //-------------------------------------------------------------------------------
void TableControl_Impl::removeSelectedRow(RowPos _nRowPos)
{
int i =0;
@@ -1556,57 +1674,23 @@ namespace svt { namespace table
else
m_nCurRow = _nRowPos-1;
}
- //-------------------------------------------------------------------------------
- void TableControl_Impl::invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect)
+ //------------------------------------------------------------------------------
+ void TableControl_Impl::invalidateRows()
{
- //DBG_CHECK_ME();
- (void)_nRowStart;
- (void)_rCellRect;
- /*TempHideCursor aHideCursor(*this);
- Rectangle aAllCells;
- impl_getAllVisibleCellsArea( aAllCells );
- TableRowGeometry _rRow( *this, aAllCells, _nRowStart);
- _rCellRect = _rRow.getRect();
- Rectangle rCells1;
- impl_getCellRect(m_nCurColumn,m_nRowCount,rCells1);
- _rCellRect.Bottom() = rCells1.Bottom();*/
- /*if(_nRowStart != _nRowEnd)
- {
- TableRowGeometry _rRow( *this, aAllCells, _nRowEnd);
- _rCellRect.Bottom() = _rRow.getRect().Bottom();
- }
- */
- //_rCellRect.Right() = aAllCells.Right();
- //_rCellRect.Left() = aAllCells.Left();
- //Rectangle rCells1;
- //impl_getCellRect(m_nCurColumn,_nRowStart,rCells1);
- //_rCellRect.Top()=rCells1.Top();
- //Rectangle rCells2;
- //impl_getCellRect(m_nCurColumn,_nRowEnd,rCells2);
- //_rCellRect.Bottom()=rCells2.Bottom();
impl_ni_updateScrollbars();
- //m_pDataWindow->Invalidate(_rCellRect);
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nVisibleCols = impl_getVisibleColumns(true);
+ if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows)
+ m_nTopRow--;
+ else
+ m_nTopRow = 0;
+ if(m_nLeftColumn+nVisibleCols>m_nColumnCount && m_nColumnCount>=nVisibleCols)
+ m_nLeftColumn--;
+ else
+ m_nLeftColumn = 0;
m_pDataWindow->Invalidate();
}
-
- //-------------------------------------------------------------------------------
- bool TableControl_Impl::isClickInVisibleArea(const Point& rPoint)
- {
- DBG_CHECK_ME();
- long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- //clickable area is in the visible table control area without the scrollbars
- Rectangle aDataCellPlayground( Point( 0, 0 ), m_rAntiImpl.GetOutputSizePixel() );
- aDataCellPlayground.Top() = m_nColHeaderHeightPixel;
- aDataCellPlayground.Right() -= nScrollbarMetrics;
- aDataCellPlayground.Bottom() -= nScrollbarMetrics;
- if((rPoint.X() >= aDataCellPlayground.Left() && rPoint.X() <= aDataCellPlayground.Right()) && rPoint.Y() >= aDataCellPlayground.Top() && rPoint.Y() <= aDataCellPlayground.Bottom())
- {
- return true;
- }
- else
- return false;
- }
//--------------------------------------------------------------------
TableSize TableControl_Impl::impl_getVisibleRows( bool _bAcceptPartialRow ) const
{
@@ -1654,20 +1738,6 @@ namespace svt { namespace table
// ensure that the new cell is visible
ensureVisible( m_nCurColumn, m_nCurRow, false );
-
- // TODO: invalidate all and new column/row header, if present, to enforce
- // re-painting them
- //if(!m_nRowSelected.empty())
- //{
- // Rectangle rCells;
- // for(std::vector<RowPos>::iterator it=m_nRowSelected.begin();
- // it!=m_nRowSelected.end();++it)
- // {
- // invalidateSelectedRow(*it,rCells);
- // }
- // m_nRowSelected.clear();
- //}
- // TODO: notify listeners about new position
return true;
}
@@ -1735,7 +1805,7 @@ namespace svt { namespace table
&& abs( nPixelDelta ) < aDataArea.GetHeight()
)
{
- m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE );
+ m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, SCROLL_CLIP | SCROLL_UPDATE | SCROLL_CHILDREN);
}
else
m_pDataWindow->Invalidate( INVALIDATE_UPDATE );
@@ -1791,42 +1861,310 @@ namespace svt { namespace table
return (TableSize)( m_nLeftColumn - nOldLeftColumn );
}
-
+ //-------------------------------------------------------------------------------
SelectionEngine* TableControl_Impl::getSelEngine()
{
return m_pSelEngine;
}
+ //-------------------------------------------------------------------------------
TableDataWindow* TableControl_Impl::getDataWindow()
{
return m_pDataWindow;
}
- BOOL TableControl_Impl::isRowSelected(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getHorzScrollbar()
+ {
+ return m_pHScroll;
+ }
+ //-------------------------------------------------------------------------------
+ ScrollBar* TableControl_Impl::getVertScrollbar()
+ {
+ return m_pVScroll;
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableControl_Impl::isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current)
+ {
+ return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end();
+ }
+ //-------------------------------------------------------------------------------
+ bool TableControl_Impl::isRowSelected(RowPos current)
+ {
+ return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end();
+ }
+ //-------------------------------------------------------------------------------
+ int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
- for(::std::vector<RowPos>::iterator it=selectedRows.begin();
- it!=selectedRows.end();++it)
+ std::vector<RowPos>::const_iterator it = ::std::find(selectedRows.begin(),selectedRows.end(),current);
+ if ( it != selectedRows.end() )
{
- if(*it == current)
- return TRUE;
+ return it - selectedRows.begin();
}
- return FALSE;
+ return -1;
}
-
- int TableControl_Impl::getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current)
+ //-------------------------------------------------------------------------------
+ ::rtl::OUString& TableControl_Impl::setTooltip(const Point& rPoint )
{
- int pos = -1;
- int i = 0;
- for(std::vector<RowPos>::iterator it=selectedRows.begin();it!=selectedRows.end();++it)
+ ::rtl::OUString aTooltipText;
+ RowPos current = getCurrentRow(rPoint);
+ com::sun::star::uno::Sequence< sal_Int32 > cols = m_rAntiImpl.getColumnsForTooltip();
+ com::sun::star::uno::Sequence< ::rtl::OUString > text = m_rAntiImpl.getTextForTooltip();
+ if(text.getLength()==0 && cols.getLength()==0)
{
- if(*it == current)
- return pos = i;
- ++i;
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][m_nCurColumn];
+ aTooltipText = convertToString(content);
+ }
+ else if(text.getLength() == 0)
+ {
+ for(int i=0; i<cols.getLength(); i++)
+ {
+ if(i==0)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText = convertToString(content);
+ }
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText += convertToString(content);
+ }
+ }
}
- return pos;
+ else if(cols.getLength() == 0)
+ {
+ for(int i=0; i<text.getLength(); i++)
+ {
+ if(i==0)
+ aTooltipText = text[i];
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ aTooltipText+= text[i];
+ }
+ }
+ }
+ else
+ {
+ int nCols = cols.getLength();
+ int mText = text.getLength();
+ if(nCols < mText )
+ cols.realloc(mText);
+ else if(mText < nCols)
+ text.realloc(nCols);
+ for(int i=0; i<cols.getLength(); i++)
+ {
+ if(i==0)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ aTooltipText = text[i] + convertToString(content);
+ }
+ else
+ {
+ aTooltipText+= ::rtl::OUString::createFromAscii("\n");
+ aTooltipText+= text[i];
+ if(nCols > i)
+ {
+ ::com::sun::star::uno::Any content = m_pModel->getCellContent()[current][cols[i]];
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
+ aTooltipText += convertToString(content);
+ }
+ }
+ }
+ }
+ return m_aTooltipText = aTooltipText;
}
-
- void TableControl_Impl::setCellContent(CellEntryType* pCellEntryType)
+ //--------------------------------------------------------------------
+ void TableControl_Impl::resizeColumn(const Point& rPoint)
+ {
+ Pointer aNewPointer(POINTER_ARROW);
+ int headerRowWidth = 0;
+ if(m_pModel->hasRowHeaders())
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ int resizingColumn=m_nCurColumn-m_nLeftColumn;
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nCurColumn);
+ impl_ni_getAccVisibleColWidths();
+ int newColWidth = m_aColumnWidthsPixel[m_nCurColumn];
+ //subtract 1 from m_aAccColumnWidthPixel because right border should be part of the current cell
+ if(m_aVisibleColumnWidthsPixel[resizingColumn]-1 == rPoint.X() && pColumn->isResizable())
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ //MouseButton was pressed but not yet released, mouse is moving
+ if(m_bResizing)
+ {
+ if(rPoint.X() > m_pDataWindow->GetOutputSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth)
+ aNewPointer = Pointer( POINTER_NOTALLOWED);
+ else
+ aNewPointer = Pointer( POINTER_HSPLIT );
+ m_pDataWindow->HideTracking();
+ int lineHeight = 0;
+ if(m_pModel->hasColumnHeaders())
+ lineHeight+= m_nColHeaderHeightPixel;
+ lineHeight+=m_nRowHeightPixel*m_nRowCount;
+ int gridHeight = m_pDataWindow->GetOutputSizePixel().Height();
+ if(lineHeight >= gridHeight)
+ lineHeight = gridHeight;
+ m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )),
+ SHOWTRACK_SPLIT | SHOWTRACK_WINDOW);
+ }
+ m_pDataWindow->SetPointer(aNewPointer);
+ }
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::startResizeColumn(const Point& rPoint)
+ {
+ m_bResizingGrid = false;
+ m_nResizingColumn = m_nCurColumn;
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
+ if(m_aVisibleColumnWidthsPixel[m_nResizingColumn-m_nLeftColumn]-1 == rPoint.X() && pColumn->isResizable())
+ {
+ m_pDataWindow->CaptureMouse();
+ m_bResizing = true;
+ }
+ return m_bResizing;
+ }
+ //--------------------------------------------------------------------
+ bool TableControl_Impl::endResizeColumn(const Point& rPoint)
{
- (void)pCellEntryType;
+ if(m_bResizing)
+ {
+ m_pDataWindow->HideTracking();
+ PColumnModel pColumn = m_pModel->getColumnModel(m_nResizingColumn);
+ int maxWidth = pColumn->getMaxWidth();
+ int minWidth = pColumn->getMinWidth();
+ int resizeCol = m_nResizingColumn-m_nLeftColumn;
+ //new position of mouse
+ int actX = rPoint.X();
+ //old position of right border
+ int oldX = m_aVisibleColumnWidthsPixel[resizeCol];
+ //position of left border if cursor in the first cell
+ int leftX = 0;
+ if(m_nResizingColumn > m_nLeftColumn)
+ leftX = m_aVisibleColumnWidthsPixel[resizeCol-1];
+ else if(m_nResizingColumn == 0 && m_pModel->hasRowHeaders())
+ leftX = m_rAntiImpl.LogicToPixel( Size( m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ int actWidth = actX - leftX;
+ int newActWidth = 0;
+ //minimize the column width
+ if(oldX > actX && actX >= leftX)
+ {
+ if(minWidth < actWidth)
+ {
+ newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
+ pColumn->setPreferredWidth(newActWidth);
+ }
+ else
+ pColumn->setPreferredWidth(minWidth);
+ if(m_nLeftColumn != 0)
+ impl_updateLeftColumn();
+ }
+ else if(oldX < actX)
+ {
+ if(actWidth < maxWidth)
+ {
+ newActWidth = m_rAntiImpl.PixelToLogic( Size( actWidth, 0 ), MAP_APPFONT ).Width();
+ pColumn->setPreferredWidth(newActWidth);
+ }
+ else
+ pColumn->setPreferredWidth(maxWidth);
+ }
+ m_nCurColumn = m_nResizingColumn;
+ impl_ni_updateColumnWidths();
+ impl_ni_updateScrollbars();
+ m_pDataWindow->Invalidate(INVALIDATE_UPDATE);
+ m_pDataWindow->SetPointer(Pointer());
+ m_bResizing = false;
+ m_bResizingGrid = true;
+ }
+ m_pDataWindow->ReleaseMouse();
+ return m_bResizing;
+ }
+ //-------------------------------------------------------------------------------
+ void TableControl_Impl::impl_ni_getAccVisibleColWidths()
+ {
+ TableSize nVisCols = impl_getVisibleColumns(true);
+ int widthsPixel = 0;
+ m_aVisibleColumnWidthsPixel.resize(0);
+ m_aVisibleColumnWidthsPixel.reserve(nVisCols);
+ int headerRowWidth = 0;
+ if(m_pModel->hasRowHeaders())
+ {
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ widthsPixel+=headerRowWidth;
+ }
+ int col = m_nLeftColumn;
+ while(nVisCols)
+ {
+ m_aVisibleColumnWidthsPixel.push_back(widthsPixel+=m_aColumnWidthsPixel[col]);
+ col++;
+ nVisCols--;
+ }
+ }
+ //-------------------------------------------------------------------------------
+ void TableControl_Impl::impl_updateLeftColumn()
+ {
+ int nVisCols = m_aVisibleColumnWidthsPixel.size();
+ int headerRowWidth = 0;
+ //sum of currently visible columns
+ int widthsPixel = 0;
+ //header pixel should be added, because header doesn't vanish when scrolling
+ if(m_pModel->hasRowHeaders())
+ {
+ headerRowWidth = m_rAntiImpl.LogicToPixel( Size(m_pModel->getRowHeaderWidth(), 0 ), MAP_APPFONT ).Width();
+ widthsPixel+=headerRowWidth;
+ }
+ int col = m_nLeftColumn;
+ //add column width of the neighbour of the left column
+ widthsPixel+=m_aColumnWidthsPixel[col-1];
+ //compute the sum of the new column widths
+ while(nVisCols)
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel(col);
+ int colWidth = pColumn->getWidth();
+ int colPrefWidth = pColumn->getPreferredWidth();
+ if(colPrefWidth!=0)
+ colWidth = colPrefWidth;
+ widthsPixel += m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ col++;
+ nVisCols--;
+ }
+ //when the sum of all visible columns and the next to the left column is smaller than
+ //window width, then update m_nLeftColumn
+ if(widthsPixel<m_pDataWindow->GetOutputSizePixel().Width())
+ m_nLeftColumn--;
+ }
+ //--------------------------------------------------------------------
+ rtl::OUString TableControl_Impl::convertToString(const ::com::sun::star::uno::Any& value)
+ {
+ sal_Int32 nInt = 0;
+ sal_Bool bBool = false;
+ double fDouble = 0;
+ ::rtl::OUString sNewString;
+ ::rtl::OUString sConvertString;
+ if(value >>= sConvertString)
+ sNewString = sConvertString;
+ else if(value >>= nInt)
+ sNewString = sConvertString.valueOf(nInt);
+ else if(value >>= bBool)
+ sNewString = sConvertString.valueOf(bBool);
+ else if(value >>= fDouble)
+ sNewString = sConvertString.valueOf(fDouble);
+ return sNewString;
+ }
+ Rectangle TableControl_Impl::calcHeaderRect(bool bColHeader)
+ {
+ Rectangle aRectTable, aRectTableWithHeaders;
+ impl_getAllVisibleDataCellArea(aRectTable);
+ impl_getAllVisibleCellsArea(aRectTableWithHeaders);
+ Size aSizeTable(aRectTable.GetSize());
+ Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
+ if(bColHeader)
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+ }
+ Rectangle TableControl_Impl::calcTableRect()
+ {
+ Rectangle aRect;
+ impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
}
//--------------------------------------------------------------------
@@ -1842,34 +2180,33 @@ namespace svt { namespace table
return 0L;
}
-
//---------------------------------------------------------------------------------------
- TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl):
- m_pTableControl( _pTableControl)
- ,m_nCurrentRow (-2)
+ TableFunctionSet::TableFunctionSet(TableControl_Impl* _pTableControl)
+ :m_pTableControl( _pTableControl)
+ ,m_nCurrentRow (-2)
{
}
-
+ //-------------------------------------------------------------------------------
TableFunctionSet::~TableFunctionSet()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::BeginDrag()
{
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::CreateAnchor()
{
m_pTableControl->m_nAnchor = m_pTableControl->m_nCurRow;
}
-
- void TableFunctionSet::DestroyAnchor()
- {
+ //-------------------------------------------------------------------------------
+ void TableFunctionSet::DestroyAnchor()
+ {
m_pTableControl->m_nAnchor = -1;
- }
-
- BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
- {
+ }
+ //-------------------------------------------------------------------------------
+ BOOL TableFunctionSet::SetCursorAtPoint(const Point& rPoint, BOOL bDontSelectAtCursor)
+ {
BOOL bHandled = FALSE;
Rectangle rCells;
//curRow is the row where the mouse click happened, m_nCurRow is the last selected row, before the mouse click
@@ -1886,9 +2223,6 @@ namespace svt { namespace table
{
//selecting region,
int diff = m_pTableControl->m_nCurRow - curRow;
- //bool isAlreadySelected = m_pTableControl->isRowSelected(m_pTableControl->m_nRowSelected, m_pTableControl->m_nAnchor);
- /* if(!isAlreadySelected && m_nCurrentRow != m_pTableControl->m_nCurRow)
- m_pTableControl->m_nRowSelected.push_back(m_nAnchor);*/
//selected region lies above the last selection
if( diff >= 0)
{
@@ -1924,9 +2258,7 @@ namespace svt { namespace table
else
{
if(m_pTableControl->m_nRowSelected.empty())
- {
m_pTableControl->m_nRowSelected.push_back(curRow);
- }
else
{
if(m_pTableControl->m_pSelEngine->GetSelectionMode()==SINGLE_SELECTION)
@@ -1943,14 +2275,14 @@ namespace svt { namespace table
}
if(m_pTableControl->m_nRowSelected.size()>1 && m_pTableControl->m_pSelEngine->GetSelectionMode()!=SINGLE_SELECTION)
m_pTableControl->m_pSelEngine->AddAlways(TRUE);
- m_pTableControl->invalidateSelectedRow(curRow,rCells);
+ m_pTableControl->invalidateSelectedRegion(curRow, curRow, rCells);
bHandled = TRUE;
}
m_pTableControl->m_nCurRow = curRow;
m_pTableControl->ensureVisible(m_pTableControl->m_nCurColumn,m_pTableControl->m_nCurRow,false);
return bHandled;
}
-
+ //-------------------------------------------------------------------------------
BOOL TableFunctionSet::IsSelectionAtPoint( const Point& rPoint )
{
m_pTableControl->m_pSelEngine->AddAlways(FALSE);
@@ -1965,7 +2297,7 @@ namespace svt { namespace table
return selected;
}
}
-
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAtPoint( const Point& rPoint )
{
(void)rPoint;
@@ -1978,21 +2310,22 @@ namespace svt { namespace table
if(*it == m_nCurrentRow)
{
pos = i;
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
++i;
}
m_pTableControl->m_nRowSelected.erase(m_pTableControl->m_nRowSelected.begin()+pos);
}
+ //-------------------------------------------------------------------------------
void TableFunctionSet::DeselectAll()
{
if(!m_pTableControl->m_nRowSelected.empty())
{
Rectangle rCells;
for(std::vector<RowPos>::iterator it=m_pTableControl->m_nRowSelected.begin();
- it!=m_pTableControl->m_nRowSelected.end();++it)
+ it!=m_pTableControl->m_nRowSelected.end();++it)
{
- m_pTableControl->invalidateSelectedRow(*it,rCells);
+ m_pTableControl->invalidateSelectedRegion(*it, *it, rCells);
}
m_pTableControl->m_nRowSelected.clear();
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index dc875cd137fe..0a487c77c76c 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -39,6 +39,7 @@
#include <vector>
#include <vcl/seleng.hxx>
+
class ScrollBar;
class ScrollBarBox;
@@ -62,60 +63,64 @@ namespace svt { namespace table
friend class TableRowGeometry;
friend class TableColumnGeometry;
friend class SuspendInvariants;
- friend class TableFunctionSet;
+ friend class TableFunctionSet;
private:
/// the control whose impl-instance we implemnt
- TableControl& m_rAntiImpl;
+ TableControl& m_rAntiImpl;
/// the model of the table control
- PTableModel m_pModel;
+ PTableModel m_pModel;
/// the input handler to use, usually the input handler as provided by ->m_pModel
- PTableInputHandler m_pInputHandler;
+ PTableInputHandler m_pInputHandler;
/// the widths of the single columns, measured in pixel
- ArrayOfLong m_aColumnWidthsPixel;
+ ArrayOfLong m_aColumnWidthsPixel;
/** the accumulated widths of the single columns, i.e. their exclusive right borders,
<strong<not</strong> counting the space for a possible row header column
*/
- ArrayOfLong m_aAccColumnWidthsPixel;
+ ArrayOfLong m_aAccColumnWidthsPixel;
+
+ ArrayOfLong m_aVisibleColumnWidthsPixel;
/// the height of a single row in the table, measured in pixels
- long m_nRowHeightPixel;
+ long m_nRowHeightPixel;
/// the height of the column header row in the table, measured in pixels
- long m_nColHeaderHeightPixel;
+ long m_nColHeaderHeightPixel;
/// the width of the row header column in the table, measured in pixels
- long m_nRowHeaderWidthPixel;
+ long m_nRowHeaderWidthPixel;
/// the number of columns in the table control. Cached model value.
- TableSize m_nColumnCount;
+ TableSize m_nColumnCount;
/// the number of rows in the table control. Cached model value.
- TableSize m_nRowCount;
+ TableSize m_nRowCount;
- ColPos m_nCurColumn;
- RowPos m_nCurRow;
- ColPos m_nLeftColumn;
- RowPos m_nTopRow;
+ ColPos m_nCurColumn;
+ RowPos m_nCurRow;
+ ColPos m_nLeftColumn;
+ RowPos m_nTopRow;
- sal_Int32 m_nCursorHidden;
+ sal_Int32 m_nCursorHidden;
/** the window to contain all data content, including header bars
The window's upper left corner is at position (0,0), relative to the
table control, which is the direct parent of the data window.
*/
- TableDataWindow* m_pDataWindow;
+ TableDataWindow* m_pDataWindow;
/// the vertical scrollbar, if any
- ScrollBar* m_pVScroll;
+ ScrollBar* m_pVScroll;
/// the horizontal scrollbar, if any
ScrollBar* m_pHScroll;
- ScrollBarBox* m_pScrollCorner;
- //selection engine - for determining selection range, e.g. single, multiple
- SelectionEngine* m_pSelEngine;
- //vector which contains the selected rows
- std::vector<RowPos> m_nRowSelected;
- //part of selection engine
- TableFunctionSet* m_pTableFunctionSet;
- //part of selection engine
- RowPos m_nAnchor;
-
-
+ ScrollBarBox* m_pScrollCorner;
+ //selection engine - for determining selection range, e.g. single, multiple
+ SelectionEngine* m_pSelEngine;
+ //vector which contains the selected rows
+ std::vector<RowPos> m_nRowSelected;
+ //part of selection engine
+ TableFunctionSet* m_pTableFunctionSet;
+ //part of selection engine
+ RowPos m_nAnchor;
+ bool m_bResizing;
+ ColPos m_nResizingColumn;
+ bool m_bResizingGrid;
+ rtl::OUString m_aTooltipText;
#if DBG_UTIL
#define INV_SCROLL_POSITION 1
@@ -146,7 +151,6 @@ namespace svt { namespace table
inline const TableControl& getAntiImpl() const { return m_rAntiImpl; }
inline TableControl& getAntiImpl() { return m_rAntiImpl; }
- void setCellContent(CellEntryType* pCellEntryType);
public:
TableControl_Impl( TableControl& _rAntiImpl );
@@ -181,53 +185,42 @@ namespace svt { namespace table
<TRUE/> if it's okay that the given cooordinate is only partially visible
*/
void ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility );
- /** returns the row, which contains the input point*/
- RowPos getCurrentRow (const Point& rPoint);
-
- void setCursorAtCurrentCell(const Point& rPoint);
- /** proves whether the vector with the selected rows contains the current row*/
- BOOL isRowSelected(::std::vector<RowPos> selectedRows, RowPos current);
- /** returns the position of the current row in the selecttion vector */
- int getRowSelectedNumber(::std::vector<RowPos> selectedRows, RowPos current);
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
- /** _rCellRect contains the region, which should be invalidate after some action e.g. selectiong row*/
- //vielleicht kann man mit den anderen verschmelzen, mit einer berprfung ob prev==curr?
- void invalidateSelectedRow( RowPos _nCurRow, Rectangle& _rCellRect );
- /** to be called when a new row is added to the control*/
- void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
- /** returns the vector, which contains the selected rows*/
- std::vector<RowPos>& getSelectedRows();
- /** updates the vector, which contains the selected rows after removing the row nRowPos*/
- void removeSelectedRow(RowPos _nRowPos);
- void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect );
- //virtual void DoubleClick();
-
+ /** returns the row, which contains the input point*/
+ virtual RowPos getCurrentRow (const Point& rPoint);
+
+ void setCursorAtCurrentCell(const Point& rPoint);
+ /** checks whether the vector with the selected rows contains the current row*/
+ BOOL isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current);
+
+ bool isRowSelected(RowPos current);
+ /** returns the position of the current row in the selection vector */
+ int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
+ /** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
+ void invalidateSelectedRegion(RowPos _nPrevRow, RowPos _nCurRow, Rectangle& _rCellRect );
+ /** to be called when a new row is added to the control*/
+ void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
+ /** returns the vector, which contains the selected rows*/
+ std::vector<RowPos>& getSelectedRows();
+ /** updates the vector, which contains the selected rows after removing the row nRowPos*/
+ void removeSelectedRow(RowPos _nRowPos);
+ void invalidateRows();
// IAbstractTableControl
virtual void hideCursor();
virtual void showCursor();
virtual bool dispatchAction( TableControlAction _eAction );
- virtual bool isClickInVisibleArea(const Point& rPoint);
- virtual SelectionEngine* getSelEngine();
-
- TableDataWindow* getDataWindow();
- /** retrieves the area occupied by the totality of (at least partially) visible cells
-
- The returned area includes row and column headers. Also, it takes into
- account the the fact that there might be less columns than would normally
- find room in the control.
-
- As a result of respecting the partial visibility of rows and columns,
- the returned area might be larger than the data window's output size.
- */
- void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const;
-
- /** retrieves the area occupied by all (at least partially) visible data cells.
-
- Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea,
- minus the row and column header areas.
- */
- void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+ virtual SelectionEngine* getSelEngine();
+ virtual rtl::OUString& setTooltip(const Point& rPoint );
+ virtual void resizeColumn(const Point& rPoint);
+ virtual bool startResizeColumn(const Point& rPoint);
+ virtual bool endResizeColumn(const Point& rPoint);
+
+ TableDataWindow* getDataWindow();
+ ScrollBar* getHorzScrollbar();
+ ScrollBar* getVertScrollbar();
+
+ ::rtl::OUString convertToString(const ::com::sun::star::uno::Any& _value);
+ Rectangle calcHeaderRect(bool bColHeader);
+ Rectangle calcTableRect();
private:
/** toggles the cursor visibility
@@ -312,10 +305,30 @@ namespace svt { namespace table
column range were reached.
*/
TableSize impl_ni_ScrollColumns( TableSize _nRowDelta );
+ /** retrieves the area occupied by the totality of (at least partially) visible cells
+
+ The returned area includes row and column headers. Also, it takes into
+ account the the fact that there might be less columns than would normally
+ find room in the control.
+
+ As a result of respecting the partial visibility of rows and columns,
+ the returned area might be larger than the data window's output size.
+ */
+ void impl_getAllVisibleCellsArea( Rectangle& _rCellArea ) const;
+
+ /** retrieves the area occupied by all (at least partially) visible data cells.
+
+ Effectively, the returned area is the same as returned by ->impl_getAllVisibleCellsArea,
+ minus the row and column header areas.
+ */
+ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+
+ void impl_ni_getAccVisibleColWidths();
+ void impl_updateLeftColumn();
DECL_LINK( OnScroll, ScrollBar* );
};
- //see seleng.hxx, seleng.cxx, FunctionSet overwritables, part of selection engine
+ //see seleng.hxx, seleng.cxx, FunctionSet overridables, part of selection engine
class TableFunctionSet : public FunctionSet
{
friend class TableDataWindow;
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 246710488b42..e307071e2699 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -30,6 +30,7 @@
#include "svtools/table/tablecontrol.hxx"
#include "svtools/table/tabledatawindow.hxx"
#include "tablecontrol_impl.hxx"
+#include <vcl/help.hxx>
//........................................................................
namespace svt { namespace table
@@ -44,10 +45,8 @@ namespace svt { namespace table
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
,m_rTableControl ( _rTableControl )
+ ,m_nRowAlreadySelected( -1 )
{
- Color backgroundColor = m_rTableControl.getAntiImpl().GetSettings().GetStyleSettings().GetFieldColor();
- SetBackground( backgroundColor );
- SetControlBackground( backgroundColor );
}
//--------------------------------------------------------------------
@@ -55,28 +54,99 @@ namespace svt { namespace table
{
m_rTableControl.doPaintContent( rUpdateRect );
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseMove( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
if ( !m_rTableControl.getInputHandler()->MouseMove( m_rTableControl, rMEvt ) )
- Window::MouseMove( rMEvt );
+ {
+ if(m_rTableControl.getCurrentRow(aPoint)>=0 )
+ {
+ SetPointer(POINTER_ARROW);
+ rtl::OUString& rHelpText = m_rTableControl.setTooltip(aPoint);
+ Help::EnableBalloonHelp();
+ Window::SetHelpText( rHelpText.getStr());
+ }
+ else if(m_rTableControl.getCurrentRow(aPoint) == -1)
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ m_rTableControl.resizeColumn(aPoint);
+ }
+ else
+ {
+ if(Help::IsBalloonHelpEnabled())
+ Help::DisableBalloonHelp();
+ Window::MouseMove( rMEvt );
+ }
+ }
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
+ RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint);
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
Window::MouseButtonDown( rMEvt );
else
- m_aMouseButtonDownHdl.Call( (MouseEvent*) &rMEvt);
+ {
+ if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
+ {
+ if( m_nRowAlreadySelected != nCurRow )
+ {
+ m_nRowAlreadySelected = nCurRow;
+ m_aSelectHdl.Call( NULL );
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
+ }
m_rTableControl.getAntiImpl().LoseFocus();
}
+ //--------------------------------------------------------------------
void TableDataWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
Window::MouseButtonUp( rMEvt );
else
- m_aMouseButtonUpHdl.Call( (MouseEvent*) &rMEvt);
+ m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GetFocus();
}
-
+ //--------------------------------------------------------------------
+ void TableDataWindow::SetPointer( const Pointer& rPointer )
+ {
+ Window::SetPointer(rPointer);
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::CaptureMouse()
+ {
+ Window::CaptureMouse();
+ }
+ //--------------------------------------------------------------------
+ void TableDataWindow::ReleaseMouse( )
+ {
+ Window::ReleaseMouse();
+ }
+ // -----------------------------------------------------------------------
+ long TableDataWindow::Notify(NotifyEvent& rNEvt )
+ {
+ long nDone = 0;
+ if ( rNEvt.GetType() == EVENT_COMMAND )
+ {
+ const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
+ if ( rCEvt.GetCommand() == COMMAND_WHEEL )
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) )
+ {
+ nDone = HandleScrollCommand( rCEvt, m_rTableControl.getHorzScrollbar(), m_rTableControl.getVertScrollbar() );
+ }
+ }
+ }
+ return nDone ? nDone : Window::Notify( rNEvt );
+ }
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablegeometry.cxx b/svtools/source/table/tablegeometry.cxx
index 58bdb531c921..d60de9e6438f 100644
--- a/svtools/source/table/tablegeometry.cxx
+++ b/svtools/source/table/tablegeometry.cxx
@@ -49,8 +49,8 @@ namespace svt { namespace table
{
if ( m_nRowPos == ROW_COL_HEADERS )
{
- DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(),
- "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" );
+ //DBG_ASSERT( m_rControl.m_pModel->hasColumnHeaders(),
+ // "TableRowGeometry::TableRowGeometry: why asking for the geoemtry of the non-existent column header row?" );
m_aRect.Top() = 0;
m_aRect.Bottom() = m_rControl.m_nColHeaderHeightPixel - 1;
}
@@ -87,8 +87,8 @@ namespace svt { namespace table
{
if ( m_nColPos == COL_ROW_HEADERS )
{
- DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(),
- "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" );
+/* DBG_ASSERT( m_rControl.m_pModel->hasRowHeaders(),
+ "TableColumnGeometry::TableColumnGeometry: why asking for the geoemtry of the non-existent row header column?" )*/;
m_aRect.Left() = 0;
m_aRect.Right() = m_rControl.m_nRowHeaderWidthPixel - 1;
}
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 80c31e65d4f1..b411181c2aab 100644..100755
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -28,6 +28,7 @@
#include "precompiled_svtools.hxx"
#include "svtxgridcontrol.hxx"
+#include "accessibletableimp.hxx"
#include <com/sun/star/view/SelectionType.hpp>
#include "svtools/table/gridtablerenderer.hxx"
#include "svtools/table/defaultinputhandler.hxx"
@@ -37,12 +38,17 @@
#include <rtl/ref.hxx>
#include <tools/debug.hxx>
#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/grid/GridInvalidDataException.hpp>
+#include <com/sun/star/awt/grid/GridInvalidModelException.hpp>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
using ::rtl::OUString;
using namespace ::svt::table;
@@ -63,7 +69,10 @@ SVTXGridControl::SVTXGridControl()
m_bHasColumnHeaders(false),
m_bHasRowHeaders(false),
m_bVScroll(false),
- m_bHScroll(false)
+ m_bHScroll(false),
+ m_bUpdate(false),
+ m_nSelectedRowCount(0),
+ m_aSelectionListeners( *this )
{
}
@@ -76,9 +85,10 @@ SVTXGridControl::~SVTXGridControl()
::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridColumnListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
}
@@ -90,36 +100,26 @@ IMPL_XTYPEPROVIDER_START( SVTXGridControl )
VCLXWindow::getTypes()
IMPL_XTYPEPROVIDER_END
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
return pTable->GetCurrentRow( Point(x,y) );
}
+void SAL_CALL SVTXGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ pTable->setTooltip(text, columns);
+}
+
void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- (void)listener;
+ m_aSelectionListeners.addInterface(listener);
}
void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- (void) listener;
+ m_aSelectionListeners.removeInterface(listener);
}
void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
@@ -127,7 +127,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
-
switch( GetPropertyId( PropertyName ) )
{
case BASEPROPERTY_GRID_SELECTIONMODE:
@@ -155,6 +154,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bHScroll )
{
m_bHScroll = bHScroll;
+ m_pTableModel->setHorizontalScrollbarVisibility(bHScroll);
}
break;
}
@@ -164,9 +164,11 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
if( aValue >>= bVScroll )
{
m_bVScroll = bVScroll;
+ m_pTableModel->setVerticalScrollbarVisibility(bVScroll);
}
break;
}
+
case BASEPROPERTY_GRID_SHOWROWHEADER:
{
sal_Bool rowHeader = true;
@@ -176,6 +178,66 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
break;
}
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ {
+ sal_Int32 colorHeader = 0x000000;
+ if( aValue >>= colorHeader )
+ {
+ m_pTableModel->setHeaderBackgroundColor(colorHeader);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ {
+ sal_Int32 colorLine = 0x000000;
+ if( aValue >>= colorLine )
+ {
+ m_pTableModel->setLineColor(colorLine);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ {
+ sal_Int32 colorEvenRow = 0x000000;
+ if( aValue >>= colorEvenRow )
+ {
+ m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ {
+ sal_Int32 colorBackground = 0x000000;
+ if( aValue >>= colorBackground )
+ {
+ m_pTableModel->setOddRowBackgroundColor(colorBackground);
+ }
+ break;
+ }
+ case BASEPROPERTY_TEXTCOLOR:
+ {
+ sal_Int32 colorText = 0xFFFFFF;
+ if( aValue >>= colorText )
+ {
+ m_pTableModel->setTextColor(colorText);
+ }
+ break;
+ }
+ case BASEPROPERTY_VERTICALALIGN:
+ {
+ com::sun::star::style::VerticalAlignment vAlign(com::sun::star::style::VerticalAlignment(0));
+ if( aValue >>= vAlign )
+ {
+ switch( vAlign )
+ {
+ case com::sun::star::style::VerticalAlignment_TOP: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
+ case com::sun::star::style::VerticalAlignment_MIDDLE: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(1)); break;
+ case com::sun::star::style::VerticalAlignment_BOTTOM: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(2)); break;
+ default: m_pTableModel->setVerticalAlign(com::sun::star::style::VerticalAlignment(0)); break;
+ }
+ }
+ break;
+ }
case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
{
@@ -188,40 +250,97 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
case BASEPROPERTY_GRID_DATAMODEL:
{
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
- Sequence<rtl::OUString> rowData(0);
- std::vector< std::vector< rtl::OUString > > aCellContent(0);
- for(int i = 0; i< m_xDataModel->getRowCount();++i)
{
- rowData = cellData[i];
- std::vector<rtl::OUString> newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
- if(newRow.size() < (unsigned)m_pTableModel->getColumnCount())
- newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- aCellContent.push_back(newRow);
+ m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
+ if(m_xDataModel != NULL)
+ {
+ Sequence<Sequence< Any > > cellData = m_xDataModel->getData();
+ if(cellData.getLength()!= 0)
+ {
+ for (int i = 0; i < cellData.getLength(); i++)
+ {
+ std::vector< Any > newRow;
+ Sequence< Any > rawRowData = cellData[i];
+ //check whether the data row vector length matches with the column count
+ if(m_xColumnModel->getColumnCount() == 0)
+ {
+ for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ }
+ m_xColumnModel->setDefaultColumns(rawRowData.getLength());
+ }
+ else
+ if((unsigned int)rawRowData.getLength()!=(unsigned)m_pTableModel->getColumnCount())
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
+
+ for ( int k = 0; k < rawRowData.getLength(); k++)
+ {
+ newRow.push_back(rawRowData[k]);
+ }
+ m_pTableModel->getCellContent().push_back(newRow);
+ }
+
+ Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
+ m_pTableModel->setRowCount(m_xDataModel->getRowCount());
+ m_pTableModel->setRowHeaderName(newRow);
+ }
+ }
+ else
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel);
+ sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
+ if(m_xDataModel->getRowHeight() == 0)
+ {
+ m_pTableModel->setRowHeight(fontHeight);
+ m_xDataModel->setRowHeight(fontHeight);
+ }
+ else
+ m_pTableModel->setRowHeight(m_xDataModel->getRowHeight());
+ m_pTableModel->setRowHeaderWidth(m_xDataModel->getRowHeaderWidth());
}
- m_pTableModel->setCellContent(aCellContent);
- Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
- m_pTableModel->setRowCount(m_xDataModel->getRowCount());
- m_pTableModel->setRowHeaderName(newRow);
break;
}
case BASEPROPERTY_GRID_COLUMNMODEL:
{
m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- /* if(m_pTable->GetColumnCount().size()>0)
- m_pTable->GetColumnName.clear();*/
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ if(m_xColumnModel != NULL)
{
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ if(m_xColumnModel->getColumnCount() != 0)
+ {
+ Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
+ std::vector<Reference< XGridColumn > > aNewColumns(
+ comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
+ sal_Int32 fontHeight = pTable->PixelToLogic( Size( 0, pTable->GetTextHeight()+3 ), MAP_APPFONT ).Height();
+ if(m_xColumnModel->getColumnHeaderHeight() == 0)
+ {
+ m_pTableModel->setColumnHeaderHeight(fontHeight);
+ m_xColumnModel->setColumnHeaderHeight(fontHeight);
+ }
+ else
+ m_pTableModel->setColumnHeaderHeight(m_xColumnModel->getColumnHeaderHeight());
+ for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
+ Reference< XGridColumn > xGridColumn = m_xColumnModel->getColumn(col);
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ tableColumn->setHorizontalAlign(xGridColumn->getHorizontalAlign());
+ tableColumn->setWidth(xGridColumn->getColumnWidth());
+ if(xGridColumn->getPreferredWidth() != 0)
+ tableColumn->setPreferredWidth(xGridColumn->getPreferredWidth());
+ if(xGridColumn->getMaxWidth() != 0)
+ tableColumn->setMaxWidth(xGridColumn->getMaxWidth());
+ if(xGridColumn->getMinWidth() != 0)
+ tableColumn->setMinWidth(xGridColumn->getMinWidth());
+ tableColumn->setResizable(xGridColumn->getResizeable());
+ }
+ }
}
+ else
+ throw GridInvalidModelException(rtl::OUString::createFromAscii("The column model isn't set!"), m_xColumnModel);
+
break;
}
default:
@@ -281,7 +400,11 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
BASEPROPERTY_GRID_DATAMODEL,
BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND,
+ BASEPROPERTY_GRID_HEADER_BACKGROUND,
+ BASEPROPERTY_GRID_LINE_COLOR,
+ BASEPROPERTY_GRID_ROW_BACKGROUND,
0);
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
@@ -291,7 +414,6 @@ void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun:
if ( pTable )
{
pTable->SetModel(PTableModel(m_pTableModel));
- //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) );
pTable->Show( bVisible );
}
}
@@ -303,17 +425,32 @@ void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeEx
}
void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- std::vector<OUString> aNewRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
- if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount())
- aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
- m_pTableModel->getCellContent().push_back(aNewRow);
+ std::vector< Any > newRow;
+ Sequence< Any > rawRowData = Event.rowData;
+ int colCount = m_xColumnModel->getColumnCount();
+ if(colCount == 0)
+ {
+ Reference<XGridColumnListener> listener(*this,UNO_QUERY_THROW);
+ m_xColumnModel->setDefaultColumns(rawRowData.getLength());
+ for ( ::svt::table::ColPos col = 0; col < rawRowData.getLength(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn();
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ m_xColumnModel->getColumn(col)->addColumnListener(listener);
+ }
+
+ }
+ else if((unsigned int)rawRowData.getLength()!=(unsigned)colCount)
+ throw GridInvalidDataException(rtl::OUString::createFromAscii("The column count doesn't match with the length of row data"), m_xDataModel);
+
+ for ( int k = 0; k < rawRowData.getLength(); k++)
+ newRow.push_back(rawRowData[k]);
+ m_pTableModel->getCellContent().push_back(newRow);
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().push_back(Event.headerName);
- m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size());
+ m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false);
- //pTable->GrabFocus();
+ pTable->InvalidateDataWindow(m_pTableModel->getCellContent().size()-1, 0, false);
if(pTable->isAccessibleAlive())
{
pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
@@ -335,9 +472,10 @@ void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridD
void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
TableControl* pTable = (TableControl*)GetWindow();
- //unsigned int rows =m_pImpl->aCellContent.size()-1;
if(Event.index == -1)
{
+ if(!isSelectionEmpty())
+ deselectAllRows();
if(m_pTableModel->hasRowHeaders())
m_pTableModel->getRowHeaderName().clear();
m_pTableModel->getCellContent().clear();
@@ -348,76 +486,242 @@ void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::Gri
Any());
}
}
- else
+ else if(Event.index >= 0 && Event.index < m_pTableModel->getRowCount())
{
- pTable->removeSelectedRow(Event.index);
- if(m_pTableModel->getCellContent().size()>1)
+ if(isSelectedIndex(Event.index))
{
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
- m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index);
-
- }
- else
- {
- if(m_pTableModel->hasRowHeaders())
- m_pTableModel->getRowHeaderName().clear();
- m_pTableModel->getCellContent().clear();
- //m_pImpl->nRowCount=0;
+ Sequence<sal_Int32> selected(1);
+ selected[0]=Event.index;
+ deselectRows(selected);
}
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
+ std::vector<std::vector<Any> >::iterator rowPos =m_pTableModel->getCellContent().begin() + Event.index;
+ m_pTableModel->getCellContent().erase( rowPos );
}
- //pTable->InvalidateDataWindow(Event.index, true);
m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
- pTable->InvalidateDataWindow(Event.index, true);
+ pTable->InvalidateDataWindow(Event.index, Event.index, true);
if(pTable->isAccessibleAlive())
{
pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
Any());
- //pTable->commitGridControlEvent(CHILD,
- // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
- // Any());
- //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
- //{
- // pTable->commitGridControlEvent(
- // CHILD,
- // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
- // Any());
- //}
}
- //pTable->Invalidate();
}
+void SAL_CALL SVTXGridControl::columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(Event.valueName == rtl::OUString::createFromAscii("ColumnResize"))
+ {
+ bool resizable = m_pTableModel->getColumnModel()[Event.index]->isResizable();
+ Event.newValue>>=resizable;
+ m_pTableModel->getColumnModel()[Event.index]->setResizable(resizable);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("ColWidth"))
+ {
+ sal_Int32 colWidth = m_pTableModel->getColumnModel()[Event.index]->getWidth();
+ Event.newValue>>=colWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setWidth(colWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("MaxWidth"))
+ {
+ sal_Int32 maxWidth = m_pTableModel->getColumnModel()[Event.index]->getMaxWidth();
+ Event.newValue>>=maxWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setMaxWidth(maxWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("MinWidth"))
+ {
+ sal_Int32 minWidth = m_pTableModel->getColumnModel()[Event.index]->getMinWidth();
+ Event.newValue>>=minWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setMinWidth(minWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("PrefWidth"))
+ {
+ sal_Int32 prefWidth = m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth();
+ Event.newValue>>=prefWidth;
+ m_pTableModel->getColumnModel()[Event.index]->setPreferredWidth(prefWidth);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("HAlign"))
+ {
+ ::com::sun::star::style::HorizontalAlignment hAlign = m_pTableModel->getColumnModel()[Event.index]->getHorizontalAlign();
+ Event.newValue>>=hAlign;
+ m_pTableModel->getColumnModel()[Event.index]->setHorizontalAlign(hAlign);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("UpdateWidth"))
+ {
+ if(m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth() != 0)
+ m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("PrefWidth"), m_pTableModel->getColumnModel()[Event.index]->getPreferredWidth());
+ m_xColumnModel->getColumn(Event.index)->updateColumn(rtl::OUString::createFromAscii("ColWidth"), m_pTableModel->getColumnModel()[Event.index]->getWidth());
+ }
+ pTable->Invalidate();
+}
void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
{
- (void) Event;
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(Event.valueName == rtl::OUString::createFromAscii("RowHeight"))
+ {
+ sal_Int32 rowHeight = m_pTableModel->getRowHeight();
+ Event.newValue>>=rowHeight;
+ m_pTableModel->setRowHeight(rowHeight);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaderWidth"))
+ {
+ sal_Int32 rowHeaderWidth = m_pTableModel->getRowHeaderWidth();
+ Event.newValue>>=rowHeaderWidth;
+ m_pTableModel->setRowHeaderWidth(rowHeaderWidth);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowHeaders"))
+ {
+ Sequence< rtl::OUString > headers(0);
+ Event.newValue>>=headers;
+ std::vector< rtl::OUString > headerNames( comphelper::sequenceToContainer <std::vector< rtl::OUString > >(headers) );
+ m_pTableModel->setRowHeaderName(headerNames);
+ pTable->Invalidate();
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("CellUpdated"))
+ {
+ std::vector< std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
+ sal_Int32 col = -1;
+ Event.oldValue>>=col;
+ rowContent[Event.index][col] = Event.newValue;
+ pTable->InvalidateDataWindow(Event.index, Event.index, false);
+ }
+ else if(Event.valueName == rtl::OUString::createFromAscii("RowUpdated"))
+ {
+ std::vector<std::vector< Any > >& rowContent = m_pTableModel->getCellContent();
+ Sequence< sal_Int32 > cols(0);
+ Sequence< Any > values(0);
+ Event.oldValue>>=cols;
+ Event.newValue>>=values;
+ for(int i = 0; i< cols.getLength(); i++)
+ {
+ if(cols[i]>=0 && cols[i]<m_pTableModel->getColumnCount())
+ rowContent[Event.index][cols[i]]=values[i];
+ else
+ break;
+ }
+ pTable->InvalidateDataWindow(Event.index, Event.index, false);
+ }
}
- void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
+void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+{
VCLXWindow::disposing( Source );
- }
+}
::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
{
- return 0;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return -1;
+ else
+ {
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ return *(std::min_element(itStart, itEnd));
+ }
}
::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
{
- return 0;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return -1;
+ else
+ {
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ return *(std::max_element(itStart, itEnd));
+ }
+}
+
+void SAL_CALL SVTXGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ sal_Int32 start = rangeOfRows[0];
+ int seqSize = rangeOfRows.getLength();
+ sal_Int32 end = rangeOfRows[seqSize-1];
+ if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ if(eSelMode == SINGLE_SELECTION)
+ {
+ if(rangeOfRows.getLength() == 1)
+ selectedRows.push_back(start);
+ else
+ return;
+ }
+ else
+ {
+ for(int i=0;i<seqSize;i++)
+ selectedRows.push_back(rangeOfRows[i]);
+ }
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(start, end, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+ }
}
-void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- (void)length;
- (void)start;
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ for(int i=0;i<m_pTableModel->getRowCount();i++)
+ selectedRows.push_back(i);
+ pTable->Invalidate();
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+void SAL_CALL SVTXGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ std::vector<RowPos>::iterator itStart = selectedRows.begin();
+ std::vector<RowPos>::iterator itEnd = selectedRows.end();
+ sal_Int32 start = rangeOfRows[0];
+ sal_Int32 end = rangeOfRows[rangeOfRows.getLength()-1];
+ if((start >= 0 && start < m_pTableModel->getRowCount()) && (end >= 0 && end < m_pTableModel->getRowCount()))
+ {
+ std::vector<RowPos>::iterator iter = std::find(itStart, itEnd, start);
+ selectedRows.erase(iter, iter+(end-start)+1);
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(start, end, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
}
-void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
{
- (void)end;
- (void)start;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(!selectedRows.empty())
+ selectedRows.clear();
+ pTable->Invalidate();
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
}
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
@@ -435,21 +739,138 @@ void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int
::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
{
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(selectedRows.empty())
+ return sal_True;
+ else
+ return sal_False;
}
::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)index;
- return sal_False;
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end();
}
-void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
- (void)y;
+ if(index<0 || index>=m_pTableModel->getRowCount())
+ return;
+ TableControl* pTable = (TableControl*)GetWindow();
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ if(eSelMode != NO_SELECTION)
+ {
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ if(eSelMode == MULTIPLE_SELECTION)
+ {
+ if(!isSelectedIndex(index))
+ selectedRows.push_back(index);
+ else
+ return;
+ }
+ else if(eSelMode == SINGLE_SELECTION)
+ {
+ if(!selectedRows.empty())
+ {
+ if(!isSelectedIndex(index))
+ deselectRows(getSelection());
+ else
+ return;
+ }
+ selectedRows.push_back(index);
+ }
+ pTable->selectionChanged(true);
+ pTable->InvalidateDataWindow(index, index, false);
+ SetSynthesizingVCLEvent( sal_True );
+ pTable->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
}
void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
{
(void)x;
}
+void SVTXGridControl::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABLEROW_SELECT:
+ {
+ TableControl* pTable = (TableControl*)GetWindow();
+
+ if( pTable )
+ {
+ if ( m_aSelectionListeners.getLength() )
+ {
+ ImplCallItemListeners();
+ }
+ }
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+void SVTXGridControl::ImplCallItemListeners()
+{
+ TableControl* pTable = (TableControl*) GetWindow();
+ if ( pTable && m_aSelectionListeners.getLength() )
+ {
+ ::std::vector<sal_Int32> selRows = pTable->GetSelectedRows();
+ ::com::sun::star::awt::grid::GridSelectionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Column = 0;
+ sal_Int32 actSelRowCount = selRows.size();
+ sal_Int32 diff = actSelRowCount - m_nSelectedRowCount;
+ //row added to selection
+ if(diff >= 1)
+ {
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(0);
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Range = diff;
+ }
+ //selected row changed
+ else if(diff == 0)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ aEvent.Range = 0;
+ }
+ else
+ {
+ //selection changed: multiple row deselected, only 1 row is selected
+ if(actSelRowCount == 1)
+ {
+ aEvent.Row = selRows[actSelRowCount-1];
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(2);
+ }
+ //row is deselected
+ else
+ {
+ aEvent.Row = pTable->GetCurrentRow();
+ aEvent.Action = com::sun::star::awt::grid::SelectionEventType(1);
+ }
+ aEvent.Range = 0;
+ }
+ m_nSelectedRowCount=actSelRowCount;
+ m_aSelectionListeners.selectionChanged( aEvent );
+ }
+}
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 8e6931d0d805..bcb8badf72e5 100644..100755
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -32,21 +32,23 @@
#include <svtools/table/tablecontrol.hxx>
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/implbase2.hxx>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
-class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener>
+class SVTXGridControl : public ::cppu::ImplInheritanceHelper3< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
+ ::com::sun::star::awt::grid::XGridDataListener, ::com::sun::star::awt::grid::XGridColumnListener>
{
private:
UnoControlTableModel* m_pTableModel;
@@ -56,34 +58,42 @@ private:
bool m_bHasRowHeaders;
bool m_bVScroll;
bool m_bHScroll;
+ bool m_bUpdate;
+ sal_Int32 m_nSelectedRowCount;
+ SelectionListenerMultiplexer m_aSelectionListeners;
+
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ void ImplCallItemListeners();
public:
- SVTXGridControl();
+ SVTXGridControl();
~SVTXGridControl();
//XGridDataListener overridables
virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+
+ //XGridColumnListener overridables
+ virtual void SAL_CALL columnChanged(const ::com::sun::star::awt::grid::GridColumnEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() { VCLXWindow::release(); }
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
+ void SAL_CALL release() throw() { VCLXWindow::release(); }
// ::com::sun::star::lang::XTypeProvider
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
//::com::sun::star::awt::grid::XGridControl
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
-
virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
@@ -93,11 +103,15 @@ public:
virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
};
#endif // _SVT_GRIDCONTROL_HXX_
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index febb187fb289..d239ee3c740d 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -42,21 +42,32 @@
using ::rtl::OUString;
using namespace ::svt::table;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
:m_nID( 0 )
,m_sName()
- ,m_bIsResizable( false )
- ,m_nWidth( 10 * 100 ) // 1 cm
- ,m_nMinWidth( 0 ) // no min width
- ,m_nMaxWidth( 0 ) // no max width
+ ,m_bIsResizable( true )
+ ,m_nWidth( 4 )
+ ,m_nMinWidth( 0 )
+ ,m_nMaxWidth( 0 )
+ ,m_nPrefWidth ( 0 )
+ ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
+ {
+ m_sName = m_xGridColumn->getTitle();
+ }
+ //--------------------------------------------------------------------
+ UnoControlTableColumn::UnoControlTableColumn()
+ :m_nID( 0 )
+ ,m_sName()
+ ,m_bIsResizable( true )
+ ,m_nWidth( 4 )
+ ,m_nMinWidth( 0 )
+ ,m_nMaxWidth( 0 )
+ ,m_nPrefWidth ( 0 )
+ ,m_xHorizontalAlign(com::sun::star::style::HorizontalAlignment(0))
{
- //m_nID = m_xGridColumn->getIdentifier();
- //m_nWidth = m_xGridColumn->getColumnWidth();
- m_sName = m_xGridColumn->getTitle();
}
//--------------------------------------------------------------------
@@ -68,11 +79,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
bool UnoControlTableColumn::setID( const ColumnID _nID )
{
- // TODO: conflict check
-
m_nID = _nID;
- // TODO: notifications?
-
return true;
}
@@ -86,9 +93,7 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setName( const String& _rName )
{
m_sName = _rName;
- // TODO: notifications?
}
-
//--------------------------------------------------------------------
bool UnoControlTableColumn::isResizable() const
{
@@ -99,7 +104,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setResizable( bool _bResizable )
{
m_bIsResizable = _bResizable;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -112,7 +116,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setWidth( TableMetrics _nWidth )
{
m_nWidth = _nWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -125,7 +128,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMinWidth( TableMetrics _nMinWidth )
{
m_nMinWidth = _nMinWidth;
- // TODO: notifications?
}
//--------------------------------------------------------------------
@@ -138,7 +140,28 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableColumn::setMaxWidth( TableMetrics _nMaxWidth )
{
m_nMaxWidth = _nMaxWidth;
- // TODO: notifications?
+ }
+ //--------------------------------------------------------------------
+ TableMetrics UnoControlTableColumn::getPreferredWidth() const
+ {
+ return m_nPrefWidth;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setPreferredWidth( TableMetrics _nPrefWidth )
+ {
+ m_nPrefWidth = _nPrefWidth;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::HorizontalAlignment UnoControlTableColumn::getHorizontalAlign()
+ {
+ return m_xHorizontalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableColumn::setHorizontalAlign( com::sun::star::style::HorizontalAlignment _align )
+ {
+ m_xHorizontalAlign = _align;
}
//====================================================================
@@ -146,30 +169,46 @@ using namespace ::com::sun::star::awt::grid;
//====================================================================
struct UnoControlTableModel_Impl
{
- ::std::vector< PColumnModel >& aColumns;
+ ::std::vector< PColumnModel > aColumns;
TableSize nRowCount;
bool bHasColumnHeaders;
bool bHasRowHeaders;
+ bool bVScroll;
+ bool bHScroll;
PTableRenderer pRenderer;
PTableInputHandler pInputHandler;
TableMetrics nRowHeight;
TableMetrics nColumnHeaderHeight;
TableMetrics nRowHeaderWidth;
- std::vector<rtl::OUString>& aRowHeadersTitle;
- std::vector<std::vector<rtl::OUString> >& aCellContent;
+ std::vector<rtl::OUString> aRowHeadersTitle;
+ std::vector<std::vector< Any > > aCellContent;
+ ::com::sun::star::util::Color m_xLineColor;
+ ::com::sun::star::util::Color m_xHeaderColor;
+ ::com::sun::star::util::Color m_xTextColor;
+ ::com::sun::star::util::Color m_xRowColor1;
+ ::com::sun::star::util::Color m_xRowColor2;
+ ::com::sun::star::style::VerticalAlignment m_xVerticalAlign;
UnoControlTableModel_Impl()
- :aColumns ( *(new std::vector< PColumnModel> (0)))
- ,nRowCount ( 0 )
+ :aColumns ( )
+ ,nRowCount ( 0 )
,bHasColumnHeaders ( false )
,bHasRowHeaders ( false )
+ ,bVScroll ( false )
+ ,bHScroll ( false )
,pRenderer ( )
,pInputHandler ( )
- ,nRowHeight ( 4 * 100 ) // 40 mm
- ,nColumnHeaderHeight( 5 * 100 ) // 50 mm
- ,nRowHeaderWidth ( 10 * 100 ) // 50 mm
- ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0)))
- ,aCellContent ( *(new std::vector<std::vector<OUString> >(0)))
+ ,nRowHeight ( 0 )
+ ,nColumnHeaderHeight( 0 )
+ ,nRowHeaderWidth ( 10 )
+ ,aRowHeadersTitle ( )
+ ,aCellContent ( )
+ ,m_xLineColor ( 0xFFFFFF )
+ ,m_xHeaderColor ( 0xFFFFFF )
+ ,m_xTextColor ( 0 )//black as default
+ ,m_xRowColor1 ( 0xFFFFFF )
+ ,m_xRowColor2 ( 0xFFFFFF )
+ ,m_xVerticalAlign (com::sun::star::style::VerticalAlignment(0))
{
}
};
@@ -196,7 +235,6 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
TableSize UnoControlTableModel::getColumnCount() const
{
- //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
return (TableSize)m_pImpl->aColumns.size();
}
@@ -250,7 +288,6 @@ using namespace ::com::sun::star::awt::grid;
void UnoControlTableModel::addTableModelListener( const PTableModelListener& listener )
{
(void) listener;
- //listener->onTableModelChanged(PTableModel(this));
// TODO
DBG_ERROR( "DefaultTableModel::addTableModelListener: not yet implemented!" );
}
@@ -321,6 +358,17 @@ using namespace ::com::sun::star::awt::grid;
DBG_ASSERT( hasRowHeaders(), "DefaultTableModel::getRowHeaderWidth: invalid call!" );
return m_pImpl->nRowHeaderWidth;
}
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setColumnHeaderHeight(TableMetrics _nHeight)
+ {
+ m_pImpl->nColumnHeaderHeight = _nHeight;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setRowHeaderWidth(TableMetrics _nWidth)
+ {
+ m_pImpl->nRowHeaderWidth = _nWidth;
+ }
//--------------------------------------------------------------------
void UnoControlTableModel::SetTitleHeight( TableMetrics _nHeight )
@@ -341,7 +389,7 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
{
- if(overAllHeight>=actHeight)// && !m_bVScroll)
+ if(overAllHeight>=actHeight && !m_pImpl->bVScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -350,59 +398,116 @@ using namespace ::com::sun::star::awt::grid;
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
{
- if(overAllWidth>=actWidth)// && !m_bHScroll)
+ if(overAllWidth>=actWidth && !m_pImpl->bHScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
}
//--------------------------------------------------------------------
- void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)
+ void UnoControlTableModel::setVerticalScrollbarVisibility(bool _bVScroll) const
{
- //if(cellContent.empty())
- //{
- // unsigned int i = m_pImpl->aColumns.size();
- // std::vector<rtl::OUString>& emptyCells;
- // while(i!=0)
- // {
- // cellContent.push_back(emptyCells);
- // --i;
- // }
- //}
- //std::vector<rtl::OUString> cCC;
- //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
- //{
- // cCC = *iter;
- // m_pImpl->aCellContent.push_back(cCC);
- //}
- m_pImpl->aCellContent.swap( cellContent );
+ m_pImpl->bVScroll = _bVScroll;
}
- std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent()
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHorizontalScrollbarVisibility(bool _bHScroll) const
{
- return m_pImpl->aCellContent;
+ m_pImpl->bHScroll = _bHScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasVerticalScrollbar()
+ {
+ return m_pImpl->bVScroll;
+ }
+ //--------------------------------------------------------------------
+ bool UnoControlTableModel::hasHorizontalScrollbar()
+ {
+ return m_pImpl->bHScroll;
+ }
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setCellContent(const std::vector<std::vector< Any > >& cellContent)
+ {
+ m_pImpl->aCellContent = cellContent;
}
+ std::vector<std::vector< Any > >& UnoControlTableModel::getCellContent()
+ {
+ return m_pImpl->aCellContent;
+ }
//--------------------------------------------------------------------
- void UnoControlTableModel::setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)
+ void UnoControlTableModel::setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent)
{
- if(cellColumnContent.empty())
- {
- unsigned int i = m_pImpl->aColumns.size();
- while(i!=0)
- {
- cellColumnContent.push_back(rtl::OUString::createFromAscii(""));
- --i;
- }
- }
- for(::std::vector<rtl::OUString>::iterator iter = cellColumnContent.begin(); iter!= cellColumnContent.end();++iter)
- {
- rtl::OUString s = *iter;
- m_pImpl->aRowHeadersTitle.push_back(*iter);
- }
+ m_pImpl->aRowHeadersTitle = cellColumnContent;
}
std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
{
return m_pImpl->aRowHeadersTitle;
}
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getLineColor()
+ {
+ return m_pImpl->m_xLineColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xLineColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor()
+ {
+ return m_pImpl->m_xHeaderColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xHeaderColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getTextColor()
+ {
+ return m_pImpl->m_xTextColor;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xTextColor = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor1;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor1 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor()
+ {
+ return m_pImpl->m_xRowColor2;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ {
+ m_pImpl->m_xRowColor2 = _rColor;
+ }
+ //--------------------------------------------------------------------
+ ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign()
+ {
+ return m_pImpl->m_xVerticalAlign;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoControlTableModel::setVerticalAlign( com::sun::star::style::VerticalAlignment _xAlign )
+ {
+ m_pImpl->m_xVerticalAlign = _xAlign;
+ }
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 5be4ff2a16f7..c00642448f79 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -41,7 +41,9 @@
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-//#include <toolkit/helper/listenermultiplexer.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using namespace ::svt::table;
@@ -49,7 +51,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
class UnoControlTableColumn : public IColumnModel
- {
+{
private:
ColumnID m_nID;
String m_sName;
@@ -57,9 +59,12 @@ class UnoControlTableColumn : public IColumnModel
TableMetrics m_nWidth;
TableMetrics m_nMinWidth;
TableMetrics m_nMaxWidth;
+ TableMetrics m_nPrefWidth;
+ ::com::sun::star::style::HorizontalAlignment m_xHorizontalAlign;
public:
UnoControlTableColumn(Reference<XGridColumn>);
+ UnoControlTableColumn();
// IColumnModel overridables
virtual ColumnID getID() const;
@@ -74,12 +79,16 @@ class UnoControlTableColumn : public IColumnModel
virtual void setMinWidth( TableMetrics _nMinWidth );
virtual TableMetrics getMaxWidth() const;
virtual void setMaxWidth( TableMetrics _nMaxWidth );
- };
+ virtual TableMetrics getPreferredWidth() const;
+ virtual void setPreferredWidth( TableMetrics _nPrefWidth );
+ virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
+ virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
+};
- struct UnoControlTableModel_Impl;
+struct UnoControlTableModel_Impl;
- class UnoControlTableModel : public ITableModel
- {
+class UnoControlTableModel : public ITableModel
+{
private:
UnoControlTableModel_Impl* m_pImpl;
@@ -91,6 +100,10 @@ class UnoControlTableColumn : public IColumnModel
inline TableMetrics GetRowHeight() const { return getRowHeight(); }
/// sets a new row height.
void setRowHeight( TableMetrics _nHeight );
+ /// sets a new row header width.
+ void setRowHeaderWidth( TableMetrics _nWidth );
+ /// sets a new column header height.
+ void setColumnHeaderHeight( TableMetrics _nHeight );
/// returns the height of the title row (containing the column headers)
inline TableMetrics GetTitleHeight() const { return getColumnHeaderHeight(); }
@@ -107,23 +120,21 @@ class UnoControlTableColumn : public IColumnModel
/// retrieves the width of a column, in 1/100th millimeters
inline TableMetrics GetColumnWidth( ColPos _nColumn );
- // TODO: setters and getters for ID, Name, Resizable, MinWidth, MaxWidth
-
public:
// ITableModel overridables
virtual TableSize getColumnCount() const;
virtual TableSize getRowCount() const;
- virtual void setColumnCount(TableSize _nColCount);
+ virtual void setColumnCount(TableSize _nColCount);
virtual void setRowCount(TableSize _nRowCount);
virtual bool hasColumnHeaders() const;
virtual bool hasRowHeaders() const;
- virtual void setRowHeaders(bool _bRowHeaders);
- virtual void setColumnHeaders(bool _bColumnHeaders);
+ virtual void setRowHeaders(bool _bRowHeaders);
+ virtual void setColumnHeaders(bool _bColumnHeaders);
virtual bool isCellEditable( ColPos col, RowPos row ) const;
virtual void addTableModelListener( const PTableModelListener& listener );
virtual void removeTableModelListener( const PTableModelListener& listener );
virtual PColumnModel getColumnModel( ColPos column );
- virtual std::vector<PColumnModel>& getColumnModel();
+ virtual std::vector<PColumnModel>& getColumnModel();
virtual PColumnModel getColumnModelByID( ColumnID id );
virtual PTableRenderer getRenderer() const;
virtual PTableInputHandler getInputHandler() const;
@@ -132,19 +143,35 @@ class UnoControlTableColumn : public IColumnModel
virtual TableMetrics getRowHeaderWidth() const;
virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
- virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent);
- virtual std::vector<std::vector<rtl::OUString> >& getCellContent();
- virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent);
- virtual std::vector<rtl::OUString>& getRowHeaderName();
- };
-
- inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
- {
+ virtual void setVerticalScrollbarVisibility(bool _bVScroll) const;
+ virtual void setHorizontalScrollbarVisibility(bool _bHScroll) const;
+ virtual void setCellContent(const std::vector<std::vector< Any > >& cellContent);
+ virtual std::vector<std::vector< Any > >& getCellContent();
+ virtual void setRowHeaderName(const std::vector<rtl::OUString>& cellColumnContent);
+ virtual std::vector<rtl::OUString>& getRowHeaderName();
+ virtual ::com::sun::star::util::Color getLineColor();
+ virtual void setLineColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getHeaderBackgroundColor();
+ virtual void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getTextColor();
+ virtual void setTextColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getOddRowBackgroundColor();
+ virtual void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::util::Color getEvenRowBackgroundColor();
+ virtual void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor);
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign();
+ virtual void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
+ virtual bool hasVerticalScrollbar();
+ virtual bool hasHorizontalScrollbar();
+};
+
+inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
+{
getColumnModel( _nColumn )->setWidth( _nWidth100thMM );
- }
+}
- inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
- {
- return getColumnModel( _nColumn )->getWidth();
- }
+inline TableMetrics UnoControlTableModel::GetColumnWidth( ColPos _nColumn )
+{
+ return getColumnModel( _nColumn )->getWidth();
+}
#endif // _UNOCONTROL_TABLEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
index 65e555f9d799..b9fb82c3d4bb 100644
--- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -54,7 +54,7 @@
#include <osl/mutex.hxx>
#include <toolkit/helper/mutexhelper.hxx>
#include <toolkit/helper/macros.hxx>
-
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
// ----------------------------------------------------
// class ListenerMultiplexerBase
// ----------------------------------------------------
@@ -244,8 +244,12 @@ DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::
virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException);
DECL_LISTENERMULTIPLEXER_END
-
-
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+ void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index d9adc182f4d7..d5f484145316 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -196,6 +196,10 @@ namespace rtl {
#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
#define BASEPROPERTY_REFERENCE_DEVICE 146
#define BASEPROPERTY_HIGHCONTRASTMODE 147
+#define BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND 148
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 149
+#define BASEPROPERTY_GRID_LINE_COLOR 150
+#define BASEPROPERTY_GRID_ROW_BACKGROUND 151
// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl
index 6f57f37536a2..429d7693c833 100644
--- a/toolkit/qa/unoapi/knownissues.xcl
+++ b/toolkit/qa/unoapi/knownissues.xcl
@@ -240,3 +240,13 @@ toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText
toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue
toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster
toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection
+
+### i111076 ###
+toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess
+
+### i111113 ###
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext
+
+### i111195 ###
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleValue
diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce
index 1c8ad0c95181..5a148feee573 100644
--- a/toolkit/qa/unoapi/toolkit.sce
+++ b/toolkit/qa/unoapi/toolkit.sce
@@ -8,14 +8,14 @@
#i86110 -o toolkit.AccessibleList
#i86110 -o toolkit.AccessibleListBox
#i86110 -o toolkit.AccessibleListItem
--o toolkit.AccessibleMenu
--o toolkit.AccessibleMenuBar
+#i111047# -o toolkit.AccessibleMenu
+#i111047# -o toolkit.AccessibleMenuBar
#i86009 -o toolkit.AccessibleMenuItem
--o toolkit.AccessibleMenuSeparator
+#i111047# -o toolkit.AccessibleMenuSeparator
#i52607 -o toolkit.AccessiblePopupMenu
#i86107,i86110 -o toolkit.AccessibleRadioButton
-o toolkit.AccessibleScrollBar
--o toolkit.AccessibleStatusBar
+#i111225 -o toolkit.AccessibleStatusBar
-o toolkit.AccessibleStatusBarItem
#i109643 -o toolkit.AccessibleTabControl
#i109643 -o toolkit.AccessibleTabPage
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index fdf91d6a6593..011f3502cdd8 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -30,6 +30,7 @@
#include "defaultgridcolumnmodel.hxx"
#include <comphelper/sequence.hxx>
#include <toolkit/helper/servicenames.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <rtl/ref.hxx>
using ::rtl::OUString;
@@ -38,8 +39,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
-
-#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
+using namespace ::com::sun::star::style;
namespace toolkit
{
@@ -48,8 +48,10 @@ namespace toolkit
// class DefaultGridColumnModel
///////////////////////////////////////////////////////////////////////
-DefaultGridColumnModel::DefaultGridColumnModel()
+DefaultGridColumnModel::DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory)
: columns(std::vector< Reference< XGridColumn > >())
+ ,m_nColumnHeaderHeight(0)
+ ,m_xFactory(xFactory)
{
}
@@ -61,71 +63,6 @@ DefaultGridColumnModel::~DefaultGridColumnModel()
//---------------------------------------------------------------------
-void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent )
-{
- ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
- if( pIter )
- {
- ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
- while(aListIter.hasMoreElements())
- {
- XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
- switch( eType )
- {
- case column_added: pListener->columnAdded(aEvent); break;
- case column_removed: pListener->columnRemoved(aEvent); break;
- case column_changed: pListener->columnChanged(aEvent); break;
- }
- }
- }
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_added, aEvent);
-}
-
-//---------------------------------------------------------------------
-
-void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
-{
- Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
- broadcast( column_changed, aEvent);
-}
-
-//---------------------------------------------------------------------
-// XDefaultGridColumnModel
-//---------------------------------------------------------------------
-::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException)
-{
- return selectionAllowed;
-}
-
-//---------------------------------------------------------------------
-
-void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
-{
- sal_Bool oldValue = selectionAllowed;
- selectionAllowed = value;
- broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed));
-}
-
-//---------------------------------------------------------------------
-
::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
{
return columns.size();
@@ -136,11 +73,10 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
- columns.push_back(column);
-
+ Reference<XGridColumn> xColumn(column);
+ columns.push_back(xColumn);
sal_Int32 index = columns.size() - 1;
- broadcast_add(index, column );
+ xColumn->setIndex(index);
return index;
}
@@ -156,23 +92,48 @@ void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value
::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
{
if ( index >=0 && index < ((sal_Int32)columns.size()))
+ {
return columns[index];
+ }
else
return Reference< XGridColumn >();
}
-
-void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setColumnHeaderHeight(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_nColumnHeaderHeight = _value;
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnHeaderHeight() throw (::com::sun::star::uno::RuntimeException)
{
- BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+ return m_nColumnHeaderHeight;
}
//---------------------------------------------------------------------
+void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ for(sal_Int32 i=0;i<rowElements;i++)
+ {
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ columns.push_back(xColumn);
+ xColumn->setIndex(i);
+ }
+}
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
{
- BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
+ Reference<XGridColumn> xColumn( m_xFactory->createInstance ( OUString::createFromAscii( "com.sun.star.awt.grid.GridColumn" ) ), UNO_QUERY );
+ xColumn->setColumnWidth(column->getColumnWidth());
+ xColumn->setPreferredWidth(column->getPreferredWidth());
+ xColumn->setMaxWidth(column->getMaxWidth());
+ xColumn->setMinWidth(column->getMinWidth());
+ xColumn->setPreferredWidth(column->getPreferredWidth());
+ xColumn->setResizeable(column->getResizeable());
+ xColumn->setTitle(column->getTitle());
+ xColumn->setHorizontalAlign(column->getHorizontalAlign());
+ return xColumn;
}
-
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -232,8 +193,8 @@ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString
}
-Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& _rFactory)
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
index 896427ce3e2b..8b8c8bfc795c 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -29,7 +29,7 @@
#include "precompiled_toolkit.hxx"
#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/XGridColumn.hpp>
-#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
+//#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -38,6 +38,9 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -49,45 +52,49 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
-enum broadcast_type { column_added, column_removed, column_changed};
+//enum broadcast_type { column_added, column_removed, column_changed};
class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
public MutexAndBroadcastHelper
{
public:
- DefaultGridColumnModel();
+ DefaultGridColumnModel(const Reference< XMultiServiceFactory >& xFactory);
virtual ~DefaultGridColumnModel();
// XGridColumnModel
- virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ //virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
- virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
-
+ //virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ //virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL setColumnHeaderHeight( sal_Int32 _value) throw (com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getColumnHeaderHeight() throw (com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL copyColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
- virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
- void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ /*void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue, sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
- void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+ void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );*/
std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
sal_Bool selectionAllowed;
+ sal_Int32 m_nColumnHeaderHeight;
+ Reference< XMultiServiceFactory > m_xFactory;
};
}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index 70c79e0bcbfa..7ffafdf0ddb6 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -41,6 +41,9 @@ using namespace ::com::sun::star::lang;
#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
+#define CELLUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "CellUpdated" ))
+#define ROWUPDATED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowUpdated" ))
+#define ROWHEADERWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaderWidth" ))
namespace toolkit
{
@@ -51,7 +54,8 @@ namespace toolkit
DefaultGridDataModel::DefaultGridDataModel()
: rowHeight(0),
- rowHeaders(std::vector< ::rtl::OUString >())
+ rowHeaders(std::vector< ::rtl::OUString >()),
+ m_nRowHeaderWidth(10)
{
}
@@ -61,7 +65,7 @@ DefaultGridDataModel::~DefaultGridDataModel()
{
}
-void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
if( pIter )
@@ -82,25 +86,27 @@ void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent&
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, index, ::rtl::OUString(), Sequence< Any >());
broadcast( data_changed, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
- GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, (const ::com::sun::star::uno::Sequence< Any >&)rowData );
broadcast( row_added, aEvent);
}
//---------------------------------------------------------------------
-void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName,
+ ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException)
{
Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
@@ -124,7 +130,7 @@ void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com
sal_Int32 oldValue = rowHeight;
rowHeight = value;
- broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) );
+ broadcast_changed( ROWHEIGHT, 0, Any(oldValue), Any(value));
}
//---------------------------------------------------------------------
@@ -160,24 +166,26 @@ void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::S
i++;
}
- broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
+ broadcast_changed( ROWHEADERS, 0, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
}
//---------------------------------------------------------------------
-void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
{
// store header name
rowHeaders.push_back(headername);
-
// store row data
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata));
+ std::vector< Any > newRow;
+ for ( int i = 0; i < rRowdata.getLength();i++)
+ {
+ newRow.push_back(rRowdata[i]);
+ }
data.push_back( newRow );
- broadcast_add( data.size()-1, headername, rRowdata);
+ broadcast_add( data.size()-1, headername, comphelper::containerToSequence(newRow));
}
@@ -187,16 +195,10 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
{
if ( index >= 0 && index <= getRowCount()-1)
{
- /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ))
- {
- ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
- selectedRow.erase(selectedRows.begin()+index);
- }*/
-
::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
rowHeaders.erase(rowHeaders.begin() + index);
- Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ Sequence< Any >& rowData ( (Sequence< Any >&)data[index] );
data.erase(data.begin() + index);
broadcast_remove( index, headerName, rowData);
}
@@ -204,19 +206,19 @@ void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::s
return;
}
//---------------------------------------------------------------------
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
{
- std::vector< std::vector< ::rtl::OUString > >::iterator iterator;
- std::vector< Sequence< ::rtl::OUString > > dummyContainer(0);
+ std::vector< std::vector< Any > >::iterator iterator;
+ std::vector< Sequence< Any > > dummyContainer(0);
for(iterator = data.begin(); iterator != data.end(); iterator++)
{
- Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ Sequence< Any > cols(comphelper::containerToSequence(*iterator));
dummyContainer.push_back( cols );
}
- Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+ Sequence< Sequence< Any > > dataSequence(comphelper::containerToSequence(dummyContainer));
return dataSequence;
}
@@ -234,14 +236,52 @@ void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDa
{
BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
}
-
+//---------------------------------------------------------------------
void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
{
rowHeaders.clear();
data.clear();
broadcast_remove( -1, ::rtl::OUString(), 0);
}
-
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 oldValue = m_nRowHeaderWidth;
+ m_nRowHeaderWidth = _value;
+ broadcast_changed( ROWHEADERWIDTH, 0, Any(oldValue), Any(_value) );
+}
+//---------------------------------------------------------------------
+sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nRowHeaderWidth;
+}
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::updateCell(::sal_Int32 row, ::sal_Int32 column, const Any& value) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(row >= 0 && row < (signed)data.size())
+ {
+ if(column >= 0 && column < (signed)data[0].size())
+ {
+ data[row][column] = value;
+ Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
+ broadcast_changed( CELLUPDATED, row, Any(column), value );
+ }
+ }
+}
+//---------------------------------------------------------------------
+void SAL_CALL DefaultGridDataModel::updateRow(::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 > & columns, const ::com::sun::star::uno::Sequence< Any > & values) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(row >= 0 && row < (signed)data.size())
+ {
+ if(columns.getLength() == values.getLength())
+ {
+ for(int i = 0; i < columns.getLength(); i++)
+ data[row][i] = values[i];
+ Sequence< Any >dataSeq(comphelper::containerToSequence(data[row]));
+ broadcast_changed( ROWUPDATED, row, Any(columns), Any(values) );
+ }
+ }
+}
//---------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------
@@ -302,6 +342,5 @@ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString&
Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
{
- return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel() );
}
-
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
index 1aebc07bc2a8..ea11a8a9a00a 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.hxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -30,6 +30,7 @@
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
#include <com/sun/star/awt/grid/GridDataEvent.hpp>
#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -64,13 +65,16 @@ public:
virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< Any > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< Any > & data) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeAll() throw (RuntimeException);
-
+ virtual void SAL_CALL setRowHeaderWidth(sal_Int32 _value) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getRowHeaderWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCell( ::sal_Int32 row, ::sal_Int32 column, const ::com::sun::star::uno::Any& value ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRow( ::sal_Int32 row, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& values ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
@@ -83,14 +87,15 @@ public:
private:
- void broadcast( broadcast_type eType, const GridDataEvent& aEvent );
- void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
- void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
- void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+ void broadcast( broadcast_type eType, const GridDataEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_changed( ::rtl::OUString name, sal_Int32 index, Any oldValue, Any newValue ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
+ void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< Any > rowData ) throw (::com::sun::star::uno::RuntimeException);
sal_Int32 rowHeight;
- std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< std::vector < Any > > data;
std::vector< ::rtl::OUString > rowHeaders;
+ sal_Int32 m_nRowHeaderWidth;
};
}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 39c4960351d3..6720d639f5c1 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -38,6 +38,16 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::awt::grid;
using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::style;
+
+#define COLWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColWidth" ))
+#define MAXWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MaxWidth" ))
+#define MINWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ))
+#define PREFWIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PrefWidth" ))
+#define HALIGN ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HAlign" ))
+#define TITLE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ))
+#define COLRESIZE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnResize" ))
+#define UPDATE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UpdateWidth" ))
namespace toolkit
{
@@ -48,6 +58,13 @@ namespace toolkit
GridColumn::GridColumn()
: identifier(Any())
+,index(0)
+,columnWidth(4)
+,preferredWidth(0)
+,maxWidth(0)
+,minWidth(0)
+,bResizeable(true)
+,horizontalAlign(HorizontalAlignment(0))
{
}
@@ -59,6 +76,39 @@ GridColumn::~GridColumn()
//---------------------------------------------------------------------
+void GridColumn::broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
+ switch( eType )
+ {
+ case column_attribute_changed: pListener->columnChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void GridColumn::broadcast_changed(::rtl::OUString name, Any oldValue, Any newValue)
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, name, oldValue, newValue, index);
+ broadcast( column_attribute_changed, aEvent);
+}
+
+void SAL_CALL GridColumn::updateColumn(const ::rtl::OUString& name, sal_Int32 width) throw (::com::sun::star::uno::RuntimeException)
+{
+ if(PREFWIDTH == name)
+ preferredWidth = width;
+ else if (COLWIDTH == name)
+ columnWidth = width;
+}
//---------------------------------------------------------------------
// XGridColumn
//---------------------------------------------------------------------
@@ -79,6 +129,7 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
{
+ broadcast_changed(UPDATE, Any(columnWidth), Any());
return columnWidth;
}
@@ -87,6 +138,50 @@ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value
void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
{
columnWidth = value;
+ broadcast_changed(COLWIDTH, Any(columnWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ broadcast_changed(UPDATE, Any(preferredWidth), Any());
+ return preferredWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ preferredWidth = value;
+ broadcast_changed(PREFWIDTH, Any(preferredWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return maxWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ maxWidth = value;
+ broadcast_changed(MAXWIDTH, Any(maxWidth),Any(value));
+}
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return minWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ minWidth = value;
+ broadcast_changed(MINWIDTH, Any(minWidth),Any(value));
}
//--------------------------------------------------------------------
@@ -101,6 +196,45 @@ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::s
void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
{
title = value;
+ broadcast_changed(TITLE, Any(title),Any(value));
+}
+//--------------------------------------------------------------------
+
+sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
+{
+ return bResizeable;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+{
+ bResizeable = value;
+ broadcast_changed(COLRESIZE, Any(bResizeable),Any(value));
+}
+//---------------------------------------------------------------------
+HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
+{
+ return horizontalAlign;
+}
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
+{
+ horizontalAlign = align;
+ broadcast_changed(HALIGN, Any(horizontalAlign),Any(align));
+}
+//---------------------------------------------------------------------
+void SAL_CALL GridColumn::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
}
//---------------------------------------------------------------------
@@ -109,22 +243,30 @@ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::
void SAL_CALL GridColumn::dispose() throw (RuntimeException)
{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
}
//---------------------------------------------------------------------
void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
- (void) xListener;
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+void SAL_CALL GridColumn::setIndex(sal_Int32 _nIndex) throw (::com::sun::star::uno::RuntimeException)
+{
+ index = _nIndex;
}
-
//---------------------------------------------------------------------
// XServiceInfo
//---------------------------------------------------------------------
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index 7f6d104127ec..38d43d55a07b 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -28,6 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_toolkit.hxx"
#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -36,6 +38,7 @@
#include <rtl/ref.hxx>
#include <vector>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <com/sun/star/style/HorizontalAlignment.hpp>
using ::rtl::OUString;
using namespace ::com::sun::star;
@@ -47,6 +50,7 @@ using namespace ::com::sun::star::lang;
namespace toolkit
{
+enum broadcast_column_type { column_attribute_changed};
class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
public MutexAndBroadcastHelper
{
@@ -59,9 +63,21 @@ public:
virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
-
+ virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateColumn( const ::rtl::OUString& name, ::sal_Int32 width ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
@@ -72,11 +88,20 @@ public:
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
-
+ virtual void SAL_CALL setIndex(sal_Int32 _nIndex)throw (::com::sun::star::uno::RuntimeException);
private:
+ void broadcast( broadcast_column_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue);
+
Any identifier;
+ sal_Int32 index;
sal_Int32 columnWidth;
+ sal_Int32 preferredWidth;
+ sal_Int32 maxWidth;
+ sal_Int32 minWidth;
+ sal_Bool bResizeable;
::rtl::OUString title;
+ ::com::sun::star::style::HorizontalAlignment horizontalAlign;
};
}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
index f19648ab0af2..5125c1349ade 100644
--- a/toolkit/source/controls/grid/gridcontrol.cxx
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/view/SelectionType.hpp>
#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
#include <toolkit/helper/unopropertyarrayhelper.hxx>
#include <toolkit/helper/property.hxx>
@@ -68,12 +69,21 @@ UnoGridModel::UnoGridModel()
ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
ImplRegisterProperty( BASEPROPERTY_HSCROLL );
ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
-
+ ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
+ ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+ ImplRegisterProperty( BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND );
}
UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
@@ -99,6 +109,22 @@ Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
case BASEPROPERTY_GRID_SELECTIONMODE:
return uno::makeAny( SelectionType(1) );
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_GRID_DATAMODEL:
+ return uno::makeAny( Reference<XGridDataModel> ());
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ return uno::makeAny(Reference<XGridColumnModel>() );
+ case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ return uno::makeAny( com::sun::star::util::Color(0xFFFFFF) );
+ case BASEPROPERTY_GRID_ROW_BACKGROUND:
+ return uno::makeAny(com::sun::star::util::Color(0xFFFFFF) );
default:
return UnoControlModel::ImplGetDefaultValue( nPropId );
}
@@ -128,7 +154,8 @@ Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(Runtime
// class UnoGridControl
// ----------------------------------------------------
UnoGridControl::UnoGridControl()
-: mSelectionMode(SelectionType(1))
+: mSelectionMode(SelectionType(1)),
+ m_aSelectionListeners( *this )
{
}
@@ -139,6 +166,9 @@ OUString UnoGridControl::GetComponentServiceName()
void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aEvt );
UnoControl::dispose();
}
@@ -147,63 +177,39 @@ void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolk
UnoControlBase::createPeer( rxToolkit, rParentPeer );
Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+ xGrid->addSelectionListener(&m_aSelectionListeners);
Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
+ Reference<XGridColumnListener> xColListener ( getPeer(), UNO_QUERY_THROW );
Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
- xGridDataModel->addDataListener(xListener);
+ if(xGridDataModel != NULL)
+ xGridDataModel->addDataListener(xListener);
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+ if(xGridColumnModel != NULL)
+ {
+ for(int i = 0;i<xGridColumnModel->getColumnCount();i++)
+ {
+ xGridColumnModel->getColumn(i)->addColumnListener(xColListener);
+ }
+ }
}
// -------------------------------------------------------------------
// XGridControl
-// -------------------------------------------------------------------
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
-
- return xGridColumnModel;
-}
-
-void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model));
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
-
- return xGridDataModel;
-}
-
-void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
- xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
-}
::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
{
- return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+ Reference< XGridControl > xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getItemIndexAtPoint( x, y );
}
-/*
-void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->setToolTip( text, columns );
}
-
-void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener );
-}
-*/
// -------------------------------------------------------------------
// XGridSelection
// -------------------------------------------------------------------
@@ -218,16 +224,24 @@ void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::R
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
}
-void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRows( rangeOfRows);
}
-void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
+}
+void SAL_CALL UnoGridControl::deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRows( rangeOfRows);
}
+void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
+}
::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
{
return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
@@ -250,14 +264,14 @@ void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::
void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener );
+ m_aSelectionListeners.addInterface( listener );
}
void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
{
- Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
-}
+ m_aSelectionListeners.removeInterface( listener );
}
+}//namespace toolkit
Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
{
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
index 4195a1f624e5..0c8ddb1c02b6 100644
--- a/toolkit/source/controls/grid/gridcontrol.hxx
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -30,10 +30,11 @@
#include <com/sun/star/awt/grid/XGridControl.hpp>
#include <com/sun/star/view/SelectionType.hpp>
-#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
#include <toolkit/controls/unocontrolmodel.hxx>
#include <toolkit/helper/servicenames.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
@@ -87,20 +88,18 @@ public:
void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridControl
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException);
+
virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setToolTip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& columns) throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::grid::XGridSelection
virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRows(const ::com::sun::star::uno::Sequence< ::sal_Int32 >& rangeOfRows) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAllRows() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
@@ -114,6 +113,7 @@ public:
using UnoControl::getPeer;
private:
::com::sun::star::view::SelectionType mSelectionMode;
+ SelectionListenerMultiplexer m_aSelectionListeners;
};
} // toolkit
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index fcfd6214780e..9b8df60521ae 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -206,3 +206,8 @@ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com
// ----------------------------------------------------
IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index 7ede81d485d7..6711e4503511 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -281,8 +281,12 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
- DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT )
- };
+ DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_3 ( "EvenRowBackgroundColor", GRID_EVEN_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "LineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowBackgroundColor", GRID_ROW_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID )
+ };
pPropertyInfos = aImplPropertyInfos;
nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
}
diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx
index dbe9163e2117..d203e63ce2ed 100644
--- a/toolkit/source/layout/core/box-base.cxx
+++ b/toolkit/source/layout/core/box-base.cxx
@@ -104,15 +104,16 @@ Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
}
Box_Base::ChildData*
-Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
+Box_Base::removeChildData( std::list< ChildData* >& lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
{
for ( std::list< ChildData* >::iterator it = lst.begin();
it != lst.end(); it++ )
{
if ( (*it)->mxChild == xChild )
{
+ ChildData* pRet = *it;
lst.erase( it );
- return *it;
+ return pRet;
}
}
return 0;
diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx
index 4f50f55bf5c4..685e0e35e8b6 100644
--- a/toolkit/source/layout/core/box-base.hxx
+++ b/toolkit/source/layout/core/box-base.hxx
@@ -62,7 +62,7 @@ protected:
virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
virtual ChildProps *createChildProps( ChildData* pData ) = 0;
- ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
+ ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
public:
void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst
index a93449625585..2bf5fced6fd3 100644
--- a/toolkit/src2xml/include.lst
+++ b/toolkit/src2xml/include.lst
@@ -106,7 +106,6 @@
../../basic/unxlngi6.pro/inc
../../boost/unxlngi6.pro/inc
../../XmlSearch/unxlngi6.pro/inc
-../../fondu/unxlngi6.pro/inc
../../forms/inc
../../forms/source/inc
../../forms/source/solar/inc
diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
index 1d248853f895..2ae0fa5f2f32 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -384,6 +384,8 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#define __DLLEXTENSION "lm.so"
#elif defined LINUX && defined HPPA
#define __DLLEXTENSION "lh.so"
+#elif defined LINUX && defined AXP
+ #define __DLLEXTENSION "ll.so"
#elif defined LINUX
#error unknown plattform
#elif defined FREEBSD && defined X86
diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx
index 86a8114ab0b8..17d52432e206 100644
--- a/tools/inc/tools/urlobj.hxx
+++ b/tools/inc/tools/urlobj.hxx
@@ -125,22 +125,21 @@ enum INetProtocol
INET_PROT_DATA = 15,
INET_PROT_CID = 16,
INET_PROT_OUT = 17,
- INET_PROT_VND_SUN_STAR_WFS = 18,
- INET_PROT_VND_SUN_STAR_HIER = 19,
- INET_PROT_VIM = 20,
- INET_PROT_UNO = 21,
- INET_PROT_COMPONENT = 22,
- INET_PROT_VND_SUN_STAR_PKG = 23,
- INET_PROT_LDAP = 24,
- INET_PROT_DB = 25,
- INET_PROT_VND_SUN_STAR_CMD = 26,
- INET_PROT_VND_SUN_STAR_ODMA = 27,
- INET_PROT_TELNET = 28,
- INET_PROT_VND_SUN_STAR_EXPAND = 29,
- INET_PROT_VND_SUN_STAR_TDOC = 30,
- INET_PROT_GENERIC = 31,
- INET_PROT_SMB = 32,
- INET_PROT_END = 33
+ INET_PROT_VND_SUN_STAR_HIER = 18,
+ INET_PROT_VIM = 19,
+ INET_PROT_UNO = 20,
+ INET_PROT_COMPONENT = 21,
+ INET_PROT_VND_SUN_STAR_PKG = 22,
+ INET_PROT_LDAP = 23,
+ INET_PROT_DB = 24,
+ INET_PROT_VND_SUN_STAR_CMD = 25,
+ INET_PROT_VND_SUN_STAR_ODMA = 26,
+ INET_PROT_TELNET = 27,
+ INET_PROT_VND_SUN_STAR_EXPAND = 28,
+ INET_PROT_VND_SUN_STAR_TDOC = 29,
+ INET_PROT_GENERIC = 30,
+ INET_PROT_SMB = 31,
+ INET_PROT_END = 32
};
//============================================================================
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 07c532e60dd7..a6d7bc6fd04e 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -191,11 +191,6 @@ using namespace com::sun;
name = *(escaped / alphanum / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "?" / "@" / "_" / "~"
- ; prvate (see RFC 1738, RFC 2396)
- vnd-sun-star-wfs-url = "VND.SUN.STAR.WFS://" [host / "LOCALHOST"] ["/" segment *("/" segment)]
- segment = *pchar
-
-
; private
vnd-sun-star-hier-url = "VND.SUN.STAR.HIER:" ["//"reg_name] *("/" *pchar)
reg_name = 1*(escaped / alphanum / "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / "-" / "." / ":" / ";" / "=" / "@" / "_" / "~")
@@ -403,8 +398,6 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false },
{ "out", "out://", 0, true, false, false, false, false, false,
false, false },
- { "vnd.sun.star.wfs", "vnd.sun.star.wfs://", 0, true, false, false,
- false, true, true, true, false },
{ "vnd.sun.star.hier", "vnd.sun.star.hier:", 0, true, false, false,
false, false, false, true, false },
{ "vim", "vim://", 0, true, true, false, true, false, false, true,
@@ -429,7 +422,7 @@ static INetURLObject::SchemeInfo const aSchemeInfoMap[INET_PROT_END]
false, false, false, false, false },
{ "vnd.sun.star.tdoc", "vnd.sun.star.tdoc:", 0, false, false, false,
false, false, false, true, false },
- { "", "", 0, false, false, false, false, false, false, false, false },
+ { "", "", 0, false, false, false, false, true, true, true, false },
{ "smb", "smb://", 139, true, true, false, true, true, true, true,
true } };
@@ -1338,7 +1331,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
if (pHostPortBegin)
{
sal_Unicode const * pPort = pHostPortEnd;
- if (getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd)
+ if ( getSchemeInfo().m_bPort && pHostPortBegin < pHostPortEnd )
{
sal_Unicode const * p1 = pHostPortEnd - 1;
while (p1 > pHostPortBegin && INetMIME::isDigit(*p1))
@@ -1350,7 +1343,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
// If the host equals "LOCALHOST" (unencoded and ignoring
// case), turn it into an empty host:
if (INetMIME::equalIgnoreCase(pHostPortBegin, pPort,
@@ -1367,7 +1359,6 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
return false;
}
break;
-
default:
if (pHostPortBegin == pPort)
{
@@ -1609,7 +1600,23 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef,
STATE_DONE };
rtl::OUStringBuffer aSynAbsURIRef;
- aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aSynAbsURIRef.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aSynAbsURIRef.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
aSynAbsURIRef.append(sal_Unicode(':'));
sal_Char cEscapePrefix = getEscapePrefix();
@@ -2162,11 +2169,7 @@ INetURLObject::getPrefix(sal_Unicode const *& rBegin,
{ "vnd.sun.star.tdoc:", 0, INET_PROT_VND_SUN_STAR_TDOC,
PrefixInfo::OFFICIAL },
{ "vnd.sun.star.webdav:", 0, INET_PROT_VND_SUN_STAR_WEBDAV,
- PrefixInfo::OFFICIAL },
- { "vnd.sun.star.wfs:", 0, INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::OFFICIAL },
- { "wfs:", "vnd.sun.star.wfs:", INET_PROT_VND_SUN_STAR_WFS,
- PrefixInfo::ALIAS } };
+ PrefixInfo::OFFICIAL } };
PrefixInfo const * pFirst = aMap + 1;
PrefixInfo const * pLast = aMap + sizeof aMap / sizeof (PrefixInfo) - 1;
PrefixInfo const * pMatch = 0;
@@ -2889,7 +2892,6 @@ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
@@ -2985,7 +2987,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
break;
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
if (bSkippedInitialSlash)
aTheSynPath.append(sal_Unicode('/'));
@@ -3398,7 +3399,6 @@ bool INetURLObject::parsePath(INetProtocol eScheme,
if (aTheSynPath.getLength() == 0)
return false;
break;
-
default:
OSL_ASSERT(false);
break;
@@ -3825,7 +3825,27 @@ INetURLObject::getAbbreviated(
OSL_ENSURE(rStringWidth.is(), "specification violation");
sal_Char cEscapePrefix = getEscapePrefix();
rtl::OUStringBuffer aBuffer;
- aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ // make sure that the scheme is copied for generic schemes: getSchemeInfo().m_pScheme
+ // is empty ("") in that case, so take the scheme from m_aAbsURIRef
+ if (m_eScheme != INET_PROT_GENERIC)
+ {
+ aBuffer.appendAscii(getSchemeInfo().m_pScheme);
+ }
+ else
+ {
+ if (m_aAbsURIRef)
+ {
+ sal_Unicode const * pSchemeBegin
+ = m_aAbsURIRef.getStr();
+ sal_Unicode const * pSchemeEnd = pSchemeBegin;
+
+ while (pSchemeEnd[0] != ':')
+ {
+ ++pSchemeEnd;
+ }
+ aBuffer.append(pSchemeBegin, pSchemeEnd - pSchemeBegin);
+ }
+ }
aBuffer.append(static_cast< sal_Unicode >(':'));
bool bAuthority = getSchemeInfo().m_bAuthority;
sal_Unicode const * pCoreBegin
@@ -4007,7 +4027,6 @@ bool INetURLObject::operator ==(INetURLObject const & rObject) const
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
// If the URL paths of two file URLs only differ in that one has a
// final '/' and the other has not, take the two paths as
@@ -4162,7 +4181,6 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme,
switch (m_eScheme)
{
case INET_PROT_FILE:
- case INET_PROT_VND_SUN_STAR_WFS:
{
rtl::OUString sTemp(aSynHost);
if (sTemp.equalsIgnoreAsciiCaseAsciiL(
diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx
index 694698297680..0930dfcc5239 100644
--- a/tools/workben/urltest.cxx
+++ b/tools/workben/urltest.cxx
@@ -523,6 +523,8 @@ main()
/*TODO "vnd.sun.star.wfs:///c|/xyz/",*/
/*TODO "vnd.sun.star.wfs://xxx/yyy?zzz",*/
"vnd.sun.star.wfs:///x/y/z",
+ "vnd.sun.star.generic:///x/y/z",
+ "vnd.sun.star.generic://host:34/x/y/z"
/*TODO "wfs://",*/
/*TODO "wfs://LocalHost",*/
/*TODO "wfs:///c|/xyz/",*/
@@ -533,13 +535,21 @@ main()
INetURLObject aUrl(aTest[i]);
if (aUrl.HasError())
printf("BAD %s\n", aTest[i]);
- else if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
- equalsAscii(aTest[i]) != sal_True)
+ else
{
+ if (aUrl.GetProtocol() != INET_PROT_GENERIC) {
+ printf("BAD PROTOCOL %i -> %i\n",
+ aUrl.GetProtocol(),
+ INET_PROT_GENERIC);
+ }
+ if (aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI).
+ equalsAscii(aTest[i]) != sal_True)
+ {
String sTest(aUrl.GetMainURL(INetURLObject::DECODE_TO_IURI));
printf("BAD %s -> %s\n",
aTest[i],
ByteString(sTest, RTL_TEXTENCODING_ASCII_US).GetBuffer());
+ }
}
}
}
diff --git a/ucbhelper/inc/ucbhelper/configureucb.hxx b/ucbhelper/inc/ucbhelper/configureucb.hxx
deleted file mode 100644
index 2e70467a4e9f..000000000000
--- a/ucbhelper/inc/ucbhelper/configureucb.hxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UCBHELPER_CONFIGUREUCB_HXX_
-#define _UCBHELPER_CONFIGUREUCB_HXX_
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/ustring.hxx>
-
-#include <vector>
-#include "ucbhelper/ucbhelperdllapi.h"
-
-namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
- namespace ucb {
- class XContentProvider;
- class XContentProviderManager;
- }
- namespace uno { class Any; }
-} } }
-
-namespace ucbhelper {
-
-//============================================================================
-/** Information about a registered content provider, passed from
- <method>configureUcb</method> to <method>unconfigureUcb</method> (and from
- <method>registerAtUcb</method> to <method>deregisterFromUcb</method>).
- */
-struct ContentProviderRegistrationInfo
-{
- /** The registered content provider (or null if registration failed).
- */
- com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
- m_xProvider;
-
- /** The arguments the content provider was instantiated with.
- */
- rtl::OUString m_aArguments;
-
- /** The URL template the content provider is registered on.
- */
- rtl::OUString m_aTemplate;
-};
- //@@@ if registerucb.hxx were exported, too, this might better reside in
- // there...
-
-typedef std::vector< ContentProviderRegistrationInfo >
- ContentProviderRegistrationInfoList;
-
-//============================================================================
-/** Information about a content provider, passed to
- <method>configureUcb</method>.
- */
-struct ContentProviderData
-{
- /** The UNO service name to use to instanciate the content provider.
- */
- rtl::OUString ServiceName;
-
- /** The URL template to use to instanciate the content provider.
- */
- rtl::OUString URLTemplate;
-
- /** The arguments to use to instanciate the content provider.
- */
- rtl::OUString Arguments;
-
- ContentProviderData() {};
- ContentProviderData( const rtl::OUString & rService,
- const rtl::OUString & rTemplate,
- const rtl::OUString & rArgs )
- : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
-};
-
-typedef std::vector< ContentProviderData > ContentProviderDataList;
-
-//============================================================================
-/** Configure a (newly instantiated) Universal Content Broker.
-
- @descr This function tries to register at the given content provider
- manager all the content provider services listed under a given key in the
- configuration database.
-
- @param rManager A content provider manager (normally, this would be a
- newly intantiated UCB).
-
- @param rServiceFactory A service factory through which to obtain the
- various services required.
-
- @param rData A list containing the data for the content providers for
- the UCB to configure.
-
- @pInfos If not null, an entry will be added to this vector for every
- content provider that is registered (sucessfully or not).
-
- @return True if the UCB has successfuly been configured (though not all
- content providers have necessarily been registered due to individual
- problems).
- */
-bool
-configureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- ContentProviderDataList const & rData,
- ContentProviderRegistrationInfoList * pInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-
-//============================================================================
-/** Configure a (newly instantiated) Universal Content Broker.
-
- @descr This function tries to register at the given content provider
- manager all the content provider services listed under a given key in the
- configuration database.
-
- @param rManager A content provider manager (normally, this would be a
- newly intantiated UCB).
-
- @param rServiceFactory A service factory through which to obtain the
- various services required.
-
- @param rArguments A sequence of at least two strings: the primary and
- secondary key addressing a chosen UCB configuration in the configuration
- database. The sequence can be longer, in which case the excess elements
- must be strings that form key/value pairs. These key/value pairs will be
- used to replace placeholders in the data from the configuration database
- with (dynamic) values. This is a (rather unstructured) sequence of
- <type>Any<type/>s, since normally this parameter will simply be forwarded
- by the UCB's <method>initialize<method/> method, which has a parameter of
- the same type.
-
- @pInfos If not null, an entry will be added to this vector for every
- content provider that is registered (sucessfully or not).
-
- @return True if the UCB has successfuly been configured (though not all
- content providers have necessarily been registered due to individual
- problems).
- */
-UCBHELPER_DLLPUBLIC bool
-configureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- com::sun::star::uno::Sequence< com::sun::star::uno::Any > const &
- rArguments,
- std::vector< ContentProviderRegistrationInfo > * pInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-//============================================================================
-/** Undo the configuration of a Universal Content Broker.
-
- @descr This function is the reverse of <method>configureUcb</method>.
-
- @param rManager A content provider manager.
-
- @param rInfos Information about all the registered content providers.
- */
-void
-unconfigureUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- std::vector< ContentProviderRegistrationInfo > const & rInfos)
- throw (com::sun::star::uno::RuntimeException);
-
-}
-
-#endif // _UCBHELPER_CONFIGUREUCB_HXX_
diff --git a/ucbhelper/inc/ucbhelper/contentbroker.hxx b/ucbhelper/inc/ucbhelper/contentbroker.hxx
index eea72cc689e0..54139d3ffdea 100644
--- a/ucbhelper/inc/ucbhelper/contentbroker.hxx
+++ b/ucbhelper/inc/ucbhelper/contentbroker.hxx
@@ -41,7 +41,7 @@ namespace com { namespace sun { namespace star { namespace ucb {
class XContentProviderManager;
class XCommandProcessor;
} } } }
-#include <ucbhelper/configureucb.hxx>
+#include <ucbhelper/registerucb.hxx>
#include "ucbhelper/ucbhelperdllapi.h"
namespace ucbhelper
diff --git a/ucbhelper/inc/ucbhelper/registerucb.hxx b/ucbhelper/inc/ucbhelper/registerucb.hxx
new file mode 100644
index 000000000000..e2427248dce2
--- /dev/null
+++ b/ucbhelper/inc/ucbhelper/registerucb.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef _UCBHELPER_REGISTERUCB_HXX_
+#define _UCBHELPER_REGISTERUCB_HXX_
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XContentProviderManager.hpp>
+#include <vector>
+
+#include "ucbhelper/ucbhelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace lang { class XMultiServiceFactory; }
+} } }
+
+namespace rtl { class OUString; }
+
+namespace ucbhelper {
+
+//============================================================================
+/** Information about a registered content provider.
+ */
+struct ContentProviderRegistrationInfo
+{
+ /** The registered content provider (or null if registration failed).
+ */
+ com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
+ m_xProvider;
+
+ /** The arguments the content provider was instantiated with.
+ */
+ rtl::OUString m_aArguments;
+
+ /** The URL template the content provider is registered on.
+ */
+ rtl::OUString m_aTemplate;
+};
+
+typedef std::vector< ContentProviderRegistrationInfo >
+ ContentProviderRegistrationInfoList;
+
+//============================================================================
+/** Information about a content provider, passed to
+ <method>configureUcb</method>.
+ */
+struct ContentProviderData
+{
+ /** The UNO service name to use to instanciate the content provider.
+ */
+ rtl::OUString ServiceName;
+
+ /** The URL template to use to instanciate the content provider.
+ */
+ rtl::OUString URLTemplate;
+
+ /** The arguments to use to instanciate the content provider.
+ */
+ rtl::OUString Arguments;
+
+ ContentProviderData() {};
+ ContentProviderData( const rtl::OUString & rService,
+ const rtl::OUString & rTemplate,
+ const rtl::OUString & rArgs )
+ : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
+};
+
+typedef std::vector< ContentProviderData > ContentProviderDataList;
+//============================================================================
+/** Register a content provider at a Universal Content Broker.
+
+ @param rManager A content provider manager (normally, this would be a
+ UCB). May be null, which is only useful if the content provider is an
+ <type>XParamterizedContentProvider</type>s.
+
+ @param rServiceFactory A factory through which to obtain the required
+ services.
+
+ @param rName The service name of the content provider.
+
+ @param rArguments Any arguments to instantiate the content provider with.
+
+ @param rTemplate The URL template to register the content provider on.
+
+ @param pInfo If not null, this output parameter is filled with
+ information about the (atemptively) registered provider.
+ */
+
+UCBHELPER_DLLPUBLIC bool registerAtUcb(
+ com::sun::star::uno::Reference<
+ com::sun::star::ucb::XContentProviderManager > const &
+ rManager,
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > const &
+ rServiceFactory,
+ rtl::OUString const & rName,
+ rtl::OUString const & rArguments,
+ rtl::OUString const & rTemplate,
+ ContentProviderRegistrationInfo * pInfo)
+ throw (com::sun::star::uno::RuntimeException);
+
+}
+#endif // _UCBHELPER_REGISTERUCB_HXX_
diff --git a/ucbhelper/prj/d.lst b/ucbhelper/prj/d.lst
index 64da268b6143..21a46483789b 100644
--- a/ucbhelper/prj/d.lst
+++ b/ucbhelper/prj/d.lst
@@ -9,7 +9,7 @@
mkdir: %_DEST%\inc%_EXT%\ucbhelper
..\inc\ucbhelper\configurationkeys.hxx %_DEST%\inc%_EXT%\ucbhelper\configurationkeys.hxx
-..\inc\ucbhelper\configureucb.hxx %_DEST%\inc%_EXT%\ucbhelper\configureucb.hxx
+..\inc\ucbhelper\registerucb.hxx %_DEST%\inc%_EXT%\ucbhelper\registerucb.hxx
..\inc\ucbhelper\content.hxx %_DEST%\inc%_EXT%\ucbhelper\content.hxx
..\inc\ucbhelper\contentbroker.hxx %_DEST%\inc%_EXT%\ucbhelper\contentbroker.hxx
..\inc\ucbhelper\commandenvironment.hxx %_DEST%\inc%_EXT%\ucbhelper\commandenvironment.hxx
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index 7e0e7f3657ca..408ff6af0dee 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -298,14 +298,18 @@ bool ContentBroker_Impl::initialize()
if ( m_xProviderMgr.is() )
{
- if ( !configureUcb( m_xProviderMgr,
- m_xSMgr,
- m_aProvData,
- 0 ) )
+ ContentProviderDataList::const_iterator aEnd(m_aProvData.end());
+ for (ContentProviderDataList::const_iterator aIt(m_aProvData.begin());
+ aIt != aEnd; ++aIt)
{
- OSL_ENSURE( false, "Failed to configure UCB!" );
- return false;
+ registerAtUcb(m_xProviderMgr,
+ m_xSMgr,
+ aIt->ServiceName,
+ aIt->Arguments,
+ aIt->URLTemplate,
+ 0);
}
+
}
}
}
diff --git a/ucbhelper/source/provider/makefile.mk b/ucbhelper/source/provider/makefile.mk
index db06a5df131c..5999192f7bdb 100644
--- a/ucbhelper/source/provider/makefile.mk
+++ b/ucbhelper/source/provider/makefile.mk
@@ -43,7 +43,6 @@ ENABLE_EXCEPTIONS=TRUE
.IF "$(header)" == ""
SLOFILES=\
- $(SLO)$/configureucb.obj \
$(SLO)$/contentidentifier.obj \
$(SLO)$/providerhelper.obj \
$(SLO)$/contenthelper.obj \
@@ -53,7 +52,6 @@ SLOFILES=\
$(SLO)$/resultsetmetadata.obj \
$(SLO)$/resultset.obj \
$(SLO)$/resultsethelper.obj \
- $(SLO)$/provconf.obj \
$(SLO)$/commandenvironmentproxy.obj \
$(SLO)$/interactionrequest.obj \
$(SLO)$/simpleinteractionrequest.obj \
diff --git a/ucbhelper/source/provider/registerucb.cxx b/ucbhelper/source/provider/registerucb.cxx
index 0a749c9ccb5c..e6ccaf4743a8 100644
--- a/ucbhelper/source/provider/registerucb.cxx
+++ b/ucbhelper/source/provider/registerucb.cxx
@@ -27,7 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucbhelper.hxx"
-#include <registerucb.hxx>
+#include <ucbhelper/registerucb.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
@@ -35,7 +35,6 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include "osl/diagnose.h"
-#include <ucbhelper/configureucb.hxx>
using namespace com::sun::star;
@@ -162,41 +161,4 @@ registerAtUcb(
return bSuccess;
}
-//============================================================================
-//
-// deregisterFromUcb
-//
-//============================================================================
-
-void
-deregisterFromUcb(
- uno::Reference< ucb::XContentProviderManager > const & rManager,
- ContentProviderRegistrationInfo const & rInfo)
- throw (uno::RuntimeException)
-{
- uno::Reference< ucb::XContentProvider >
- xProvider(rInfo.m_xProvider);
- uno::Reference< ucb::XParameterizedContentProvider >
- xParameterized(xProvider, uno::UNO_QUERY);
- if (xParameterized.is())
- {
- uno::Reference< ucb::XContentProvider > xInstance;
- try
- {
- xInstance
- = xParameterized->deregisterInstance(rInfo.m_aTemplate,
- rInfo.m_aArguments);
- }
- catch (lang::IllegalArgumentException const &) {}
-
- if (xInstance.is())
- xProvider = xInstance;
- }
-
- if (rManager.is())
- rManager->deregisterContentProvider(xProvider, rInfo.m_aTemplate);
- //@@@ if this fails, a roll-back of deregisterInstance() is
- // missing
-}
-
}
diff --git a/ucbhelper/source/provider/registerucb.hxx b/ucbhelper/source/provider/registerucb.hxx
deleted file mode 100644
index f17321c76cd5..000000000000
--- a/ucbhelper/source/provider/registerucb.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UCBHELPER_REGISTERUCB_HXX_
-#define _UCBHELPER_REGISTERUCB_HXX_
-
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/uno/Reference.h>
-
-namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
- namespace ucb { class XContentProviderManager; }
-} } }
-namespace rtl { class OUString; }
-
-namespace ucbhelper {
-
-struct ContentProviderRegistrationInfo;
-
-//============================================================================
-/** Register a content provider at a Universal Content Broker.
-
- @param rManager A content provider manager (normally, this would be a
- UCB). May be null, which is only useful if the content provider is an
- <type>XParamterizedContentProvider</type>s.
-
- @param rServiceFactory A factory through which to obtain the required
- services.
-
- @param rName The service name of the content provider.
-
- @param rArguments Any arguments to instantiate the content provider with.
-
- @param rTemplate The URL template to register the content provider on.
-
- @param pInfo If not null, this output parameter is filled with
- information about the (atemptively) registered provider.
- */
-bool
-registerAtUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > const &
- rServiceFactory,
- rtl::OUString const & rName,
- rtl::OUString const & rArguments,
- rtl::OUString const & rTemplate,
- ContentProviderRegistrationInfo * pInfo)
- throw (com::sun::star::uno::RuntimeException);
-
-//============================================================================
-/** Deregister a content provider from a Universal Content Broker.
-
- @param rManager A content provider manager (normally, this would be a
- UCB). May be null, which is only useful if the content provider is an
- <type>XParamterizedContentProvider</type>s.
-
- @param rInfo Information about the content provider to deregister.
- */
-void
-deregisterFromUcb(
- com::sun::star::uno::Reference<
- com::sun::star::ucb::XContentProviderManager > const &
- rManager,
- ContentProviderRegistrationInfo const & rInfo)
- throw (com::sun::star::uno::RuntimeException);
-
-}
-
-#endif // _UCBHELPER_REGISTERUCB_HXX_
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
index f292fdf5fc06..8fc0cd4aec4f 100644
--- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -67,7 +67,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
sal_True,
sal_True,
aRequest.HasAccount,
- sal_False,
+ sal_True,
sal_False );
}
//=========================================================================
@@ -149,7 +149,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
eUserNameType == ENTITY_MODIFY,
ePasswordType == ENTITY_MODIFY,
eAccountType == ENTITY_MODIFY,
- sal_False,
+ sal_True,
sal_False );
}
@@ -211,11 +211,12 @@ void SimpleAuthenticationRequest::initialize(
setRequest( uno::makeAny( rRequest ) );
// Fill continuations...
- uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 );
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes(
+ bAllowPersistentStoring ? 3 : 2 );
aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
if (bAllowPersistentStoring)
- aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT;
+ aRememberModes[ 2 ] = ucb::RememberAuthentication_PERSISTENT;
m_xAuthSupplier
= new InteractionSupplyAuthentication(
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h
index fd783270875e..c2ded3267f45 100644
--- a/vcl/aqua/inc/salframe.h
+++ b/vcl/aqua/inc/salframe.h
@@ -184,6 +184,8 @@ public:
NSView* getView() const { return mpView; }
unsigned int getStyleMask() const { return mnStyleMask; }
+ void getResolution( long& o_rDPIX, long& o_rDPIY );
+
// actually the follwing methods do the same thing: flipping y coordinates
// but having two of them makes clearer what the coordinate system
// is supposed to be before and after
diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h
index 8a44f7ef3304..0bceb99d1d0e 100644
--- a/vcl/aqua/inc/salinst.h
+++ b/vcl/aqua/inc/salinst.h
@@ -32,6 +32,7 @@
#include "vos/mutex.hxx"
#include "vos/thread.hxx"
#include "vcl/salinst.hxx"
+#include "osl/conditn.h"
#include "aquavcltypes.h"
@@ -96,6 +97,7 @@ public:
int mnActivePrintJobs;
std::list< SalUserEvent > maUserEvents;
oslMutex maUserEventListMutex;
+ oslCondition maWaitingYieldCond;
typedef std::list<const ApplicationEvent*> AppEventList;
static AppEventList aAppEventList;
diff --git a/vcl/aqua/source/a11y/aqua11yfactory.mm b/vcl/aqua/source/a11y/aqua11yfactory.mm
index eb745ea24aa5..7732ce202cd2 100644
--- a/vcl/aqua/source/a11y/aqua11yfactory.mm
+++ b/vcl/aqua/source/a11y/aqua11yfactory.mm
@@ -48,6 +48,7 @@
#include "aqua11ywrappersplitter.h"
#include "aqua11ywrappertabgroup.h"
#include "aqua11ywrappertoolbar.h"
+#include "aqua11ytablewrapper.h"
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
using namespace ::com::sun::star::accessibility;
@@ -142,6 +143,8 @@ static bool enabled = false;
aWrapper = [ [ AquaA11yWrapperList alloc ] initWithAccessibleContext: rxAccessibleContext ];
} else if ( [ nativeRole isEqualToString: NSAccessibilitySplitterRole ] ) {
aWrapper = [ [ AquaA11yWrapperSplitter alloc ] initWithAccessibleContext: rxAccessibleContext ];
+ } else if ( [ nativeRole isEqualToString: NSAccessibilityTableRole ] ) {
+ aWrapper = [ [ AquaA11yTableWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ];
} else {
aWrapper = [ [ AquaA11yWrapper alloc ] initWithAccessibleContext: rxAccessibleContext ];
}
diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.h b/vcl/aqua/source/a11y/aqua11ytablewrapper.h
index 8753365377e3..7bf3e44a2945 100644
--- a/vcl/aqua/source/a11y/aqua11ytablewrapper.h
+++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.h
@@ -30,9 +30,15 @@
#include "aqua11ywrapper.h"
-@interface AquaA11yTableWrapper : NSObject
+#define MAXIMUM_ACCESSIBLE_TABLE_CELLS 1000
+
+@interface AquaA11yTableWrapper : AquaA11yWrapper
{
}
-+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper;
++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper;
++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject;
+
+-(id)rowsAttribute;
+-(id)columnsAttribute;
@end
#endif // _SV_AQUA11TABLEWRAPPER_H
diff --git a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
index 08205ac8a66b..98454ab8d57b 100644
--- a/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytablewrapper.mm
@@ -35,38 +35,120 @@ using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::uno;
-@implementation AquaA11yTableWrapper : NSObject
+@implementation AquaA11yTableWrapper : AquaA11yWrapper
-+(id)childrenAttributeForElement:(AquaA11yWrapper *)wrapper
++(id)childrenAttributeForElement:(AquaA11yTableWrapper *)wrapper
{
- try
+ XAccessibleTable * accessibleTable = [ wrapper accessibleTable ];
+ NSArray* pResult = nil;
+ if( accessibleTable )
{
NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
- XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ];
- XAccessibleTable * accessibleTable = [ wrapper accessibleTable ];
- // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell
- Size tableSize = accessibleComponent -> getSize();
- Point point;
- point.X = 0;
- point.Y = 0;
- Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point );
- point.X = tableSize.Width - 1;
- point.Y = tableSize.Height - 1;
- Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point );
- if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() )
+ try
{
- sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent();
- sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent();
- sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft );
- sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft );
- sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight );
- sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight );
- // create an array containing the visible cells
- for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ )
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
{
- for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ )
+ // make all children visible to the hierarchy
+ for ( sal_Int32 rowCount = 0; rowCount < nRows; rowCount++ )
{
- Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ for ( sal_Int32 columnCount = 0; columnCount < nCols; columnCount++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ }
+ }
+ else
+ {
+ XAccessibleComponent * accessibleComponent = [ wrapper accessibleComponent ];
+ // find out which cells are actually visible by determining the top-left-cell and the bottom-right-cell
+ Size tableSize = accessibleComponent -> getSize();
+ Point point;
+ point.X = 0;
+ point.Y = 0;
+ Reference < XAccessible > rAccessibleTopLeft = accessibleComponent -> getAccessibleAtPoint ( point );
+ point.X = tableSize.Width - 1;
+ point.Y = tableSize.Height - 1;
+ Reference < XAccessible > rAccessibleBottomRight = accessibleComponent -> getAccessibleAtPoint ( point );
+ if ( rAccessibleTopLeft.is() && rAccessibleBottomRight.is() )
+ {
+ sal_Int32 idxTopLeft = rAccessibleTopLeft -> getAccessibleContext() -> getAccessibleIndexInParent();
+ sal_Int32 idxBottomRight = rAccessibleBottomRight -> getAccessibleContext() -> getAccessibleIndexInParent();
+ sal_Int32 rowTopLeft = accessibleTable -> getAccessibleRow ( idxTopLeft );
+ sal_Int32 columnTopLeft = accessibleTable -> getAccessibleColumn ( idxTopLeft );
+ sal_Int32 rowBottomRight = accessibleTable -> getAccessibleRow ( idxBottomRight );
+ sal_Int32 columnBottomRight = accessibleTable -> getAccessibleColumn ( idxBottomRight );
+ // create an array containing the visible cells
+ for ( sal_Int32 rowCount = rowTopLeft; rowCount <= rowBottomRight; rowCount++ )
+ {
+ for ( sal_Int32 columnCount = columnTopLeft; columnCount <= columnBottomRight; columnCount++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( rowCount, columnCount );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ }
+ }
+ }
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ }
+ [cells autorelease];
+ }
+
+ return pResult;
+}
+
++(void)addAttributeNamesTo: (NSMutableArray *)attributeNames object: (AquaA11yWrapper*)pObject
+{
+ XAccessibleTable * accessibleTable = [ pObject accessibleTable ];
+ if( accessibleTable )
+ {
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+
+
+ if( nRows*nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ [ attributeNames addObject: NSAccessibilityRowsAttribute ];
+ [ attributeNames addObject: NSAccessibilityColumnsAttribute ];
+ }
+ }
+}
+
+-(id)rowsAttribute
+{
+ NSArray* pResult = nil;
+
+ XAccessibleTable * accessibleTable = [ self accessibleTable ];
+ if( accessibleTable )
+ {
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
+ try
+ {
+ // find out number of rows
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ for( sal_Int32 n = 0; n < nRows; n++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( n, 0 );
if ( rAccessibleCell.is() )
{
id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
@@ -74,16 +156,56 @@ using namespace ::com::sun::star::uno;
[ cell_wrapper release ];
}
}
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ pResult = nil;
}
+ [ cells autorelease ];
}
- [ cells autorelease ];
- return NSAccessibilityUnignoredChildren( cells );
}
- catch (const Exception &e)
+
+ return pResult;
+}
+
+-(id)columnsAttribute
+{
+ NSArray* pResult = nil;
+
+ XAccessibleTable * accessibleTable = [ self accessibleTable ];
+
+ if( accessibleTable )
{
- // TODO: Log
- return nil;
+ sal_Int32 nRows = accessibleTable->getAccessibleRowCount();
+ sal_Int32 nCols = accessibleTable->getAccessibleColumnCount();
+ if( nRows * nCols < MAXIMUM_ACCESSIBLE_TABLE_CELLS )
+ {
+ NSMutableArray * cells = [ [ NSMutableArray alloc ] init ];
+ try
+ {
+ // find out number of columns
+ for( sal_Int32 n = 0; n < nCols; n++ )
+ {
+ Reference < XAccessible > rAccessibleCell = accessibleTable -> getAccessibleCellAt ( 0, n );
+ if ( rAccessibleCell.is() )
+ {
+ id cell_wrapper = [ AquaA11yFactory wrapperForAccessibleContext: rAccessibleCell -> getAccessibleContext() ];
+ [ cells addObject: cell_wrapper ];
+ [ cell_wrapper release ];
+ }
+ }
+ pResult = NSAccessibilityUnignoredChildren( cells );
+ }
+ catch (const Exception &e)
+ {
+ pResult = nil;
+ }
+ [ cells autorelease ];
+ }
}
+
+ return pResult;
}
@end
diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm
index 959746d533dc..e86676e725f2 100644
--- a/vcl/aqua/source/a11y/aqua11ywrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm
@@ -29,6 +29,8 @@
#include "precompiled_vcl.hxx"
#include "salinst.h"
+#include "saldata.hxx"
+
#include "aqua11ywrapper.h"
#include "aqua11yactionwrapper.h"
#include "aqua11ycomponentwrapper.h"
@@ -41,6 +43,7 @@
#include "aqua11yfocuslistener.hxx"
#include "aqua11yfocustracker.hxx"
#include "aqua11yrolehelper.h"
+
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
@@ -217,7 +220,8 @@ static MacOSBOOL isPopupMenuOpen = NO;
-(id)roleAttribute {
if ( mActsAsRadioGroup ) {
return NSAccessibilityRadioGroupRole;
- } else {
+ }
+ else {
return [ AquaA11yRoleHelper getNativeRoleFrom: [ self accessibleContext ] ];
}
}
@@ -323,8 +327,10 @@ static MacOSBOOL isPopupMenuOpen = NO;
}
}
return children;
- } else if ( [ self accessibleTable ] != nil ) {
- return [ AquaA11yTableWrapper childrenAttributeForElement: self ];
+ } else if ( [ self accessibleTable ] != nil )
+ {
+ AquaA11yTableWrapper* pTable = [self isKindOfClass: [AquaA11yTableWrapper class]] ? (AquaA11yTableWrapper*)self : nil;
+ return [ AquaA11yTableWrapper childrenAttributeForElement: pTable ];
} else {
try {
NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
@@ -663,6 +669,7 @@ static MacOSBOOL isPopupMenuOpen = NO;
if ( isPopupMenuOpen ) {
return nil;
}
+
id value = nil;
// if we are no longer in the wrapper repository, we have been disposed
AquaA11yWrapper * theWrapper = [ AquaA11yFactory wrapperForAccessibleContext: [ self accessibleContext ] createIfNotExists: NO ];
@@ -717,6 +724,7 @@ static MacOSBOOL isPopupMenuOpen = NO;
NSString * nativeSubrole = nil;
NSString * title = nil;
NSMutableArray * attributeNames = nil;
+ sal_Int32 nAccessibleChildren = 0;
try {
// Default Attributes
attributeNames = [ NSMutableArray arrayWithObjects:
@@ -737,8 +745,9 @@ static MacOSBOOL isPopupMenuOpen = NO;
}
try
{
- if ( [ self accessibleContext ] -> getAccessibleChildCount() > 0 ) {
- [ attributeNames addObject: NSAccessibilityChildrenAttribute ];
+ nAccessibleChildren = [ self accessibleContext ] -> getAccessibleChildCount();
+ if ( nAccessibleChildren > 0 ) {
+ [ attributeNames addObject: NSAccessibilityChildrenAttribute ];
}
}
catch( DisposedException& ) {}
@@ -754,6 +763,9 @@ static MacOSBOOL isPopupMenuOpen = NO;
[ attributeNames addObject: NSAccessibilityServesAsTitleForUIElementsAttribute ];
}
// Special Attributes depending on interface
+ if( [self accessibleContext ] -> getAccessibleRole() == AccessibleRole::TABLE )
+ [AquaA11yTableWrapper addAttributeNamesTo: attributeNames object: self];
+
if ( [ self accessibleText ] != nil ) {
[ AquaA11yTextWrapper addAttributeNamesTo: attributeNames ];
}
@@ -953,14 +965,15 @@ static MacOSBOOL isPopupMenuOpen = NO;
return hit;
}
-Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAccessibleContext > rxAccessibleContext ) {
+Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point point,
+ Reference < XAccessibleContext > rxAccessibleContext ) {
Reference < XAccessibleContext > hitChild;
Reference < XAccessibleContext > emptyReference;
try {
Reference < XAccessibleComponent > rxAccessibleComponent ( rxAccessibleContext, UNO_QUERY );
if ( rxAccessibleComponent.is() ) {
- Point location = rxAccessibleComponent -> getLocationOnScreen();
- Point hitPoint ( point.X - location.X , point.Y - location.Y);
+ com::sun::star::awt::Point location = rxAccessibleComponent -> getLocationOnScreen();
+ com::sun::star::awt::Point hitPoint ( point.X - location.X , point.Y - location.Y);
Reference < XAccessible > rxAccessible = rxAccessibleComponent -> getAccessibleAtPoint ( hitPoint );
if ( rxAccessible.is() && rxAccessible -> getAccessibleContext().is() ) {
if ( rxAccessible -> getAccessibleContext() -> getAccessibleChildCount() > 0 ) {
@@ -999,7 +1012,7 @@ Reference < XAccessibleContext > hitTestRunner ( Point point, Reference < XAcces
}
Reference < XAccessibleContext > hitChild;
NSRect screenRect = [ [ NSScreen mainScreen ] frame ];
- Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) );
+ com::sun::star::awt::Point hitPoint ( static_cast<long>(point.x) , static_cast<long>(screenRect.size.height - point.y) );
// check child windows first
NSWindow * window = (NSWindow *) [ self accessibilityAttributeValue: NSAccessibilityWindowAttribute ];
NSArray * childWindows = [ window childWindows ];
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 62c59e78c963..b8a2261ed9db 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -474,6 +474,7 @@ AquaSalInstance::AquaSalInstance()
mbWaitingYield = false;
maUserEventListMutex = osl_createMutex();
mnActivePrintJobs = 0;
+ maWaitingYieldCond = osl_createCondition();
}
// -----------------------------------------------------------------------
@@ -484,6 +485,7 @@ AquaSalInstance::~AquaSalInstance()
mpSalYieldMutex->release();
delete mpSalYieldMutex;
osl_destroyMutex( maUserEventListMutex );
+ osl_destroyCondition( maWaitingYieldCond );
}
// -----------------------------------------------------------------------
@@ -713,6 +715,7 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( aEvent.mpFrame && AquaSalFrame::isAlive( aEvent.mpFrame ) )
{
aEvent.mpFrame->CallCallback( aEvent.mnType, aEvent.mpData );
+ osl_setCondition( maWaitingYieldCond );
// return if only one event is asked for
if( ! bHandleAllCurrentEvents )
return;
@@ -785,6 +788,18 @@ void AquaSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents )
(*it)->maInvalidRect.SetEmpty();
}
}
+ osl_setCondition( maWaitingYieldCond );
+ }
+ else if( bWait )
+ {
+ // #i103162#
+ // wait until any thread (most likely the main thread)
+ // has dispatched an event, cop out at 200 ms
+ osl_resetCondition( maWaitingYieldCond );
+ TimeValue aVal = { 0, 200000000 };
+ ULONG nCount = ReleaseYieldMutex();
+ osl_waitCondition( maWaitingYieldCond, &aVal );
+ AcquireYieldMutex( nCount );
}
// we get some apple events way too early
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index 38fb068bb353..1ef370f43a92 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -694,6 +694,13 @@ void AquaSalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
{
+ if( nX1 == nX2 && nY1 == nY2 )
+ {
+ // #i109453# platform independent code expects at least one pixel to be drawn
+ drawPixel( nX1, nY1 );
+ return;
+ }
+
if( !CheckContext() )
return;
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
index 71c84ee0c2f1..0fd028864bf4 100644
--- a/vcl/aqua/source/window/salframe.cxx
+++ b/vcl/aqua/source/window/salframe.cxx
@@ -1128,6 +1128,16 @@ static Font getFont( NSFont* pFont, long nDPIY, const Font& rDefault )
return aResult;
}
+void AquaSalFrame::getResolution( long& o_rDPIX, long& o_rDPIY )
+{
+ if( ! mpGraphics )
+ {
+ GetGraphics();
+ ReleaseGraphics( mpGraphics );
+ }
+ mpGraphics->GetResolution( o_rDPIX, o_rDPIY );
+}
+
// on OSX-Aqua the style settings are independent of the frame, so it does
// not really belong here. Since the connection to the Appearance_Manager
// is currently done in salnativewidgets.cxx this would be a good place.
@@ -1157,13 +1167,8 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
// get the system font settings
Font aAppFont = aStyleSettings.GetAppFont();
- if( ! mpGraphics )
- {
- GetGraphics();
- ReleaseGraphics( mpGraphics );
- }
long nDPIX = 72, nDPIY = 72;
- mpGraphics->GetResolution( nDPIX, nDPIY );
+ getResolution( nDPIX, nDPIY );
aAppFont = getFont( [NSFont systemFontOfSize: 0], nDPIY, aAppFont );
// TODO: better mapping of aqua<->ooo font settings
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index 67926a38608d..0dfa0fa356aa 100755
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -37,7 +37,9 @@
#include "vcl/window.hxx"
#include "vcl/svapp.hxx"
-
+
+#define WHEEL_EVENT_FACTOR 1.5
+
static USHORT ImplGetModifierMask( unsigned int nMask )
{
USHORT nRet = 0;
@@ -654,11 +656,12 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
- aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -667,11 +670,11 @@ private:
if( dZ != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dZ));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dZ < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dZ < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
+ aEvent.mnScrollLines = dZ > 0 ? dZ/WHEEL_EVENT_FACTOR : -dZ/WHEEL_EVENT_FACTOR;
if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -712,10 +715,11 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -724,9 +728,9 @@ private:
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -734,9 +738,9 @@ private:
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ))
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -771,10 +775,11 @@ private:
mpFrame->CocoaToVCL( aPt );
SalWheelMouseEvent aEvent;
- aEvent.mnTime = mpFrame->mnLastEventTime;
- aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
- aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
- aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mnTime = mpFrame->mnLastEventTime;
+ aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
+ aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
+ aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
+ aEvent.mbDeltaIsPixel = TRUE;
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
@@ -783,30 +788,27 @@ private:
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dX < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
+ aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR;
if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
- if( aEvent.mnScrollLines > 15 )
- aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
+
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) )
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = aEvent.mnDelta / 8;
- if( aEvent.mnNotchDelta == 0 )
- aEvent.mnNotchDelta = dY < 0.0 ? -1 : 1;
+ aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ if( aEvent.mnDelta == 0 )
+ aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = aEvent.mnNotchDelta > 0 ? aEvent.mnNotchDelta : -aEvent.mnNotchDelta;
- if( aEvent.mnScrollLines == 0 )
+ aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR;
+ if( aEvent.mnScrollLines < 1 )
aEvent.mnScrollLines = 1;
- if( aEvent.mnScrollLines > 15 )
- aEvent.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL;
-
+
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
}
}
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx
index 317a98026f45..8f4b94bf7b18 100644
--- a/vcl/inc/vcl/button.hxx
+++ b/vcl/inc/vcl/button.hxx
@@ -60,7 +60,7 @@ public:
SAL_DLLPRIVATE USHORT ImplGetTextStyle( XubString& rText, WinBits nWinStyle, ULONG nDrawFlags );
SAL_DLLPRIVATE void ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize,
BOOL bLayout, ULONG nImageSep, ULONG nDrawFlags,
- USHORT nTextStyle, Rectangle *pSymbolRect=NULL );
+ USHORT nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false );
SAL_DLLPRIVATE void ImplSetFocusRect( const Rectangle &rFocusRect );
SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const;
SAL_DLLPRIVATE void ImplSetSymbolAlign( SymbolAlign eAlign );
diff --git a/vcl/inc/vcl/cmdevt.hxx b/vcl/inc/vcl/cmdevt.hxx
index 0faac8472253..7e968b6c7a54 100644
--- a/vcl/inc/vcl/cmdevt.hxx
+++ b/vcl/inc/vcl/cmdevt.hxx
@@ -138,18 +138,20 @@ private:
USHORT mnMode;
USHORT mnCode;
BOOL mbHorz;
+ BOOL mbDeltaIsPixel;
public:
CommandWheelData();
CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
ULONG nScrollLines,
USHORT nWheelMode, USHORT nKeyModifier,
- BOOL mbHorz = FALSE );
+ BOOL bHorz = FALSE, BOOL bDeltaIsPixel = FALSE );
long GetDelta() const { return mnDelta; }
long GetNotchDelta() const { return mnNotchDelta; }
ULONG GetScrollLines() const { return mnLines; }
BOOL IsHorz() const { return mbHorz; }
+ BOOL IsDeltaPixel() const { return mbDeltaIsPixel; }
USHORT GetMode() const { return mnMode; }
@@ -173,12 +175,13 @@ inline CommandWheelData::CommandWheelData()
mnMode = 0;
mnCode = 0;
mbHorz = FALSE;
+ mbDeltaIsPixel = FALSE;
}
inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDelta,
ULONG nScrollLines,
USHORT nWheelMode, USHORT nKeyModifier,
- BOOL bHorz )
+ BOOL bHorz, BOOL bDeltaIsPixel )
{
mnDelta = nWheelDelta;
mnNotchDelta = nWheelNotchDelta;
@@ -186,6 +189,7 @@ inline CommandWheelData::CommandWheelData( long nWheelDelta, long nWheelNotchDel
mnMode = nWheelMode;
mnCode = nKeyModifier;
mbHorz = bHorz;
+ mbDeltaIsPixel = bDeltaIsPixel;
}
// ---------------------
diff --git a/vcl/inc/vcl/glyphcache.hxx b/vcl/inc/vcl/glyphcache.hxx
index fa3e99f2373f..a77c1626dc24 100644
--- a/vcl/inc/vcl/glyphcache.hxx
+++ b/vcl/inc/vcl/glyphcache.hxx
@@ -51,6 +51,7 @@ class RawBitmap;
class CmapResult;
#include <vcl/outfont.hxx>
+#include <vcl/impfont.hxx>
class ServerFontLayout;
#include <vcl/sallayout.hxx>
@@ -258,11 +259,15 @@ class VCL_DLLPUBLIC ImplServerFontEntry : public ImplFontEntry
{
private:
ServerFont* mpServerFont;
+ ImplFontOptions maFontOptions;
+ bool mbGotFontOptions;
+ bool mbValidFontOptions;
public:
ImplServerFontEntry( ImplFontSelectData& );
virtual ~ImplServerFontEntry();
void SetServerFont( ServerFont* p) { mpServerFont = p; }
+ void HandleFontOptions();
};
// =======================================================================
diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx
index 995fcd6009ff..4bbf7176ddb2 100644
--- a/vcl/inc/vcl/outfont.hxx
+++ b/vcl/inc/vcl/outfont.hxx
@@ -39,6 +39,8 @@
#include <hash_map>
+#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+
class ImplDevFontListData;
class ImplGetDevFontList;
class ImplGetDevSizeList;
@@ -186,6 +188,7 @@ public: // TODO: change to private
class VCL_DLLPUBLIC ImplDevFontList
{
private:
+ friend class WinGlyphFallbackSubstititution;
mutable bool mbMatchData; // true if matching attributes are initialized
bool mbMapNames; // true if MapNames are available
@@ -222,6 +225,9 @@ public:
ImplGetDevFontList* GetDevFontList() const;
ImplGetDevSizeList* GetDevSizeList( const String& rFontName ) const;
+ //used by 2-level font fallback
+ ImplDevFontListData* ImplFindByLocale(com::sun::star::lang::Locale lc) const;
+
protected:
void InitMatchData() const;
bool AreMapNamesAvailable() const { return mbMapNames; }
diff --git a/vcl/inc/vcl/salwtype.hxx b/vcl/inc/vcl/salwtype.hxx
index c67d36ac4ea9..95b3806d648b 100644
--- a/vcl/inc/vcl/salwtype.hxx
+++ b/vcl/inc/vcl/salwtype.hxx
@@ -180,6 +180,11 @@ struct SalWheelMouseEvent
ULONG mnScrollLines; // Aktuelle Anzahl zu scrollende Zeilen
USHORT mnCode; // SV-ModifierCode (KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT)
BOOL mbHorz; // Horizontal
+ BOOL mbDeltaIsPixel; // delta value is a pixel value (on mac)
+
+ SalWheelMouseEvent()
+ : mnTime( 0 ), mnX( 0 ), mnY( 0 ), mnDelta( 0 ), mnNotchDelta( 0 ), mnScrollLines( 0 ), mnCode( 0 ), mbHorz( FALSE ), mbDeltaIsPixel( FALSE )
+ {}
};
// MOUSEACTIVATE
diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx
index 048eb1d5a670..fcf1d2ee0387 100644
--- a/vcl/inc/vcl/vclevent.hxx
+++ b/vcl/inc/vcl/vclevent.hxx
@@ -192,6 +192,7 @@ namespace com { namespace sun { namespace star {
#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED 1223 // pData = itempos
#define VCLEVENT_TABLECELL_NAMECHANGED 1224 // pData = struct(Entry, Column, oldText)
+#define VCLEVENT_TABLEROW_SELECT 1225
class VCL_DLLPUBLIC VclSimpleEvent
{
diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx
index 7ecc27ff9754..f3314c725255 100644
--- a/vcl/os2/source/window/salframe.cxx
+++ b/vcl/os2/source/window/salframe.cxx
@@ -3032,10 +3032,8 @@ static void ImplHandleMoveMsg( HWND hWnd)
// -----------------------------------------------------------------------
-static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
+static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
{
- long nRet;
-
Os2SalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
@@ -3047,11 +3045,10 @@ static long ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 )
pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2);
// Status merken
ImplSaveFrameState( pFrame );
- nRet = pFrame->CallCallback( SALEVENT_RESIZE, 0 );
+ pFrame->CallCallback( SALEVENT_RESIZE, 0 );
if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow )
WinUpdateWindow( pFrame->mhWndClient );
}
- return nRet;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 5ad3f6787461..980e0f1c5b58 100644..100755
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -188,7 +188,7 @@ ImplMouseData::ImplMouseData()
mnActionDelay = 250;
mnMenuDelay = 150;
mnFollow = MOUSE_FOLLOW_MENU | MOUSE_FOLLOW_DDLIST;
- mnWheelBehavior = MOUSE_WHEEL_FOCUS_ONLY;
+ mnWheelBehavior = MOUSE_WHEEL_ALWAYS;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1f45b5902381..08759f37d7a6 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -367,7 +367,8 @@ USHORT Button::ImplGetTextStyle( XubString& rText, WinBits nWinStyle,
void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
Size& rSize, BOOL bLayout,
ULONG nImageSep, ULONG nDrawFlags,
- USHORT nTextStyle, Rectangle *pSymbolRect )
+ USHORT nTextStyle, Rectangle *pSymbolRect,
+ bool bAddImageSep )
{
XubString aText( GetText() );
BOOL bDrawImage = HasImage() && ! ( ImplGetButtonState() & BUTTON_DRAW_NOIMAGE );
@@ -502,6 +503,13 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos,
if ( aTSSize.Height() < aTextSize.Height() )
aTSSize.Height() = aTextSize.Height();
+
+ if( bAddImageSep && bDrawImage )
+ {
+ long nDiff = (aImageSize.Height() - aTextSize.Height()) / 3;
+ if( nDiff > 0 )
+ nImageSep += nDiff;
+ }
}
aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width();
@@ -880,7 +888,9 @@ void PushButton::ImplInitSettings( BOOL bFont,
EnableChildTransparentMode( TRUE );
SetParentClipMode( PARENTCLIPMODE_NOCLIP );
SetPaintTransparent( TRUE );
- mpWindowImpl->mbUseNativeFocus = ImplGetSVData()->maNWFData.mbNoFocusRects;
+ mpWindowImpl->mbUseNativeFocus = (GetStyle() & WB_FLATBUTTON)
+ ? false
+ : ImplGetSVData()->maNWFData.mbNoFocusRects;
}
else
{
@@ -1194,8 +1204,10 @@ void PushButton::ImplDrawPushButtonContent( OutputDevice* pDev, ULONG nDrawFlags
ULONG nImageSep = 1 + (pDev->GetTextHeight()-10)/2;
if( nImageSep < 1 )
nImageSep = 1;
+ // FIXME: (GetStyle() & WB_FLATBUTTON) != 0 is preliminary
+ // in the next major this should be replaced by "true"
ImplDrawAlignedImage( pDev, aPos, aSize, bLayout, nImageSep, nDrawFlags,
- nTextStyle, IsSymbol() ? &aSymbolRect : NULL );
+ nTextStyle, IsSymbol() ? &aSymbolRect : NULL, (GetStyle() & WB_FLATBUTTON) != 0 );
if ( IsSymbol() && ! bLayout )
{
@@ -1363,7 +1375,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
Size aInRectSize( LogicToPixel( Size( aInRect.GetWidth(), aInRect.GetHeight() ) ) );
aPBVal.mbSingleLine = (aInRectSize.Height() < 2 * aFontSize.Height() );
- if( ((nState & CTRL_STATE_ROLLOVER) || HasFocus()) || ! (GetStyle() & WB_FLATBUTTON) )
+ if( ((nState & CTRL_STATE_ROLLOVER)) || ! (GetStyle() & WB_FLATBUTTON) )
{
bNativeOK = DrawNativeControl( CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion, nState,
aControlValue, rtl::OUString()/*PushButton::GetText()*/ );
@@ -1388,7 +1400,7 @@ void PushButton::ImplDrawPushButton( bool bLayout )
if( (GetStyle() & WB_FLATBUTTON) )
{
Rectangle aTempRect( aInRect );
- if( ! bLayout && (bRollOver || HasFocus()) )
+ if( ! bLayout && bRollOver )
ImplDrawPushButtonFrame( this, aTempRect, nButtonStyle );
aInRect.Left() += 2;
aInRect.Top() += 2;
@@ -1879,7 +1891,8 @@ long PushButton::PreNotify( NotifyEvent& rNEvt )
pBorder->Update();
}
}
- else if( IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) )
+ else if( (GetStyle() & WB_FLATBUTTON) ||
+ IsNativeControlSupported(CTRL_PUSHBUTTON, PART_ENTIRE_CONTROL) )
{
Invalidate();
}
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 741267044829..89fbe6d3db78 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -1156,8 +1156,6 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt )
ImplTabItem* pItem = ImplGetItem( nPageId );
if( pItem && pItem->mbEnabled )
SelectTabPage( nPageId );
- else
- Sound::Beep( SOUND_ERROR, this );
}
}
}
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 9884e7016fee..620ca64f44d9 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -33,6 +33,7 @@
#include <assert.h>
#include <vcl/fontsubset.hxx>
+#include <vcl/strhelper.hxx>
//#define IGNORE_HINTS
@@ -2027,6 +2028,17 @@ void Type1Emitter::emitAllCrypted( void)
// --------------------------------------------------------------------
+// #i110387# quick-and-dirty double->ascii conversion
+// needed because sprintf/ecvt/etc. alone are too localized (LC_NUMERIC)
+// also strip off trailing zeros in fraction while we are at it
+inline int dbl2str( char* pOut, double fVal, int nPrecision=6)
+{
+ const int nLen = psp::getValueOfDouble( pOut, fVal, nPrecision);
+ return nLen;
+}
+
+// --------------------------------------------------------------------
+
void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
const ValVector& rVector)
{
@@ -2042,10 +2054,11 @@ void Type1Emitter::emitValVector( const char* pLineHead, const char* pLineTail,
aVal = *it;
if( ++it == rVector.end() )
break;
- mpPtr += sprintf( mpPtr, "%g ", aVal);
+ mpPtr += dbl2str( mpPtr, aVal);
+ *(mpPtr++) = ' ';
}
// emit the last value
- mpPtr += sprintf( mpPtr, "%g", aVal);
+ mpPtr += dbl2str( mpPtr, aVal);
// emit the line tail
mpPtr += sprintf( mpPtr, pLineTail);
}
@@ -2202,18 +2215,33 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
rEmitter.emitValVector( "/FamilyBlues [", "]ND\n", mpCffLocal->maFamilyBlues);
rEmitter.emitValVector( "/FamilyOtherBlues [", "]ND\n", mpCffLocal->maFamilyOtherBlues);
- if( mpCffLocal->mfBlueScale)
- pOut += sprintf( pOut, "/BlueScale %.6f def\n", mpCffLocal->mfBlueScale);
- if( mpCffLocal->mfBlueShift) // default BlueShift==7
- pOut += sprintf( pOut, "/BlueShift %.1f def\n", mpCffLocal->mfBlueShift);
- if( mpCffLocal->mfBlueFuzz) // default BlueFuzz==1
- pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz);
+ if( mpCffLocal->mfBlueScale) {
+ pOut += sprintf( pOut, "/BlueScale ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueScale, 6);
+ pOut += sprintf( pOut, " def\n");
+ }
+ if( mpCffLocal->mfBlueShift) { // default BlueShift==7
+ pOut += sprintf( pOut, "/BlueShift ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueShift);
+ pOut += sprintf( pOut, " def\n");
+ }
+ if( mpCffLocal->mfBlueFuzz) { // default BlueFuzz==1
+ pOut += sprintf( pOut, "/BlueFuzz ");
+ pOut += dbl2str( pOut, mpCffLocal->mfBlueFuzz);
+ pOut += sprintf( pOut, " def\n");
+ }
// emit stem hint related privdict entries
- if( mpCffLocal->maStemStdHW)
- pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW);
- if( mpCffLocal->maStemStdVW)
- pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW);
+ if( mpCffLocal->maStemStdHW) {
+ pOut += sprintf( pOut, "/StdHW [");
+ pOut += dbl2str( pOut, mpCffLocal->maStemStdHW);
+ pOut += sprintf( pOut, "] def\n");
+ }
+ if( mpCffLocal->maStemStdVW) {
+ pOut += sprintf( pOut, "/StdVW [");
+ pOut += dbl2str( pOut, mpCffLocal->maStemStdVW);
+ pOut += sprintf( pOut, "] def\n");
+ }
rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH);
rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV);
@@ -2224,8 +2252,11 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
pOut += sprintf( pOut, "/LanguageGroup %d def\n", mpCffLocal->mnLangGroup);
if( mpCffLocal->mnLangGroup == 1) // compatibility with ancient printers
pOut += sprintf( pOut, "/RndStemUp false def\n");
- if( mpCffLocal->mfExpFactor)
- pOut += sprintf( pOut, "/ExpansionFactor %.2f def\n", mpCffLocal->mfExpFactor);
+ if( mpCffLocal->mfExpFactor) {
+ pOut += sprintf( pOut, "/ExpansionFactor ");
+ pOut += dbl2str( pOut, mpCffLocal->mfExpFactor);
+ pOut += sprintf( pOut, " def\n");
+ }
#endif // IGNORE_HINTS
// emit remaining privdict entries
@@ -2248,6 +2279,7 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter,
// emit used GlobalSubr charstrings
// these are the just the default subrs
+ // TODO: do we need them as the flex hints are resolved differently?
static const char aSubrs[] =
"/Subrs 5 array\n"
"dup 0 15 RD \x5F\x3D\x6B\xAC\x3C\xBD\x74\x3D\x3E\x17\xA0\x86\x58\x08\x85 NP\n"
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index 51c76b5a4626..074935086b0b 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -323,7 +323,23 @@ BOOL Bitmap::HasGreyPalette() const
BOOL bRet = FALSE;
if( 1 == nBitCount )
- bRet = TRUE;
+ {
+ BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
+
+ if( pRAcc )
+ {
+ const BitmapColor& rCol0( pRAcc->GetPaletteColor( 0 ) );
+ const BitmapColor& rCol1( pRAcc->GetPaletteColor( 1 ) );
+ if( rCol0.GetRed() == rCol0.GetGreen() && rCol0.GetRed() == rCol0.GetBlue() &&
+ rCol1.GetRed() == rCol1.GetGreen() && rCol1.GetRed() == rCol1.GetBlue() )
+ {
+ bRet = TRUE;
+ }
+ ( (Bitmap*) this )->ReleaseAccess( pRAcc );
+ }
+ else
+ bRet = TRUE;
+ }
else if( 4 == nBitCount || 8 == nBitCount )
{
BitmapReadAccess* pRAcc = ( (Bitmap*) this )->AcquireReadAccess();
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 630e58a1f2bf..f4fcba72b0c2 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -1672,6 +1672,18 @@ void ImplDevFontList::InitMatchData() const
}
}
+//----------------------------------------------------------------------------
+ImplDevFontListData* ImplDevFontList::ImplFindByLocale(com::sun::star::lang::Locale lc) const
+{
+ // get the default font for a specified locale
+ const DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get();
+ String aDefault = rDefaults.getUserInterfaceFont( lc );
+ ImplDevFontListData* pFontData = ImplFindByTokenNames( aDefault );
+ if( pFontData )
+ return pFontData;
+ return 0;
+}
+
// -----------------------------------------------------------------------
ImplDevFontListData* ImplDevFontList::ImplFindByAttributes( ULONG nSearchType,
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 6a24775219d9..7ee5889ba532 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11733,7 +11733,7 @@ sal_Int32 PDFWriterImpl::findRadioGroupWidget( const PDFWriter::RadioButtonWidge
m_aWidgets.back().m_nPage = m_nCurrentPage;
m_aWidgets.back().m_eType = PDFWriter::RadioButton;
m_aWidgets.back().m_nRadioGroup = rBtn.RadioGroup;
- m_aWidgets.back().m_nFlags |= 0x00008000;
+ m_aWidgets.back().m_nFlags |= 0x0000C000; // NoToggleToOff and Radio bits
createWidgetFieldName( sal_Int32(m_aWidgets.size()-1), rBtn );
}
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index bf462d1d8add..80ae3a3a8c7f 100755
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1800,8 +1800,8 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int nRunStart, nRunEnd;
while (rArgs.GetNextRun(&nRunStart, &nRunEnd, &bRtl))
{
- if (bRtl) std::fill(vRtl.begin() + nRunStart - rArgs.mnMinCharPos,
- vRtl.begin() + nRunEnd - rArgs.mnMinCharPos, true);
+ if (bRtl) std::fill(vRtl.begin() + ( nRunStart - rArgs.mnMinCharPos ),
+ vRtl.begin() + ( nRunEnd - rArgs.mnMinCharPos ), true);
}
rArgs.ResetPos();
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index ea0f18896b7a..1953ecf553c4 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -519,8 +519,10 @@ bool ServerFont::IsGlyphInvisible( int nGlyphIndex )
// =======================================================================
ImplServerFontEntry::ImplServerFontEntry( ImplFontSelectData& rFSD )
-: ImplFontEntry( rFSD ),
- mpServerFont( NULL )
+: ImplFontEntry( rFSD )
+, mpServerFont( NULL )
+, mbGotFontOptions( false )
+, mbValidFontOptions( false )
{}
// -----------------------------------------------------------------------
diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src
index 3158926f5e6d..58f0a477c848 100644
--- a/vcl/source/src/print.src
+++ b/vcl/source/src/print.src
@@ -356,7 +356,7 @@ ModalDialog SV_DLG_PRINT
{
Pos = MAP_APPFONT( 5, 35 );
Size = MAP_APPFONT( 150, 10 );
- Text [en-US] = "Range and Copies";
+ Text [en-US] = "Range and copies";
};
FixedText SV_PRINT_COPYCOUNT
{
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 33e58b51d6d0..35077b1cff0e 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -647,7 +647,7 @@ void PrintDialog::JobTabPage::setupLayout()
// add printer fixed line
maLayout.addWindow( &maPrinterFL );
// add print LB
- maLayout.addWindow( &maPrinters );
+ maLayout.addWindow( &maPrinters, 3 );
// create a row for details button/text and properties button
boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) );
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 95ac5940b6d2..7b0512a1320b 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1474,6 +1474,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv
USHORT nMode;
USHORT nCode = rEvt.mnCode;
bool bHorz = rEvt.mbHorz;
+ bool bPixel = rEvt.mbDeltaIsPixel;
if ( nCode & KEY_MOD1 )
nMode = COMMAND_WHEEL_ZOOM;
else if ( nCode & KEY_MOD2 )
@@ -1486,7 +1487,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv
bHorz = true;
}
- CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz );
+ CommandWheelData aWheelData( rEvt.mnDelta, rEvt.mnNotchDelta, rEvt.mnScrollLines, nMode, nCode, bHorz, bPixel );
Point aMousePos( rEvt.mnX, rEvt.mnY );
BOOL bRet = TRUE;
diff --git a/vcl/unx/gtk/a11y/atkbridge.cxx b/vcl/unx/gtk/a11y/atkbridge.cxx
index 47efde7d3dfd..25add8e0dd18 100644
--- a/vcl/unx/gtk/a11y/atkbridge.cxx
+++ b/vcl/unx/gtk/a11y/atkbridge.cxx
@@ -40,10 +40,7 @@ bool InitAtkBridge(void)
{
const char* pVersion = atk_get_toolkit_version();
if( ! pVersion )
- {
- // g_warning( "unable to get gail version number" );
return false;
- }
unsigned int major, minor, micro;
diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index f346a6a5a02c..e6d3276891de 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -454,6 +454,84 @@ text_wrapper_set_caret_offset (AtkText *text,
return FALSE;
}
+// --> OD 2010-03-04 #i92232#
+AtkAttributeSet*
+handle_text_markup_as_run_attribute( accessibility::XAccessibleTextMarkup* pTextMarkup,
+ const gint nTextMarkupType,
+ const gint offset,
+ AtkAttributeSet* pSet,
+ gint *start_offset,
+ gint *end_offset )
+{
+ const gint nTextMarkupCount( pTextMarkup->getTextMarkupCount( nTextMarkupType ) );
+ if ( nTextMarkupCount > 0 )
+ {
+ for ( gint nTextMarkupIndex = 0;
+ nTextMarkupIndex < nTextMarkupCount;
+ ++nTextMarkupIndex )
+ {
+ accessibility::TextSegment aTextSegment =
+ pTextMarkup->getTextMarkup( nTextMarkupIndex, nTextMarkupType );
+ const gint nStartOffsetTextMarkup = aTextSegment.SegmentStart;
+ const gint nEndOffsetTextMarkup = aTextSegment.SegmentEnd;
+ if ( nStartOffsetTextMarkup <= offset )
+ {
+ if ( offset < nEndOffsetTextMarkup )
+ {
+ // text markup at <offset>
+ *start_offset = ::std::max( *start_offset,
+ nStartOffsetTextMarkup );
+ *end_offset = ::std::min( *end_offset,
+ nEndOffsetTextMarkup );
+ switch ( nTextMarkupType )
+ {
+ case com::sun::star::text::TextMarkupType::SPELLCHECK:
+ {
+ pSet = attribute_set_prepend_misspelled( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION:
+ {
+ pSet = attribute_set_prepend_tracked_change_insertion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION:
+ {
+ pSet = attribute_set_prepend_tracked_change_deletion( pSet );
+ }
+ break;
+ case com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE:
+ {
+ pSet = attribute_set_prepend_tracked_change_formatchange( pSet );
+ }
+ break;
+ default:
+ {
+ OSL_ASSERT( false );
+ }
+ }
+ break; // no further iteration needed.
+ }
+ else
+ {
+ *start_offset = ::std::max( *start_offset,
+ nEndOffsetTextMarkup );
+ // continue iteration.
+ }
+ }
+ else
+ {
+ *end_offset = ::std::min( *end_offset,
+ nStartOffsetTextMarkup );
+ break; // no further iteration.
+ }
+ } // eof iteration over text markups
+ }
+
+ return pSet;
+}
+// <--
+
static AtkAttributeSet *
text_wrapper_get_run_attributes( AtkText *text,
gint offset,
@@ -491,41 +569,41 @@ text_wrapper_get_run_attributes( AtkText *text,
}
}
- // Special handling for missspelled
+ // Special handling for misspelled text
+ // --> OD 2010-03-01 #i92232#
+ // - add special handling for tracked changes and refactor the
+ // corresponding code for handling misspelled text.
accessibility::XAccessibleTextMarkup* pTextMarkup = getTextMarkup( text );
if( pTextMarkup )
{
- uno::Sequence< accessibility::TextSegment > aTextSegmentSeq =
- pTextMarkup->getTextMarkupAtIndex( offset, com::sun::star::text::TextMarkupType::SPELLCHECK );
- if( aTextSegmentSeq.getLength() > 0 )
+ // Get attribute run here if it hasn't been done before
+ if( !bOffsetsAreValid )
{
- accessibility::TextSegment aTextSegment = aTextSegmentSeq[0];
- gint nStartOffsetMisspelled = aTextSegment.SegmentStart;
- gint nEndOffsetMisspelled = aTextSegment.SegmentEnd;
-
- // Get attribute run here if it hasn't been done before
- if( !bOffsetsAreValid )
- {
- accessibility::TextSegment aAttributeTextSegment =
- pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
- *start_offset = aAttributeTextSegment.SegmentStart;
- *end_offset = aAttributeTextSegment.SegmentEnd;
- }
-
- if( nEndOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nEndOffsetMisspelled );
- else if( nStartOffsetMisspelled <= offset )
- *start_offset = ::std::max( *start_offset, nStartOffsetMisspelled );
-
- if( nStartOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nStartOffsetMisspelled );
- else if( nEndOffsetMisspelled > offset )
- *end_offset = ::std::min( *end_offset, nEndOffsetMisspelled );
-
- if( nStartOffsetMisspelled <= offset && nEndOffsetMisspelled > offset )
- pSet = attribute_set_prepend_misspelled( pSet );
+ accessibility::TextSegment aAttributeTextSegment =
+ pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
+ *start_offset = aAttributeTextSegment.SegmentStart;
+ *end_offset = aAttributeTextSegment.SegmentEnd;
}
+ // handle misspelled text
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::SPELLCHECK,
+ offset, pSet, start_offset, end_offset );
+ // handle tracked changes
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_INSERTION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_DELETION,
+ offset, pSet, start_offset, end_offset );
+ pSet = handle_text_markup_as_run_attribute(
+ pTextMarkup,
+ com::sun::star::text::TextMarkupType::TRACK_CHANGE_FORMATCHANGE,
+ offset, pSet, start_offset, end_offset );
}
+ // <--
}
catch(const uno::Exception& e){
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 02624a9628cf..04498810597f 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -74,6 +74,12 @@ static AtkTextAttribute atk_text_attribute_tab_stops = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_writing_mode = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_vertical_align = ATK_TEXT_ATTR_INVALID;
static AtkTextAttribute atk_text_attribute_misspelled = ATK_TEXT_ATTR_INVALID;
+// --> OD 2010-03-01 #i92232#
+static AtkTextAttribute atk_text_attribute_tracked_change = ATK_TEXT_ATTR_INVALID;
+// <--
+// --> OD 2010-03-05 #i92233#
+static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INVALID;
+// <--
/*****************************************************************************/
@@ -103,6 +109,9 @@ enum ExportedAttribute
TEXT_ATTRIBUTE_STRIKETHROUGH,
TEXT_ATTRIBUTE_UNDERLINE,
TEXT_ATTRIBUTE_WEIGHT,
+ // --> OD 2010-03-05 #i92233#
+ TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO,
+ // <--
TEXT_ATTRIBUTE_JUSTIFICATION,
TEXT_ATTRIBUTE_BOTTOM_MARGIN,
TEXT_ATTRIBUTE_FIRST_LINE_INDENT,
@@ -137,6 +146,9 @@ static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] =
"CharStrikeout", // TEXT_ATTRIBUTE_STRIKETHROUGH
"CharUnderline", // TEXT_ATTRIBUTE_UNDERLINE
"CharWeight", // TEXT_ATTRIBUTE_WEIGHT
+ // --> OD 2010-03-05 #i92233#
+ "MMToPixelRatio", // TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO
+ // <--
"ParaAdjust", // TEXT_ATTRIBUTE_JUSTIFICATION
"ParaBottomMargin", // TEXT_ATTRIBUTE_BOTTOM_MARGIN
"ParaFirstLineIndent", // TEXT_ATTRIBUTE_FIRST_LINE_INDENT
@@ -1293,6 +1305,14 @@ attribute_set_new_from_property_values(
attribute_set = attribute_set_prepend(attribute_set, atk_text_attribute_tab_stops,
get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_TAB_STOPS], TabStops2String));
+ // --> OD 2010-03-05 #i92233#
+ if( ATK_TEXT_ATTR_INVALID == atk_text_attribute_mm_to_pixel_ratio )
+ atk_text_attribute_mm_to_pixel_ratio = atk_text_attribute_register("mm-to-pixel-ratio");
+
+ attribute_set = attribute_set_prepend( attribute_set, atk_text_attribute_mm_to_pixel_ratio,
+ get_value(rAttributeList, aIndexList[TEXT_ATTRIBUTE_MM_TO_PIXEL_RATIO], Float2String));
+ // <--
+
return attribute_set;
}
@@ -1308,6 +1328,49 @@ AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_se
return attribute_set;
}
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "insertion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "deletion" ) );
+
+ return attribute_set;
+}
+
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set )
+{
+ if ( ATK_TEXT_ATTR_INVALID == atk_text_attribute_tracked_change )
+ {
+ atk_text_attribute_tracked_change = atk_text_attribute_register( "text-tracked-change" );
+ }
+
+ attribute_set = attribute_set_prepend( attribute_set,
+ atk_text_attribute_tracked_change,
+ g_strdup_printf( "attribute-change" ) );
+
+ return attribute_set;
+}
+// <--
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atktextattributes.hxx b/vcl/unx/gtk/a11y/atktextattributes.hxx
index e363460bb578..9c7628bf927e 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.hxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.hxx
@@ -45,5 +45,10 @@ attribute_set_map_to_property_values(
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rValueList );
AtkAttributeSet* attribute_set_prepend_misspelled( AtkAttributeSet* attribute_set );
+// --> OD 2010-03-01 #i92232#
+AtkAttributeSet* attribute_set_prepend_tracked_change_insertion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_deletion( AtkAttributeSet* attribute_set );
+AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttributeSet* attribute_set );
+// <--
#endif
diff --git a/vcl/unx/gtk/a11y/atkwindow.cxx b/vcl/unx/gtk/a11y/atkwindow.cxx
index f588c1e345e4..5448235998e8 100644
--- a/vcl/unx/gtk/a11y/atkwindow.cxx
+++ b/vcl/unx/gtk/a11y/atkwindow.cxx
@@ -143,6 +143,22 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *)
return FALSE;
}
+static gboolean ooo_tooltip_map( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, TRUE );
+ return FALSE;
+}
+
+static gboolean ooo_tooltip_unmap( GtkWidget* pToolTip, gpointer )
+{
+ AtkObject* pAccessible = gtk_widget_get_accessible( pToolTip );
+ if( pAccessible )
+ atk_object_notify_state_change( pAccessible, ATK_STATE_SHOWING, FALSE );
+ return FALSE;
+}
+
/*****************************************************************************/
static bool
@@ -208,6 +224,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
g_signal_connect_after( GTK_WIDGET( data ), "focus-out-event",
G_CALLBACK (ooo_window_wrapper_real_focus_gtk),
NULL);
+
+ if( obj->role == ATK_ROLE_TOOL_TIP )
+ {
+ g_signal_connect_after( GTK_WIDGET( data ), "map-event",
+ G_CALLBACK (ooo_tooltip_map),
+ NULL);
+ g_signal_connect_after( GTK_WIDGET( data ), "unmap-event",
+ G_CALLBACK (ooo_tooltip_unmap),
+ NULL);
+ }
}
/*****************************************************************************/
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 5beb838c0e82..10f75309708d 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -283,7 +283,9 @@ static AtkRole mapToAtkRole( sal_Int16 nRole )
ATK_ROLE_RULER,
ATK_ROLE_UNKNOWN, // SECTION - registered below
ATK_ROLE_UNKNOWN, // TREE_ITEM - registered below
- ATK_ROLE_TREE_TABLE
+ ATK_ROLE_TREE_TABLE,
+ ATK_ROLE_SCROLL_PANE, // COMMENT - mapped to atk_role_scroll_pane
+ ATK_ROLE_UNKNOWN // COMMENT_END - mapped to atk_role_unknown
};
static bool initialized = false;
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index d1e5c5954352..f63f999738a7 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -800,15 +800,12 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
*/
bool bDispatchThread = false;
+ gboolean wasEvent = FALSE;
{
// release YieldMutex (and re-acquire at block end)
YieldMutexReleaser aReleaser;
if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
- {
- // we are the dispatch thread
- osl_resetCondition( m_aDispatchCondition );
bDispatchThread = true;
- }
else if( ! bWait )
return; // someone else is waiting already, return
@@ -816,7 +813,7 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
- gboolean wasEvent = FALSE, wasOneEvent = TRUE;
+ gboolean wasOneEvent = TRUE;
while( nMaxEvents-- && wasOneEvent )
{
wasOneEvent = g_main_context_iteration( NULL, FALSE );
@@ -824,17 +821,17 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
wasEvent = TRUE;
}
if( bWait && ! wasEvent )
- g_main_context_iteration( NULL, TRUE );
+ wasEvent = g_main_context_iteration( NULL, TRUE );
}
- else if( userEventFn( this ) )
+ else if( bWait )
{
/* #i41693# in case the dispatch thread hangs in join
* for this thread the condition will never be set
* workaround: timeout of 1 second a emergency exit
*/
- TimeValue aValue;
- aValue.Seconds = 1;
- aValue.Nanosec = 0;
+ // we are the dispatch thread
+ osl_resetCondition( m_aDispatchCondition );
+ TimeValue aValue = { 1, 0 };
osl_waitCondition( m_aDispatchCondition, &aValue );
}
}
@@ -842,8 +839,8 @@ void GtkXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if( bDispatchThread )
{
osl_releaseMutex( m_aDispatchMutex );
- osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
- osl_resetCondition( m_aDispatchCondition );
+ if( wasEvent )
+ osl_setCondition( m_aDispatchCondition ); // trigger non dispatch thread yields
}
}
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index ef356eb57aa9..3d11ce8a37ea 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon()
m_nExtStyle = 0;
m_pRegion = NULL;
m_ePointerStyle = 0xffff;
+ m_bSetFocusOnMap = false;
gtk_widget_set_app_paintable( m_pWindow, TRUE );
gtk_widget_set_double_buffered( m_pWindow, FALSE );
@@ -690,7 +691,7 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
XFree( pHints );
if (GetX11SalData()->GetDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz"))
- return;
+ return;
/* remove WM_TAKE_FOCUS protocol; this would usually be the
* right thing, but gtk handles it internally whereas we
@@ -803,18 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
( ! (nStyle & SAL_FRAME_STYLE_FLOAT) ||
(nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) );
- /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME
- at some point that may be fixed in metacity and we will have to revisit this
- */
-
- // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack
- // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues
- // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo.
- // As a work around for such old systems, people might consider to not use the GTK plugin.
-
- bool bMetaCityToolWindowHack = false;
- // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW );
-
if( bDecoHandling )
{
bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) );
@@ -830,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
{
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true );
- if( bMetaCityToolWindowHack )
- lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true );
}
else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
{
@@ -844,7 +831,8 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
}
- if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
{
eType = GDK_WINDOW_TYPE_HINT_TOOLBAR;
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), true );
@@ -881,7 +869,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
if( bDecoHandling )
{
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE );
- if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack )
+ if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) )
lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false );
}
@@ -1304,7 +1292,8 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
{
if( m_pWindow )
{
- if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN) )
+ if( m_pParent && (m_pParent->m_nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
gtk_window_set_keep_above( GTK_WINDOW(m_pWindow), bVisible );
if( bVisible )
{
@@ -1364,9 +1353,9 @@ 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 bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity");
if( nUserTime == 0 &&
- (
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
+ ( bMetaCity ||
(
getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") &&
(m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION))
@@ -1378,9 +1367,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
nUserTime= getDisplay()->GetLastUserEventTime( true );
//nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window);
}
-
lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime );
+ if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
+ m_bSetFocusOnMap = true;
+
gtk_widget_show( m_pWindow );
if( isFloatGrabWindow() )
@@ -1465,6 +1456,12 @@ void GtkSalFrame::setMinMaxSize()
aHints |= GDK_HINT_MAX_SIZE;
}
}
+ if( m_bFullscreen )
+ {
+ aGeo.max_width = m_aMaxSize.Width();
+ aGeo.max_height = m_aMaxSize.Height();
+ aHints |= GDK_HINT_MAX_SIZE;
+ }
if( aHints )
gtk_window_set_geometry_hints( GTK_WINDOW(m_pWindow),
NULL,
@@ -1816,8 +1813,6 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ),
Size( maGeometry.nWidth, maGeometry.nHeight ) );
- // workaround different window managers have different opinions about
- // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
if( bVisible )
Show( FALSE );
@@ -1834,12 +1829,22 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
gtk_window_move( GTK_WINDOW(m_pWindow),
maGeometry.nX = aNewPosSize.Left(),
maGeometry.nY = aNewPosSize.Top() );
+ // #i110881# for the benefit of compiz set a max size here
+ // else setting to fullscreen fails for unknown reasons
+ m_aMaxSize.Width() = aNewPosSize.GetWidth()+100;
+ m_aMaxSize.Height() = aNewPosSize.GetHeight()+100;
+ // workaround different legacy version window managers have different opinions about
+ // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
if( bVisible )
Show( TRUE );
}
else
{
bool bVisible = GTK_WIDGET_MAPPED(m_pWindow);
+ if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
if( bVisible )
Show( FALSE );
m_nStyle &= ~SAL_FRAME_STYLE_PARTIAL_FULLSCREEN;
@@ -1862,8 +1867,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
{
if( bFullScreen )
{
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), TRUE );
+ 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) );
moveToScreen( nScreen );
Size aScreenSize = pDisp->GetScreenSize( m_nScreen );
@@ -1875,8 +1883,11 @@ void GtkSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
else
{
gtk_window_unfullscreen( GTK_WINDOW(m_pWindow) );
- if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
- gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ if( getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ {
+ if( !(m_nStyle & SAL_FRAME_STYLE_SIZEABLE) )
+ gtk_window_set_resizable( GTK_WINDOW(m_pWindow), FALSE );
+ }
moveToScreen( nScreen );
}
}
@@ -2848,6 +2859,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
GTK_YIELD_GRAB();
+ bool bSetFocus = pThis->m_bSetFocusOnMap;
+ pThis->m_bSetFocusOnMap = false;
if( ImplGetSVData()->mbIsTestTool )
{
/* #i76541# testtool needs the focus to be in a new document
@@ -2857,9 +2870,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
* so this is done when running in testtool only
*/
if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 )
- XSetInputFocus( pThis->getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
- RevertToParent, CurrentTime );
+ bSetFocus = true;
+ }
+
+ if( bSetFocus )
+ {
+ XSetInputFocus( pThis->getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
+ RevertToParent, CurrentTime );
}
pThis->CallCallback( SALEVENT_RESIZE, NULL );
@@ -3184,6 +3202,15 @@ gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame
}
pThis->m_nState = pEvent->window_state.new_window_state;
+ #if OSL_DEBUG_LEVEL > 1
+ if( (pEvent->window_state.changed_mask & GDK_WINDOW_STATE_FULLSCREEN) )
+ {
+ fprintf( stderr, "window %p %s full screen state\n",
+ pThis,
+ (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? "enters" : "leaves");
+ }
+ #endif
+
return FALSE;
}
diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 0a91d99fd839..88a26b401eed 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -185,6 +185,7 @@ class GtkSalFrame : public SalFrame
bool m_bDefaultSize;
bool m_bSendModChangeOnRelease;
bool m_bWindowIsGtkPlug;
+ bool m_bSetFocusOnMap;
String m_aTitle;
IMHandler* m_pIMHandler;
diff --git a/vcl/unx/inc/saldata.hxx b/vcl/unx/inc/saldata.hxx
index 3810558d470d..7e38e0a89bf2 100644
--- a/vcl/unx/inc/saldata.hxx
+++ b/vcl/unx/inc/saldata.hxx
@@ -62,6 +62,7 @@ protected:
SalXLib *pXLib_;
SalDisplay *m_pSalDisplay;
pthread_t hMainThread_;
+ rtl::OUString maLocalHostName;
public:
X11SalData();
@@ -87,6 +88,9 @@ public:
inline void StopTimer();
void Timeout() const;
+ const rtl::OUString& GetLocalHostName() const
+ { return maLocalHostName; }
+
static int XErrorHdl( Display*, XErrorEvent* );
static int XIOErrorHdl( Display* );
diff --git a/vcl/unx/inc/wmadaptor.hxx b/vcl/unx/inc/wmadaptor.hxx
index c628cfe091ef..cbedede2cc99 100644
--- a/vcl/unx/inc/wmadaptor.hxx
+++ b/vcl/unx/inc/wmadaptor.hxx
@@ -58,6 +58,8 @@ public:
NET_WM_NAME,
NET_WM_DESKTOP,
NET_WM_ICON_NAME,
+ NET_WM_PID,
+ NET_WM_PING,
NET_WM_STATE,
NET_WM_STATE_MAXIMIZED_HORZ,
NET_WM_STATE_MAXIMIZED_VERT,
@@ -160,6 +162,7 @@ protected:
m_aWMWorkAreas;
bool m_bTransientBehaviour;
bool m_bEnableAlwaysOnTopWorks;
+ bool m_bLegacyPartialFullscreen;
int m_nWinGravity;
int m_nInitWinGravity;
@@ -220,6 +223,18 @@ public:
virtual void setWMName( X11SalFrame* pFrame, const String& rWMName ) const;
/*
+ * set NET_WM_PID
+ */
+ virtual void setPID( X11SalFrame* pFrame ) const;
+
+ /*
+ * set WM_CLIENT_MACHINE
+ */
+ virtual void setClientMachine( X11SalFrame* pFrame ) const;
+
+ virtual void answerPing( X11SalFrame*, XClientMessageEvent* ) const;
+
+ /*
* maximizes frame
* maximization can be toggled in either direction
* to get the original position and size
@@ -231,6 +246,15 @@ public:
*/
virtual void showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const;
/*
+ * tell whether legacy partial full screen handling is necessary
+ * see #i107249#: NET_WM_STATE_FULLSCREEN is not well defined, but de facto
+ * modern WM's interpret it the "right" way, namely they make "full screen"
+ * taking twin view or Xinerama into accound and honor the positioning hints
+ * to see which screen actually was meant to use for fullscreen.
+ */
+ bool isLegacyPartialFullscreen() const
+ { return m_bLegacyPartialFullscreen; }
+ /*
* set window struts
*/
virtual void setFrameStruts( X11SalFrame*pFrame,
diff --git a/vcl/unx/source/app/saldata.cxx b/vcl/unx/source/app/saldata.cxx
index 4155887a9875..75d18de0787a 100644
--- a/vcl/unx/source/app/saldata.cxx
+++ b/vcl/unx/source/app/saldata.cxx
@@ -276,6 +276,7 @@ X11SalData::X11SalData()
m_pPlugin = NULL;
hMainThread_ = pthread_self();
+ osl_getLocalHostname( &maLocalHostName.pData );
}
X11SalData::~X11SalData()
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 2ed699ad0eb5..aa2afab93657 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -322,12 +322,12 @@ sal_IsLocalDisplay( Display *pDisplay )
if( pPtr != NULL )
{
- OUString aLocalHostname;
- if( osl_getLocalHostname( &aLocalHostname.pData ) == osl_Socket_Ok)
+ const OUString& rLocalHostname( GetX11SalData()->GetLocalHostName() );
+ if( rLocalHostname.getLength() )
{
*pPtr = '\0';
OUString aDisplayHostname( pDisplayHost, strlen( pDisplayHost ), osl_getThreadTextEncoding() );
- bEqual = sal_EqualHosts( aLocalHostname, aDisplayHostname );
+ bEqual = sal_EqualHosts( rLocalHostname, aDisplayHostname );
bEqual = bEqual && sal_IsDisplayNumber( pPtr + 1 );
}
}
diff --git a/vcl/unx/source/app/wmadaptor.cxx b/vcl/unx/source/app/wmadaptor.cxx
index 89c8bb56291c..fb2317e19573 100644
--- a/vcl/unx/source/app/wmadaptor.cxx
+++ b/vcl/unx/source/app/wmadaptor.cxx
@@ -34,6 +34,7 @@
#include <sal/alloca.h>
#include <wmadaptor.hxx>
#include <saldisp.hxx>
+#include <saldata.hxx>
#include <salframe.h>
#include <vcl/salgdi.hxx>
#include <osl/thread.h>
@@ -118,6 +119,7 @@ static const WMAdaptorProtocol aProtocolTab[] =
{ "_NET_NUMBER_OF_DESKTOPS", WMAdaptor::NET_NUMBER_OF_DESKTOPS },
{ "_NET_WM_DESKTOP", WMAdaptor::NET_WM_DESKTOP },
{ "_NET_WM_ICON_NAME", WMAdaptor::NET_WM_ICON_NAME },
+ { "_NET_WM_PING", WMAdaptor::NET_WM_PING },
{ "_NET_WM_STATE", WMAdaptor::NET_WM_STATE },
{ "_NET_WM_STATE_ABOVE", WMAdaptor::NET_WM_STATE_STAYS_ON_TOP },
{ "_NET_WM_STATE_FULLSCREEN", WMAdaptor::NET_WM_STATE_FULLSCREEN },
@@ -179,7 +181,8 @@ static const WMAdaptorProtocol aAtomTab[] =
{ "_XSETTINGS_SETTINGS", WMAdaptor::XSETTINGS },
{ "_XEMBED", WMAdaptor::XEMBED },
{ "_XEMBED_INFO", WMAdaptor::XEMBED_INFO },
- { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME }
+ { "_NET_WM_USER_TIME", WMAdaptor::NET_WM_USER_TIME },
+ { "_NET_WM_PID", WMAdaptor::NET_WM_PID }
};
extern "C" {
@@ -233,6 +236,7 @@ WMAdaptor::WMAdaptor( SalDisplay* pDisplay ) :
m_pSalDisplay( pDisplay ),
m_bTransientBehaviour( true ),
m_bEnableAlwaysOnTopWorks( false ),
+ m_bLegacyPartialFullscreen( false ),
m_nWinGravity( StaticGravity ),
m_nInitWinGravity( StaticGravity )
{
@@ -909,6 +913,40 @@ bool WMAdaptor::getNetWmName()
XFree( pProperty );
pProperty = NULL;
}
+ // if this is metacity, check for version to enable a legacy workaround
+ if( m_aWMName.EqualsAscii( "Metacity" ) )
+ {
+ int nVersionMajor = 0, nVersionMinor = 0;
+ Atom nVersionAtom = XInternAtom( m_pDisplay, "_METACITY_VERSION", True );
+ if( nVersionAtom )
+ {
+ if( XGetWindowProperty( m_pDisplay,
+ aWMChild,
+ nVersionAtom,
+ 0, 256,
+ False,
+ m_aWMAtoms[ UTF8_STRING ],
+ &aRealType,
+ &nFormat,
+ &nItems,
+ &nBytesLeft,
+ &pProperty ) == 0
+ && nItems != 0
+ )
+ {
+ String aMetaVersion( (sal_Char*)pProperty, nItems, RTL_TEXTENCODING_UTF8 );
+ nVersionMajor = aMetaVersion.GetToken( 0, '.' ).ToInt32();
+ nVersionMinor = aMetaVersion.GetToken( 1, '.' ).ToInt32();
+ }
+ if( pProperty )
+ {
+ XFree( pProperty );
+ pProperty = NULL;
+ }
+ }
+ if( nVersionMajor < 2 || (nVersionMajor == 2 && nVersionMinor < 12) )
+ m_bLegacyPartialFullscreen = true;
+ }
}
}
else if( pProperty )
@@ -2412,3 +2450,52 @@ void NetWMAdaptor::setUserTime( X11SalFrame* i_pFrame, long i_nUserTime ) const
);
}
}
+
+/*
+ * WMAdaptor::setPID
+ */
+void WMAdaptor::setPID( X11SalFrame* i_pFrame ) const
+{
+ if( m_aWMAtoms[NET_WM_PID] )
+ {
+ long nPID = (long)getpid();
+ XChangeProperty( m_pDisplay,
+ i_pFrame->GetShellWindow(),
+ m_aWMAtoms[NET_WM_PID],
+ XA_CARDINAL,
+ 32,
+ PropModeReplace,
+ (unsigned char*)&nPID,
+ 1
+ );
+ }
+}
+
+/*
+* WMAdaptor::setClientMachine
+*/
+void WMAdaptor::setClientMachine( X11SalFrame* i_pFrame ) const
+{
+ rtl::OString aWmClient( rtl::OUStringToOString( GetX11SalData()->GetLocalHostName(), RTL_TEXTENCODING_ASCII_US ) );
+ XTextProperty aClientProp = { (unsigned char*)aWmClient.getStr(), XA_STRING, 8, aWmClient.getLength() };
+ XSetWMClientMachine( m_pDisplay, i_pFrame->GetShellWindow(), &aClientProp );
+}
+
+void WMAdaptor::answerPing( X11SalFrame* i_pFrame, XClientMessageEvent* i_pEvent ) const
+{
+ if( m_aWMAtoms[NET_WM_PING] &&
+ i_pEvent->message_type == m_aWMAtoms[ WM_PROTOCOLS ] &&
+ (Atom)i_pEvent->data.l[0] == m_aWMAtoms[ NET_WM_PING ] )
+ {
+ XEvent aEvent;
+ aEvent.xclient = *i_pEvent;
+ aEvent.xclient.window = m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() );
+ XSendEvent( m_pDisplay,
+ m_pSalDisplay->GetRootWindow( i_pFrame->GetScreenNumber() ),
+ False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ &aEvent
+ );
+ XFlush( m_pDisplay );
+ }
+}
diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx
index 2d63489dac3d..7f205407b21b 100644
--- a/vcl/unx/source/dtrans/X11_selection.cxx
+++ b/vcl/unx/source/dtrans/X11_selection.cxx
@@ -70,6 +70,7 @@
#include <osl/process.h>
#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
#define DRAG_EVENT_MASK ButtonPressMask |\
ButtonReleaseMask |\
@@ -3807,7 +3808,10 @@ void SelectionManager::shutdown() throw()
*/
aGuard.clear();
while (osl_isThreadRunning(m_aThread))
+ {
+ vos::OGuard guard2(Application::GetSolarMutex());
Application::Reschedule();
+ }
osl_joinWithThread( m_aThread );
osl_destroyThread( m_aThread );
m_aThread = NULL;
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 7cf2009a3e07..f00ee26c0d4d 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -641,13 +641,11 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
mpServerFont[ nFallbackLevel ] = pServerFont;
// apply font specific-hint settings if needed
+ // TODO: also disable it for reference devices
if( !bPrinter_ )
{
- // TODO: is it worth it to cache the hint settings, e.g. in the ImplFontEntry?
- ImplFontOptions aFontOptions;
- bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions&);
- if( GetFCFontOptions( *pEntry->mpFontData, pEntry->mnHeight, aFontOptions ) )
- pServerFont->SetFontOptions( aFontOptions );
+ ImplServerFontEntry* pSFE = static_cast<ImplServerFontEntry*>( pEntry->mpFontEntry );
+ pSFE->HandleFontOptions();
}
return true;
@@ -656,6 +654,24 @@ bool X11SalGraphics::setFont( const ImplFontSelectData *pEntry, int nFallbackLev
return false;
}
+void ImplServerFontEntry::HandleFontOptions( void )
+{
+ bool GetFCFontOptions( const ImplFontAttributes&, int nSize, ImplFontOptions& );
+
+ if( !mpServerFont )
+ return;
+ if( !mbGotFontOptions )
+ {
+ // get and cache the font options
+ mbGotFontOptions = true;
+ mbValidFontOptions = GetFCFontOptions( *maFontSelData.mpFontData,
+ maFontSelData.mnHeight, maFontOptions );
+ }
+ // apply the font options
+ if( mbValidFontOptions )
+ mpServerFont->SetFontOptions( maFontOptions );
+}
+
//--------------------------------------------------------------------------
inline sal_Unicode SwapBytes( const sal_Unicode nIn )
@@ -1633,11 +1649,13 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* )
void cairosubcallback( void* pPattern )
{
CairoWrapper& rCairo = CairoWrapper::get();
- if( rCairo.isValid() )
- {
+ if( !rCairo.isValid() )
+ return;
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rCairo.ft_font_options_substitute( rStyleSettings.GetCairoFontOptions(), pPattern);
- }
+ const void* pFontOptions = rStyleSettings.GetCairoFontOptions();
+ if( !pFontOptions )
+ return;
+ rCairo.ft_font_options_substitute( pFontOptions, pPattern );
}
bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
@@ -1664,7 +1682,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
default:
aInfo.m_eItalic = psp::italic::Unknown;
break;
-
}
// set weight
switch( rFontAttributes.GetWeight() )
@@ -1740,7 +1757,6 @@ bool GetFCFontOptions( const ImplFontAttributes& rFontAttributes, int nSize,
const psp::PrintFontManager& rPFM = psp::PrintFontManager::get();
bool bOK = rPFM.getFontOptions( aInfo, nSize, cairosubcallback, rFontOptions);
-
return bOK;
}
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index c42c22bc0592..a438760cffba 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -98,6 +98,14 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
{
pCloseModule = NULL;
}
+ /*
+ * #i109007# KDE3 seems to have the same problem; an atexit cleanup
+ * handler, which cannot be resolved anymore if the plugin is already unloaded.
+ */
+ else if( rModuleBase.equalsAscii("kde") )
+ {
+ pCloseModule = NULL;
+ }
GetSalData()->m_pPlugin = aMod;
}
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index 5b538626a634..6d243e41db8c 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -528,6 +528,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
Atom a[4];
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
if( ! s_pSaveYourselfFrame && ! mpParent)
{
// at all times have only one frame with SaveYourself
@@ -549,11 +551,23 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
pHints->win_gravity = GetDisplay()->getWMAdaptor()->getPositionWinGravity();
pHints->x = 0;
pHints->y = 0;
+ if( mbFullScreen )
+ {
+ pHints->flags |= PMaxSize | PMinSize;
+ pHints->max_width = w+100;
+ pHints->max_height = h+100;
+ pHints->min_width = w;
+ pHints->min_height = h;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
XFree (pHints);
+ // set PID and WM_CLIENT_MACHINE
+ pDisplay_->getWMAdaptor()->setClientMachine( this );
+ pDisplay_->getWMAdaptor()->setPID( this );
+
// set client leader
if( aClientLeader )
{
@@ -605,7 +619,8 @@ void X11SalFrame::Init( ULONG nSalFrameStyle, int nScreen, SystemParentData* pPa
eType = WMAdaptor::windowType_Utility;
if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
eType = WMAdaptor::windowType_Toolbar;
- if( nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN )
+ if( (nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN)
+ && GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
eType = WMAdaptor::windowType_Dock;
GetDisplay()->getWMAdaptor()->
@@ -735,6 +750,8 @@ void X11SalFrame::passOnSaveYourSelf()
int n = 0;
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_DELETE_WINDOW );
a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::WM_SAVE_YOURSELF );
+ if( pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING ) )
+ a[n++] = pDisplay_->getWMAdaptor()->getAtom( WMAdaptor::NET_WM_PING );
XSetWMProtocols( GetXDisplay(), s_pSaveYourselfFrame->GetShellWindow(), a, n );
}
}
@@ -1130,7 +1147,7 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
// even though transient frames should be kept above their parent
// this does not necessarily hold true for DOCK type windows
// so artificially set ABOVE and remove it again on hide
- if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) )
+ if( mpParent && (mpParent->nStyle_ & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) && pDisplay_->getWMAdaptor()->isLegacyPartialFullscreen())
pDisplay_->getWMAdaptor()->enableAlwaysOnTop( this, bVisible );
bMapped_ = bVisible;
@@ -1322,11 +1339,6 @@ void X11SalFrame::Show( BOOL bVisible, BOOL bNoActivate )
}
else
{
-#if OSL_DEBUG_LEVEL > 1
- if( nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION )
- fprintf( stderr, "hide on ownerdraw\n" );
-#endif
-
if( getInputContext() )
getInputContext()->Unmap( this );
@@ -1616,6 +1628,7 @@ void X11SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHOR
}
else
SetPosSize( aPosSize );
+
bDefaultPosition_ = False;
}
@@ -2042,6 +2055,12 @@ void X11SalFrame::SetPosSize( const Rectangle &rPosSize )
pHints->y = values.y;
pHints->win_gravity = pDisplay_->getWMAdaptor()->getPositionWinGravity();
}
+ if( mbFullScreen )
+ {
+ pHints->max_width = 10000;
+ pHints->max_height = 10000;
+ pHints->flags |= PMaxSize;
+ }
XSetWMNormalHints( GetXDisplay(),
GetShellWindow(),
pHints );
@@ -2199,28 +2218,15 @@ void X11SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nScreen )
maGeometry.nWidth = aRect.GetWidth();
maGeometry.nHeight = aRect.GetHeight();
mbMaximizedHorz = mbMaximizedVert = false;
+ mbFullScreen = true;
createNewWindow( None, m_nScreen );
- GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
- #if 0
- // this would give additional intent to the window
- // manager to force the positioning of the window;
- // alas all other windows will be expunged from that
- // region, leaving us in a pity state afterwards
- Size aScreenSize = pDisplay_->GetScreenSize( m_nScreen );
- pDisplay_->getWMAdaptor()->setFrameStruts( this,
- aRect.Left(), aRect.Top(),
- aScreenSize.Width() - aRect.Right(),
- aScreenSize.Height() - aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom(),
- aRect.Left(), aRect.Right(),
- aRect.Top(), aRect.Bottom()
- );
- #endif
-
+ if( GetDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
+ GetDisplay()->getWMAdaptor()->enableAlwaysOnTop( this, true );
+ else
+ GetDisplay()->getWMAdaptor()->showFullScreen( this, true );
if( bVisible )
Show(TRUE);
- mbFullScreen = true;
+
}
else
{
@@ -3927,52 +3933,56 @@ long X11SalFrame::HandleClientMessage( XClientMessageEvent *pEvent )
Close(); // ???
return 1;
}
- else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS )
- && ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
- && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
- )
+ else if( pEvent->message_type == rWMAdaptor.getAtom( WMAdaptor::WM_PROTOCOLS ) )
{
- if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
- {
- Close();
- return 1;
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
- {
- // do nothing, we set the input focus in ToTop() if necessary
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
- (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
- "ownerdraw" : "NON OWNERDRAW" );
-#endif
- }
- else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::NET_WM_PING ) )
+ rWMAdaptor.answerPing( this, pEvent );
+ else if( ! ( nStyle_ & SAL_FRAME_STYLE_PLUG )
+ && ! (( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && (nStyle_ & SAL_FRAME_STYLE_OWNERDRAWDECORATION))
+ )
{
- bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
-
- if( ! bSession )
+ if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_DELETE_WINDOW ) )
+ {
+ Close();
+ return 1;
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_TAKE_FOCUS ) )
{
- if( this == s_pSaveYourselfFrame )
+ // do nothing, we set the input focus in ToTop() if necessary
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "got WM_TAKE_FOCUS on %s window\n",
+ (nStyle_&SAL_FRAME_STYLE_OWNERDRAWDECORATION) ?
+ "ownerdraw" : "NON OWNERDRAW" );
+ #endif
+ }
+ else if( (Atom)pEvent->data.l[0] == rWMAdaptor.getAtom( WMAdaptor::WM_SAVE_YOURSELF ) )
+ {
+ bool bSession = rWMAdaptor.getWindowManagerName().EqualsAscii( "Dtwm" );
+
+ if( ! bSession )
{
- ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
- const char* argv[2];
- argv[0] = "/bin/sh";
- argv[1] = const_cast<char*>(aExec.GetBuffer());
-#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
-#endif
- XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ if( this == s_pSaveYourselfFrame )
+ {
+ ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() );
+ const char* argv[2];
+ argv[0] = "/bin/sh";
+ argv[1] = const_cast<char*>(aExec.GetBuffer());
+ #if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "SaveYourself request, setting command: %s %s\n", argv[0], argv[1] );
+ #endif
+ XSetCommand( GetXDisplay(), GetShellWindow(), (char**)argv, 2 );
+ }
+ else
+ // can only happen in race between WM and window closing
+ XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
}
else
- // can only happen in race between WM and window closing
- XChangeProperty( GetXDisplay(), GetShellWindow(), rWMAdaptor.getAtom( WMAdaptor::WM_COMMAND ), XA_STRING, 8, PropModeReplace, (unsigned char*)"", 0 );
- }
- else
- {
- // save open documents; would be good for non Dtwm, too,
- // but there is no real Shutdown message in the ancient
- // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
- IceSalSession::handleOldX11SaveYourself( this );
+ {
+ // save open documents; would be good for non Dtwm, too,
+ // but there is no real Shutdown message in the ancient
+ // SM protocol; on Dtwm SaveYourself really means Shutdown, too.
+ IceSalSession::handleOldX11SaveYourself( this );
+ }
}
}
}
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index ebe470d3eb7e..1638c4e1bd36 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -47,11 +47,15 @@
#include "vcl/fontsubset.hxx"
#include "vcl/sallayout.hxx"
+#include "vcl/outdev.h" // for ImplGlyphFallbackFontSubstitution
+#include "unotools/fontcfg.hxx" // for IMPL_FONT_ATTR_SYMBOL
+
#include "rtl/logfile.hxx"
#include "rtl/tencinfo.h"
#include "rtl/textcvt.h"
#include "rtl/bootstrap.hxx"
+#include "i18npool/mslangid.hxx"
#include "osl/module.h"
#include "osl/file.hxx"
@@ -82,7 +86,6 @@
#include <set>
#include <map>
-
using namespace vcl;
static const int MAXFONTHEIGHT = 2048;
@@ -314,6 +317,308 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
}
}
+// ===========================================================================
+// platform specific font substitution hooks for glyph fallback enhancement
+// TODO: move into i18n module (maybe merge with svx/ucsubset.*
+// or merge with i18nutil/source/utility/unicode_data.h)
+struct Unicode2LangType
+{
+ sal_UCS4 mnMinCode;
+ sal_UCS4 mnMaxCode;
+ LanguageType mnLangID;
+};
+
+// entries marked with default-CJK get replaced with the default-CJK language
+#define LANGUAGE_DEFAULT_CJK 0xFFF0
+
+// map unicode ranges to languages supported by OOo
+// NOTE: due to the binary search used this list must be sorted by mnMinCode
+static Unicode2LangType aLangFromCodeChart[]= {
+ {0x0000, 0x007F, LANGUAGE_ENGLISH}, // Basic Latin
+ {0x0080, 0x024F, LANGUAGE_ENGLISH}, // Latin Extended-A and Latin Extended-B
+ {0x0250, 0x02AF, LANGUAGE_SYSTEM}, // IPA Extensions
+ {0x0370, 0x03FF, LANGUAGE_GREEK}, // Greek
+ {0x0590, 0x05FF, LANGUAGE_HEBREW}, // Hebrew
+ {0x0600, 0x06FF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic
+ {0x0900, 0x097F, LANGUAGE_HINDI}, // Devanagari
+ {0x0980, 0x09FF, LANGUAGE_BENGALI}, // Bengali
+ {0x0A80, 0x0AFF, LANGUAGE_GUJARATI}, // Gujarati
+ {0x0B00, 0x0B7F, LANGUAGE_ORIYA}, // Oriya
+ {0x0B80, 0x0BFF, LANGUAGE_TAMIL}, // Tamil
+ {0x0C00, 0x0C7F, LANGUAGE_TELUGU}, // Telugu
+ {0x0C80, 0x0CFF, LANGUAGE_KANNADA}, // Kannada
+ {0x0D00, 0x0D7F, LANGUAGE_MALAYALAM}, // Malayalam
+ {0x0D80, 0x0D7F, LANGUAGE_SINHALESE_SRI_LANKA}, // Sinhala
+ {0x0E00, 0x0E7F, LANGUAGE_THAI}, // Thai
+ {0x0E80, 0x0EFF, LANGUAGE_LAO}, // Lao
+ {0x0F00, 0x0FFF, LANGUAGE_TIBETAN}, // Tibetan
+ {0x1000, 0x109F, LANGUAGE_BURMESE}, // Burmese
+ {0x10A0, 0x10FF, LANGUAGE_GEORGIAN}, // Georgian
+ {0x1100, 0x11FF, LANGUAGE_KOREAN}, // Hangul Jamo, Korean-specific
+// {0x1200, 0x139F, LANGUAGE_AMHARIC_ETHIOPIA}, // Ethiopic
+// {0x1200, 0x139F, LANGUAGE_TIGRIGNA_ETHIOPIA}, // Ethiopic
+ {0x13A0, 0x13FF, LANGUAGE_CHEROKEE_UNITED_STATES}, // Cherokee
+// {0x1400, 0x167F, LANGUAGE_CANADIAN_ABORIGINAL}, // Canadian Aboriginial Syllabics
+// {0x1680, 0x169F, LANGUAGE_OGHAM}, // Ogham
+// {0x16A0, 0x16F0, LANGUAGE_RUNIC}, // Runic
+// {0x1700, 0x171F, LANGUAGE_TAGALOG}, // Tagalog
+// {0x1720, 0x173F, LANGUAGE_HANUNOO}, // Hanunoo
+// {0x1740, 0x175F, LANGUAGE_BUHID}, // Buhid
+// {0x1760, 0x177F, LANGUAGE_TAGBANWA}, // Tagbanwa
+ {0x1780, 0x17FF, LANGUAGE_KHMER}, // Khmer
+ {0x18A0, 0x18AF, LANGUAGE_MONGOLIAN}, // Mongolian
+// {0x1900, 0x194F, LANGUAGE_LIMBU}, // Limbu
+// {0x1950, 0x197F, LANGUAGE_TAILE}, // Tai Le
+// {0x1980, 0x19DF, LANGUAGE_TAILUE}, // Tai Lue
+ {0x19E0, 0x19FF, LANGUAGE_KHMER}, // Khmer Symbols
+// {0x1A00, 0x1A1F, LANGUAGE_BUGINESE}, // Buginese/Lontara
+// {0x1B00, 0x1B7F, LANGUAGE_BALINESE}, // Balinese
+// {0x1D00, 0x1DFF, LANGUAGE_NONE}, // Phonetic Symbols
+ {0x1E00, 0x1EFF, LANGUAGE_ENGLISH}, // Latin Extended Additional
+ {0x1F00, 0x1FFF, LANGUAGE_GREEK}, // Greek Extended
+ {0x2C60, 0x2C7F, LANGUAGE_ENGLISH}, // Latin Extended-C
+ {0x2E80, 0x2FFf, LANGUAGE_CHINESE_SIMPLIFIED}, // CJK Radicals Supplement + Kangxi Radical + Ideographic Description Characters
+ {0x3000, 0x303F, LANGUAGE_DEFAULT_CJK}, // CJK Symbols and punctuation
+ {0x3040, 0x30FF, LANGUAGE_JAPANESE}, // Japanese Hiragana + Katakana
+ {0x3100, 0x312F, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo
+ {0x3130, 0x318F, LANGUAGE_KOREAN}, // Hangul Compatibility Jamo, Kocrean-specific
+ {0x3190, 0x319F, LANGUAGE_JAPANESE}, // Kanbun
+ {0x31A0, 0x31BF, LANGUAGE_CHINESE_TRADITIONAL}, // Bopomofo Extended
+ {0x31C0, 0x31EF, LANGUAGE_DEFAULT_CJK}, // CJK Ideographs
+ {0x31F0, 0x31FF, LANGUAGE_JAPANESE}, // Japanese Katakana Phonetic Extensions
+ {0x3200, 0x321F, LANGUAGE_KOREAN}, // Parenthesized Hangul
+ {0x3220, 0x325F, LANGUAGE_DEFAULT_CJK}, // Parenthesized Ideographs
+ {0x3260, 0x327F, LANGUAGE_KOREAN}, // Circled Hangul
+ {0x3280, 0x32CF, LANGUAGE_DEFAULT_CJK}, // Circled Ideographs
+ {0x32d0, 0x32FF, LANGUAGE_JAPANESE}, // Japanese Circled Katakana
+ {0x3400, 0x4DBF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension A
+ {0x4E00, 0x9FCF, LANGUAGE_DEFAULT_CJK}, // Unified CJK Ideographs
+ {0xA720, 0xA7FF, LANGUAGE_ENGLISH}, // Latin Extended-D
+ {0xAC00, 0xD7AF, LANGUAGE_KOREAN}, // Hangul Syllables, Korean-specific
+ {0xF900, 0xFAFF, LANGUAGE_DEFAULT_CJK}, // CJK Compatibility Ideographs
+ {0xFB00, 0xFB4F, LANGUAGE_HEBREW}, // Hebrew Presentation Forms
+ {0xFB50, 0xFDFF, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-A
+ {0xFE70, 0xFEFE, LANGUAGE_ARABIC_PRIMARY_ONLY}, // Arabic Presentation Forms-B
+ {0xFF65, 0xFF9F, LANGUAGE_JAPANESE}, // Japanese Halfwidth Katakana variant
+ {0xFFA0, 0xFFDC, LANGUAGE_KOREAN}, // Kocrean halfwidth hangual variant
+ {0x10140, 0x1018F, LANGUAGE_GREEK}, // Ancient Greak numbers
+ {0x1D200, 0x1D24F, LANGUAGE_GREEK}, // Ancient Greek Musical
+ {0x20000, 0x2A6DF, LANGUAGE_DEFAULT_CJK}, // CJK Unified Ideographs Extension B
+ {0x2F800, 0x2FA1F, LANGUAGE_DEFAULT_CJK} // CJK Compatibility Ideographs Supplement
+};
+
+// get language matching to the missing char
+LanguageType MapCharToLanguage( sal_UCS4 uChar )
+{
+ // entries marked with default-CJK get replaced with the prefered CJK language
+ static bool bFirst = true;
+ if( bFirst )
+ {
+ bFirst = false;
+
+ // use method suggested in #i97086# to determnine the systems default language
+ // TODO: move into i18npool or sal/osl/w32/nlsupport.c
+ LanguageType nDefaultLang = 0;
+ HKEY hKey = NULL;
+ LONG lResult = ::RegOpenKeyExA( HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Control\\Nls\\Language",
+ 0, KEY_QUERY_VALUE, &hKey );
+ char aKeyValBuf[16];
+ DWORD nKeyValSize = sizeof(aKeyValBuf);
+ if( ERROR_SUCCESS == lResult )
+ lResult = RegQueryValueExA( hKey, "Default", NULL, NULL, (LPBYTE)aKeyValBuf, &nKeyValSize );
+ aKeyValBuf[ sizeof(aKeyValBuf)-1 ] = '\0';
+ if( ERROR_SUCCESS == lResult )
+ nDefaultLang = (LanguageType)rtl_str_toInt32( aKeyValBuf, 16 );
+
+ // TODO: use the default-CJK language selected in
+ // Tools->Options->LangSettings->Languages when it becomes available here
+ if( !nDefaultLang )
+ nDefaultLang = Application::GetSettings().GetUILanguage();
+
+ LanguageType nDefaultCJK = LANGUAGE_CHINESE;
+ switch( nDefaultLang )
+ {
+ case LANGUAGE_JAPANESE:
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ case LANGUAGE_CHINESE_SIMPLIFIED:
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ case LANGUAGE_CHINESE_SINGAPORE:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_MACAU:
+ nDefaultCJK = nDefaultLang;
+ break;
+ default:
+ nDefaultCJK = LANGUAGE_CHINESE;
+ break;
+ }
+
+ // change the marked entries to prefered language
+ static const int nCount = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart));
+ for( int i = 0; i < nCount; ++i )
+ {
+ if( aLangFromCodeChart[ i].mnLangID == LANGUAGE_DEFAULT_CJK )
+ aLangFromCodeChart[ i].mnLangID = nDefaultCJK;
+ }
+ }
+
+ // binary search
+ int nLow = 0;
+ int nHigh = (sizeof(aLangFromCodeChart) / sizeof(*aLangFromCodeChart)) - 1;
+ while( nLow <= nHigh )
+ {
+ int nMiddle = (nHigh + nLow) / 2;
+ if( uChar < aLangFromCodeChart[ nMiddle].mnMinCode )
+ nHigh = nMiddle - 1;
+ else if( uChar > aLangFromCodeChart[ nMiddle].mnMaxCode )
+ nLow = nMiddle + 1;
+ else
+ return aLangFromCodeChart[ nMiddle].mnLangID;
+ }
+
+ return LANGUAGE_DONTKNOW;
+}
+
+class WinGlyphFallbackSubstititution
+: public ImplGlyphFallbackFontSubstitution
+{
+public:
+ explicit WinGlyphFallbackSubstititution( HDC );
+
+ bool FindFontSubstitute( ImplFontSelectData&, rtl::OUString& rMissingChars ) const;
+private:
+ HDC mhDC;
+ bool HasMissingChars( const ImplFontData*, const rtl::OUString& rMissingChars ) const;
+};
+
+inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC )
+: mhDC( hDC )
+{}
+
+void ImplGetLogFontFromFontSelect( HDC, const ImplFontSelectData*,
+ LOGFONTW&, bool /*bTestVerticalAvail*/ );
+
+// does a font face hold the given missing characters?
+bool WinGlyphFallbackSubstititution::HasMissingChars( const ImplFontData* pFace, const rtl::OUString& rMissingChars ) const
+{
+ const ImplWinFontData* pWinFont = static_cast<const ImplWinFontData*>(pFace);
+ const ImplFontCharMap* pCharMap = pWinFont->GetImplFontCharMap();
+ if( !pCharMap )
+ {
+ // construct a Size structure as the parameter of constructor of class ImplFontSelectData
+ const Size aSize( pFace->GetWidth(), pFace->GetHeight() );
+ // create a ImplFontSelectData object for getting s LOGFONT
+ const ImplFontSelectData aFSD( *pFace, aSize, (float)aSize.Height(), 0, false );
+ // construct log font
+ LOGFONTW aLogFont;
+ ImplGetLogFontFromFontSelect( mhDC, &aFSD, aLogFont, true );
+
+ // create HFONT from log font
+ HFONT hNewFont = ::CreateFontIndirectW( &aLogFont );
+ // select the new font into device
+ HFONT hOldFont = ::SelectFont( mhDC, hNewFont );
+
+ // read CMAP table to update their pCharMap
+ pWinFont->UpdateFromHDC( mhDC );;
+
+ // cleanup temporary font
+ ::SelectFont( mhDC, hOldFont );
+ ::DeleteFont( hNewFont );
+
+ // get the new charmap
+ pCharMap = pWinFont->GetImplFontCharMap();
+ }
+
+ // avoid fonts with unknown CMAP subtables for glyph fallback
+ if( !pCharMap || pCharMap->IsDefaultMap() )
+ return false;
+
+ int nMatchCount = 0;
+ // static const int nMaxMatchCount = 1; // TODO: check more missing characters?
+ const sal_Int32 nStrLen = rMissingChars.getLength();
+ for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; ++nStrIdx )
+ {
+ const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx );
+ nMatchCount += pCharMap->HasChar( uChar );
+ break; // for now
+ }
+
+ const bool bHasMatches = (nMatchCount > 0);
+ return bHasMatches;
+}
+
+// find a fallback font for missing characters
+// TODO: should stylistic matches be searched and prefered?
+bool WinGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFontSelData, rtl::OUString& rMissingChars ) const
+{
+ // guess a locale matching to the missing chars
+ com::sun::star::lang::Locale aLocale;
+
+ sal_Int32 nStrIdx = 0;
+ const sal_Int32 nStrLen = rMissingChars.getLength();
+ while( nStrIdx < nStrLen )
+ {
+ const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx );
+ const LanguageType eLang = MapCharToLanguage( uChar );
+ if( eLang == LANGUAGE_DONTKNOW )
+ continue;
+ MsLangId::convertLanguageToLocale( eLang, aLocale );
+ break;
+ }
+
+ // fall back to default UI locale if the missing characters are inconclusive
+ if( nStrIdx >= nStrLen )
+ aLocale = Application::GetSettings().GetUILocale();
+
+ // first level fallback:
+ // try use the locale specific default fonts defined in VCL.xcu
+ const ImplDevFontList* pDevFontList = ImplGetSVData()->maGDIData.mpScreenFontList;
+ /*const*/ ImplDevFontListData* pDevFont = pDevFontList->ImplFindByLocale( aLocale );
+ if( pDevFont )
+ {
+ const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData );
+ if( HasMissingChars( pFace, rMissingChars ) )
+ {
+ rFontSelData.maSearchName = pDevFont->GetSearchName();
+ return true;
+ }
+ }
+
+ // are the missing characters symbols?
+ pDevFont = pDevFontList->ImplFindByAttributes( IMPL_FONT_ATTR_SYMBOL,
+ rFontSelData.meWeight, rFontSelData.meWidthType,
+ rFontSelData.meFamily, rFontSelData.meItalic, rFontSelData.maSearchName );
+ if( pDevFont )
+ {
+ const ImplFontData* pFace = pDevFont->FindBestFontFace( rFontSelData );
+ if( HasMissingChars( pFace, rMissingChars ) )
+ {
+ rFontSelData.maSearchName = pDevFont->GetSearchName();
+ return true;
+ }
+ }
+
+ // last level fallback, check each font type face one by one
+ const ImplGetDevFontList* pTestFontList = pDevFontList->GetDevFontList();
+ // limit the count of fonts to be checked to prevent hangs
+ static const int MAX_GFBFONT_COUNT = 600;
+ int nTestFontCount = pTestFontList->Count();
+ if( nTestFontCount > MAX_GFBFONT_COUNT )
+ nTestFontCount = MAX_GFBFONT_COUNT;
+
+ for( int i = 0; i < nTestFontCount; ++i )
+ {
+ const ImplFontData* pFace = pTestFontList->Get( i );
+ if( !HasMissingChars( pFace, rMissingChars ) )
+ continue;
+ rFontSelData.maSearchName = pFace->maName;
+ return true;
+ }
+
+ return false;
+}
+
// =======================================================================
struct ImplEnumInfo
@@ -903,6 +1208,8 @@ bool ImplWinFontData::IsGSUBstituted( sal_UCS4 cChar ) const
ImplFontCharMap* ImplWinFontData::GetImplFontCharMap() const
{
+ if( !mpUnicodeMap )
+ return NULL;
mpUnicodeMap->AddReference();
return mpUnicodeMap;
}
@@ -2237,6 +2544,10 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList )
bImplSalCourierScalable = aInfo.mbImplSalCourierScalable;
bImplSalCourierNew = aInfo.mbImplSalCourierNew;
}
+
+ // set glyph fallback hook
+ static WinGlyphFallbackSubstititution aSubstFallback( mhDC );
+ pFontList->SetFallbackHook( &aSubstFallback );
}
// ----------------------------------------------------------------------------
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index 1b7ed7dcfccb..d1f11433d532 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -295,6 +295,10 @@ BOOL WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA )
hTheme = getThemeHandle( mhWnd, L"Trackbar" );
break;
+ case CTRL_LISTNODE:
+ if( nPart == PART_ENTIRE_CONTROL )
+ hTheme = getThemeHandle( mhWnd, L"TreeView" );
+ break;
default:
hTheme = NULL;
break;
@@ -926,6 +930,27 @@ BOOL ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
return ImplDrawTheme( hTheme, hDC, iPart, iState, aThumbRect, aCaption );
}
+ if( nType == CTRL_LISTNODE )
+ {
+ if( nPart != PART_ENTIRE_CONTROL )
+ return FALSE;
+
+ ButtonValue aButtonValue = aValue.getTristateVal();
+ iPart = TVP_GLYPH;
+ switch( aButtonValue )
+ {
+ case BUTTONVALUE_ON:
+ iState = GLPS_OPENED;
+ break;
+ case BUTTONVALUE_OFF:
+ iState = GLPS_CLOSED;
+ break;
+ default:
+ return FALSE;
+ }
+ return ImplDrawTheme( hTheme, hDC, iPart, iState, rc, aCaption );
+ }
+
return false;
}
@@ -1006,6 +1031,10 @@ BOOL WinSalGraphics::drawNativeControl( ControlType nType,
if( nPart == PART_ENTIRE_CONTROL )
hTheme = getThemeHandle( mhWnd, L"Progress");
break;
+ case CTRL_LISTNODE:
+ if( nPart == PART_ENTIRE_CONTROL )
+ hTheme = getThemeHandle( mhWnd, L"TreeView");
+ break;
case CTRL_SLIDER:
if( nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA )
hTheme = getThemeHandle( mhWnd, L"Trackbar" );