| 1 |
Index: inc/psprint/jobdata.hxx
|
| 2 |
===================================================================
|
| 3 |
RCS file: /cvs/gsl/psprint/inc/psprint/jobdata.hxx,v
|
| 4 |
retrieving revision 1.4
|
| 5 |
diff -u -r1.4 jobdata.hxx
|
| 6 |
--- openoffice.org.orig/psprint/inc/psprint/jobdata.hxx 4 Dec 2006 16:33:06 -0000 1.4
|
| 7 |
+++ openoffice.org/psprint/inc/psprint/jobdata.hxx 9 May 2007 10:45:05 -0000
|
| 8 |
@@ -51,6 +51,8 @@
|
| 9 |
|
| 10 |
struct JobData
|
| 11 |
{
|
| 12 |
+ bool m_bCupsJob;
|
| 13 |
+ bool m_bNumberUpJob;
|
| 14 |
int m_nCopies;
|
| 15 |
int m_nLeftMarginAdjust;
|
| 16 |
int m_nRightMarginAdjust;
|
| 17 |
@@ -61,11 +63,14 @@
|
| 18 |
int m_nPSLevel; // 0: no override, else languaglevel to use
|
| 19 |
int m_nColorDevice; // 0: no override, -1 grey scale, +1 color
|
| 20 |
orientation::type m_eOrientation;
|
| 21 |
+ orientation::type m_eNumberUpOrientation;
|
| 22 |
::rtl::OUString m_aPrinterName;
|
| 23 |
const PPDParser* m_pParser;
|
| 24 |
PPDContext m_aContext;
|
| 25 |
|
| 26 |
JobData() :
|
| 27 |
+ m_bCupsJob( false ),
|
| 28 |
+ m_bNumberUpJob( false ),
|
| 29 |
m_nCopies( 1 ),
|
| 30 |
m_nLeftMarginAdjust( 0 ),
|
| 31 |
m_nRightMarginAdjust( 0 ),
|
| 32 |
@@ -75,6 +80,7 @@
|
| 33 |
m_nPSLevel( 0 ),
|
| 34 |
m_nColorDevice( 0 ),
|
| 35 |
m_eOrientation( orientation::Portrait ),
|
| 36 |
+ m_eNumberUpOrientation( orientation::Portrait ),
|
| 37 |
m_pParser( NULL ) {}
|
| 38 |
|
| 39 |
JobData& operator=(const psp::JobData& rRight);
|
| 40 |
Index: source/printer/jobdata.cxx
|
| 41 |
===================================================================
|
| 42 |
RCS file: /cvs/gsl/psprint/source/printer/jobdata.cxx,v
|
| 43 |
retrieving revision 1.9
|
| 44 |
diff -u -r1.9 jobdata.cxx
|
| 45 |
--- openoffice.org.orig/psprint/source/printer/jobdata.cxx 4 Dec 2006 16:33:20 -0000 1.9
|
| 46 |
+++ openoffice.org/psprint/source/printer/jobdata.cxx 9 May 2007 10:45:55 -0000
|
| 47 |
@@ -46,6 +46,8 @@
|
| 48 |
|
| 49 |
JobData& JobData::operator=(const JobData& rRight)
|
| 50 |
{
|
| 51 |
+ m_bCupsJob = rRight.m_bCupsJob;
|
| 52 |
+ m_bNumberUpJob = rRight.m_bNumberUpJob;
|
| 53 |
m_nCopies = rRight.m_nCopies;
|
| 54 |
m_nLeftMarginAdjust = rRight.m_nLeftMarginAdjust;
|
| 55 |
m_nRightMarginAdjust = rRight.m_nRightMarginAdjust;
|
| 56 |
@@ -53,6 +55,7 @@
|
| 57 |
m_nBottomMarginAdjust = rRight.m_nBottomMarginAdjust;
|
| 58 |
m_nColorDepth = rRight.m_nColorDepth;
|
| 59 |
m_eOrientation = rRight.m_eOrientation;
|
| 60 |
+ m_eNumberUpOrientation = rRight.m_eNumberUpOrientation;
|
| 61 |
m_aPrinterName = rRight.m_aPrinterName;
|
| 62 |
m_pParser = rRight.m_pParser;
|
| 63 |
m_aContext = rRight.m_aContext;
|
| 64 |
@@ -90,10 +93,22 @@
|
| 65 |
aLine += m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait";
|
| 66 |
aStream.WriteLine( aLine );
|
| 67 |
|
| 68 |
+ aLine = "nupsorientation=";
|
| 69 |
+ aLine += m_eNumberUpOrientation == orientation::Landscape ? "Landscape" : "Portrait";
|
| 70 |
+ aStream.WriteLine( aLine );
|
| 71 |
+
|
| 72 |
aLine = "copies=";
|
| 73 |
aLine += ByteString::CreateFromInt32( m_nCopies );
|
| 74 |
aStream.WriteLine( aLine );
|
| 75 |
|
| 76 |
+ aLine = "cups=";
|
| 77 |
+ aLine += ByteString::CreateFromInt32( m_bCupsJob );
|
| 78 |
+ aStream.WriteLine( aLine );
|
| 79 |
+
|
| 80 |
+ aLine = "nups=";
|
| 81 |
+ aLine += ByteString::CreateFromInt32( m_bNumberUpJob );
|
| 82 |
+ aStream.WriteLine( aLine );
|
| 83 |
+
|
| 84 |
aLine = "margindajustment=";
|
| 85 |
aLine += ByteString::CreateFromInt32( m_nLeftMarginAdjust );
|
| 86 |
aLine += ',';
|
| 87 |
@@ -157,11 +172,17 @@
|
| 88 |
bOrientation = true;
|
| 89 |
rJobData.m_eOrientation = aLine.Copy( 12 ).EqualsIgnoreCaseAscii( "landscape" ) ? orientation::Landscape : orientation::Portrait;
|
| 90 |
}
|
| 91 |
+ else if( aLine.CompareTo( "nupsorientation=", 16 ) == COMPARE_EQUAL )
|
| 92 |
+ rJobData.m_eNumberUpOrientation = aLine.Copy( 16 ).EqualsIgnoreCaseAscii( "landscape" ) ? orientation::Landscape : orientation::Portrait;
|
| 93 |
else if( aLine.CompareTo( "copies=", 7 ) == COMPARE_EQUAL )
|
| 94 |
{
|
| 95 |
bCopies = true;
|
| 96 |
rJobData.m_nCopies = aLine.Copy( 7 ).ToInt32();
|
| 97 |
}
|
| 98 |
+ else if( aLine.CompareTo( "cups=", 5 ) == COMPARE_EQUAL )
|
| 99 |
+ rJobData.m_bCupsJob = aLine.Copy( 5 ).ToInt32();
|
| 100 |
+ else if( aLine.CompareTo( "nups=", 5 ) == COMPARE_EQUAL )
|
| 101 |
+ rJobData.m_bNumberUpJob = aLine.Copy( 5 ).ToInt32();
|
| 102 |
else if( aLine.CompareTo( "margindajustment=",17 ) == COMPARE_EQUAL )
|
| 103 |
{
|
| 104 |
bMargin = true;
|
| 105 |
Index: source/printergfx/printerjob.cxx
|
| 106 |
===================================================================
|
| 107 |
RCS file: /cvs/gsl/psprint/source/printergfx/printerjob.cxx,v
|
| 108 |
retrieving revision 1.40
|
| 109 |
diff -u -r1.40 printerjob.cxx
|
| 110 |
--- openoffice.org.orig/psprint/source/printergfx/printerjob.cxx 24 Oct 2006 15:06:47 -0000 1.40
|
| 111 |
+++ openoffice.org/psprint/source/printergfx/printerjob.cxx 9 Nov 2006 10:40:31 -0000
|
| 112 |
@@ -669,6 +669,17 @@
|
| 113 |
|
| 114 |
mnResolution = nRes;
|
| 115 |
|
| 116 |
+ if (rJobSetup.m_bNumberUpJob && rJobSetup.m_eOrientation == orientation::Landscape)
|
| 117 |
+ {
|
| 118 |
+ //swap width/height
|
| 119 |
+ std::swap(nWidth, nHeight);
|
| 120 |
+ int nTemp = nLeft;
|
| 121 |
+ nLeft = nUpper;
|
| 122 |
+ nUpper = nRight;
|
| 123 |
+ nRight = nLower;
|
| 124 |
+ nLower = nTemp;
|
| 125 |
+ }
|
| 126 |
+
|
| 127 |
mnWidthPt = nWidth;
|
| 128 |
mnHeightPt = nHeight;
|
| 129 |
|
| 130 |
@@ -721,7 +732,9 @@
|
| 131 |
WritePS (pPageHeader, aPageNo);
|
| 132 |
WritePS (pPageHeader, "\n");
|
| 133 |
|
| 134 |
- if( rJobSetup.m_eOrientation == orientation::Landscape )
|
| 135 |
+ orientation::type eOrientation = rJobSetup.m_bNumberUpJob ? orientation::Portrait : rJobSetup.m_eOrientation;
|
| 136 |
+
|
| 137 |
+ if( eOrientation == orientation::Landscape )
|
| 138 |
{
|
| 139 |
WritePS (pPageHeader, "%%PageOrientation: Landscape\n");
|
| 140 |
mnLandscapes++;
|
| 141 |
@@ -903,7 +916,8 @@
|
| 142 |
sal_Char pTranslate [128];
|
| 143 |
sal_Int32 nChar = 0;
|
| 144 |
|
| 145 |
- if( rJob.m_eOrientation == orientation::Portrait )
|
| 146 |
+ orientation::type eOrientation = rJob.m_bNumberUpJob ? orientation::Portrait : rJob.m_eOrientation;
|
| 147 |
+ if( eOrientation == orientation::Portrait )
|
| 148 |
{
|
| 149 |
nChar = psp::appendStr ("gsave\n[", pTranslate);
|
| 150 |
nChar += psp::getValueOfDouble ( pTranslate + nChar, mfXScale, 5);
|
| 151 |
@@ -1214,7 +1228,7 @@
|
| 152 |
WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" );
|
| 153 |
}
|
| 154 |
|
| 155 |
- bool bFeatureSuccess = writeFeatureList( pFile, rJob, true );
|
| 156 |
+ bool bFeatureSuccess = !rJob.m_bCupsJob ? writeFeatureList( pFile, rJob, true ) : true;
|
| 157 |
|
| 158 |
WritePS (pFile, "%%EndSetup\n");
|
| 159 |
|
| 160 |
Index: inc/psprint/ppdparser.hxx
|
| 161 |
===================================================================
|
| 162 |
RCS file: /cvs/gsl/psprint/inc/psprint/ppdparser.hxx,v
|
| 163 |
retrieving revision 1.9
|
| 164 |
diff -u -r1.9 ppdparser.hxx
|
| 165 |
--- openoffice.org.orig/psprint/inc/psprint/ppdparser.hxx 8 Sep 2005 16:34:44 -0000 1.9
|
| 166 |
+++ openoffice.org/psprint/inc/psprint/ppdparser.hxx 19 May 2006 13:15:15 -0000
|
| 167 |
@@ -61,6 +61,7 @@
|
| 168 |
String m_aOptionTranslation;
|
| 169 |
String m_aValue;
|
| 170 |
String m_aValueTranslation;
|
| 171 |
+ PPDValue() : m_eType(eInvocation) {}
|
| 172 |
};
|
| 173 |
|
| 174 |
// ----------------------------------------------------------------------
|
| 175 |
@@ -89,6 +90,7 @@
|
| 176 |
private:
|
| 177 |
|
| 178 |
bool m_bUIOption;
|
| 179 |
+ bool m_bPseudo;
|
| 180 |
String m_aUITranslation;
|
| 181 |
UIType m_eUIType;
|
| 182 |
int m_nOrderDependency;
|
| 183 |
@@ -110,6 +112,8 @@
|
| 184 |
|
| 185 |
const String& getKey() const { return m_aKey; }
|
| 186 |
bool isUIKey() const { return m_bUIOption; }
|
| 187 |
+ bool isPseudoKey() const { return m_bPseudo; }
|
| 188 |
+ void setPseudoKey() { m_bPseudo = true; }
|
| 189 |
const String& getUITranslation() const { return m_aUITranslation; }
|
| 190 |
UIType getUIType() const { return m_eUIType; }
|
| 191 |
SetupType getSetupType() const { return m_eSetupType; }
|
| 192 |
@@ -139,8 +143,9 @@
|
| 193 |
|
| 194 |
typedef ::std::hash_map< ::rtl::OUString, PPDKey*, ::rtl::OUStringHash > hash_type;
|
| 195 |
typedef ::std::vector< PPDKey* > value_type;
|
| 196 |
-
|
| 197 |
+public:
|
| 198 |
void insertKey( const String& rKey, PPDKey* pKey );
|
| 199 |
+ void Reset();
|
| 200 |
public:
|
| 201 |
struct PPDConstraint
|
| 202 |
{
|
| 203 |
@@ -302,6 +307,7 @@
|
| 204 |
// returns false: check failed, new value is constrained
|
| 205 |
// true: check succeded, new value can be set
|
| 206 |
bool checkConstraints( const PPDKey*, const PPDValue*, bool bDoReset );
|
| 207 |
+public:
|
| 208 |
bool resetValue( const PPDKey*, bool bDefaultable = false );
|
| 209 |
public:
|
| 210 |
PPDContext( const PPDParser* pParser = NULL );
|
| 211 |
Index: source/helper/ppdparser.cxx
|
| 212 |
===================================================================
|
| 213 |
RCS file: /cvs/gsl/psprint/source/helper/ppdparser.cxx,v
|
| 214 |
retrieving revision 1.24
|
| 215 |
diff -u -r1.24 ppdparser.cxx
|
| 216 |
--- openoffice.org.orig/psprint/source/helper/ppdparser.cxx 25 Jan 2007 11:20:15 -0000 1.24
|
| 217 |
+++ openoffice.org/psprint/source/helper/ppdparser.cxx 4 Oct 2007 11:25:31 -0000
|
| 218 |
@@ -49,6 +49,7 @@
|
| 219 |
#include "osl/thread.h"
|
| 220 |
#include "rtl/strbuf.hxx"
|
| 221 |
#include "rtl/ustrbuf.hxx"
|
| 222 |
+#include <algorithm>
|
| 223 |
|
| 224 |
using namespace psp;
|
| 225 |
using namespace rtl;
|
| 226 |
@@ -662,6 +663,23 @@
|
| 227 |
delete it->second;
|
| 228 |
}
|
| 229 |
|
| 230 |
+void PPDParser::Reset()
|
| 231 |
+{
|
| 232 |
+ for( PPDParser::hash_type::iterator it = m_aKeys.begin(); it != m_aKeys.end(); /*nothing*/ )
|
| 233 |
+ {
|
| 234 |
+ PPDKey* pKey = it->second;
|
| 235 |
+ if (pKey->isPseudoKey())
|
| 236 |
+ {
|
| 237 |
+ m_aOrderedKeys.erase(::std::remove(m_aOrderedKeys.begin(),
|
| 238 |
+ m_aOrderedKeys.end(), pKey), m_aOrderedKeys.end());
|
| 239 |
+ delete it->second;
|
| 240 |
+ m_aKeys.erase(it++);
|
| 241 |
+ }
|
| 242 |
+ else
|
| 243 |
+ ++it;
|
| 244 |
+ }
|
| 245 |
+}
|
| 246 |
+
|
| 247 |
void PPDParser::insertKey( const String& rKey, PPDKey* pKey )
|
| 248 |
{
|
| 249 |
m_aKeys[ rKey ] = pKey;
|
| 250 |
@@ -1414,6 +1432,7 @@
|
| 251 |
m_pDefaultValue( NULL ),
|
| 252 |
m_bQueryValue( false ),
|
| 253 |
m_bUIOption( false ),
|
| 254 |
+ m_bPseudo( false ),
|
| 255 |
m_eUIType( PickOne ),
|
| 256 |
m_nOrderDependency( 100 ),
|
| 257 |
m_eSetupType( AnySetup )
|
| 258 |
Index: source/dialogs/makefile.mk
|
| 259 |
===================================================================
|
| 260 |
RCS file: /cvs/util/svtools/source/dialogs/makefile.mk,v
|
| 261 |
retrieving revision 1.14
|
| 262 |
diff -u -r1.14 makefile.mk
|
| 263 |
--- openoffice.org.orig/svtools/source/dialogs/makefile.mk 8 Sep 2005 15:16:11 -0000 1.14
|
| 264 |
+++ openoffice.org/svtools/source/dialogs/makefile.mk 19 May 2006 13:08:22 -0000
|
| 265 |
@@ -43,6 +43,10 @@
|
| 266 |
.INCLUDE : settings.mk
|
| 267 |
.INCLUDE : $(PRJ)$/util$/svt.pmk
|
| 268 |
|
| 269 |
+
|
| 270 |
+PKGCONFIG_MODULES=gtk+-unix-print-2.0
|
| 271 |
+.INCLUDE: pkg_config.mk
|
| 272 |
+
|
| 273 |
# --- Files --------------------------------------------------------
|
| 274 |
|
| 275 |
SRS1NAME=$(TARGET)
|
| 276 |
Index: util/makefile.mk
|
| 277 |
===================================================================
|
| 278 |
RCS file: /cvs/util/svtools/util/makefile.mk,v
|
| 279 |
retrieving revision 1.56
|
| 280 |
diff -u -r1.56 makefile.mk
|
| 281 |
--- openoffice.org.orig/svtools/util/makefile.mk 5 Jan 2006 18:13:35 -0000 1.56
|
| 282 |
+++ openoffice.org/svtools/util/makefile.mk 19 May 2006 13:08:26 -0000
|
| 283 |
@@ -45,6 +45,9 @@
|
| 284 |
GEN_HID_OTHER=TRUE
|
| 285 |
ENABLE_EXCEPTIONS=TRUE
|
| 286 |
|
| 287 |
+PKGCONFIG_MODULES=gtk+-unix-print-2.0
|
| 288 |
+.INCLUDE: pkg_config.mk
|
| 289 |
+
|
| 290 |
# --- Settings -----------------------------------------------------
|
| 291 |
|
| 292 |
.INCLUDE : settings.mk
|
| 293 |
@@ -154,8 +157,11 @@
|
| 294 |
$(CPPULIB) \
|
| 295 |
$(VOSLIB) \
|
| 296 |
$(SALLIB) \
|
| 297 |
- $(ICUUCLIB) \
|
| 298 |
+ $(ICUUCLIB) \
|
| 299 |
+ -lpsp$(DLLPOSTFIX)\
|
| 300 |
$(JVMFWKLIB)
|
| 301 |
+
|
| 302 |
+SHL1STDLIBS+=$(PKGCONFIG_LIBS)
|
| 303 |
|
| 304 |
.IF "$(OS)"=="MACOSX"
|
| 305 |
# static libraries go at end
|
| 306 |
Index: inc/jobset.hxx
|
| 307 |
===================================================================
|
| 308 |
RCS file: /cvs/gsl/vcl/inc/jobset.hxx,v
|
| 309 |
retrieving revision 1.7
|
| 310 |
diff -u -r1.7 jobset.hxx
|
| 311 |
--- openoffice.org.orig/vcl/inc/vcl/jobset.hxx 9 Sep 2005 11:06:48 -0000 1.7
|
| 312 |
+++ openoffice.org/vcl/inc/vcl/jobset.hxx 19 May 2006 13:16:52 -0000
|
| 313 |
@@ -35,6 +35,7 @@
|
| 314 |
#include <vcl/sv.h>
|
| 315 |
#include <vcl/dllapi.h>
|
| 316 |
#include <vcl/prntypes.hxx>
|
| 317 |
+#include <psprint/printerinfomanager.hxx>
|
| 318 |
|
| 319 |
class SvStream;
|
| 320 |
struct ImplJobSetup;
|
| 321 |
@@ -72,6 +73,9 @@
|
| 322 |
*/
|
| 323 |
String GetValue( const String& rKey ) const;
|
| 324 |
void SetValue( const String& rKey, const String& rValue );
|
| 325 |
+ void SetCupsKey( const String& rKey, const String& rValue );
|
| 326 |
+ void Reset( );
|
| 327 |
+ psp::PrinterInfo GetPrinterInfo() const;
|
| 328 |
|
| 329 |
JobSetup& operator=( const JobSetup& rJob );
|
| 330 |
|
| 331 |
Index: inc/print.hxx
|
| 332 |
===================================================================
|
| 333 |
RCS file: /cvs/gsl/vcl/inc/print.hxx,v
|
| 334 |
retrieving revision 1.22
|
| 335 |
diff -u -r1.22 print.hxx
|
| 336 |
--- openoffice.org.orig/vcl/inc/vcl/print.hxx 9 Sep 2005 11:15:40 -0000 1.22
|
| 337 |
+++ openoffice.org/vcl/inc/vcl/print.hxx 19 May 2006 13:16:55 -0000
|
| 338 |
@@ -355,6 +355,10 @@
|
| 339 |
const JobSetup& GetJobSetup() const { return maJobSetup; }
|
| 340 |
String GetJobValue( const String& rKey ) const { return maJobSetup.GetValue( rKey ); }
|
| 341 |
void SetJobValue( const String& rKey, const String& rValue ) { maJobSetup.SetValue( rKey, rValue ); }
|
| 342 |
+ void SetJobCupsKey( const String& rKey, const String& rValue ) { maJobSetup.SetCupsKey( rKey, rValue ); }
|
| 343 |
+ void Reset( ) { maJobSetup.Reset(); }
|
| 344 |
+ psp::PrinterInfo GetPrinterInfo() const;
|
| 345 |
+
|
| 346 |
|
| 347 |
BOOL Setup( Window* pWindow = NULL );
|
| 348 |
BOOL SetPrinterProps( const Printer* pPrinter );
|
| 349 |
Index: source/gdi/jobset.cxx
|
| 350 |
===================================================================
|
| 351 |
RCS file: /cvs/gsl/vcl/source/gdi/jobset.cxx,v
|
| 352 |
retrieving revision 1.9
|
| 353 |
diff -u -r1.9 jobset.cxx
|
| 354 |
--- openoffice.org.orig/vcl/source/gdi/jobset.cxx 9 Sep 2005 12:03:24 -0000 1.9
|
| 355 |
+++ openoffice.org/vcl/source/gdi/jobset.cxx 19 May 2006 13:17:00 -0000
|
| 356 |
@@ -66,6 +66,7 @@
|
| 357 |
SVBT32 nPaperHeight;
|
| 358 |
};
|
| 359 |
|
| 360 |
+#include <psprint/printerinfomanager.hxx>
|
| 361 |
// =======================================================================
|
| 362 |
|
| 363 |
ImplJobSetup::ImplJobSetup()
|
| 364 |
@@ -231,6 +232,237 @@
|
| 365 |
mpData->maValueMap[ rKey ] = rValue;
|
| 366 |
}
|
| 367 |
|
| 368 |
+inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778)+0.5); }
|
| 369 |
+void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData );
|
| 370 |
+
|
| 371 |
+static struct
|
| 372 |
+{
|
| 373 |
+ int width;
|
| 374 |
+ int height;
|
| 375 |
+ const char* name;
|
| 376 |
+ int namelength;
|
| 377 |
+ Paper paper;
|
| 378 |
+} aPaperTab[] =
|
| 379 |
+{
|
| 380 |
+ { 29700, 42000, "A3", 2, PAPER_A3 },
|
| 381 |
+ { 21000, 29700, "A4", 2, PAPER_A4 },
|
| 382 |
+ { 14800, 21000, "A5", 2, PAPER_A5 },
|
| 383 |
+ { 25000, 35300, "B4", 2, PAPER_B4 },
|
| 384 |
+ { 17600, 25000, "B5", 2, PAPER_B5 },
|
| 385 |
+ { 21600, 27900, "Letter", 6, PAPER_LETTER },
|
| 386 |
+ { 21600, 35600, "Legal", 5, PAPER_LEGAL },
|
| 387 |
+ { 27900, 43100, "Tabloid", 7, PAPER_TABLOID },
|
| 388 |
+ { 0, 0, "USER", 4, PAPER_USER }
|
| 389 |
+};
|
| 390 |
+
|
| 391 |
+static Paper getPaperType( const String& rPaperName )
|
| 392 |
+{
|
| 393 |
+ ByteString aPaper( rPaperName, RTL_TEXTENCODING_ISO_8859_1 );
|
| 394 |
+ for( unsigned int i = 0; i < sizeof( aPaperTab )/sizeof( aPaperTab[0] ); i++ )
|
| 395 |
+ {
|
| 396 |
+ if( ! strcmp( aPaper.GetBuffer(), aPaperTab[i].name ) )
|
| 397 |
+ return aPaperTab[i].paper;
|
| 398 |
+ }
|
| 399 |
+ return PAPER_USER;
|
| 400 |
+}
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, psp::JobData& rData )
|
| 405 |
+{
|
| 406 |
+ using namespace psp;
|
| 407 |
+
|
| 408 |
+ pJobSetup->meOrientation = (Orientation)(rData.m_eOrientation == orientation::Landscape ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+ // copy page size
|
| 412 |
+ String aPaper;
|
| 413 |
+ int width, height;
|
| 414 |
+
|
| 415 |
+ rData.m_aContext.getPageSize( aPaper, width, height );
|
| 416 |
+ pJobSetup->mePaperFormat = getPaperType( aPaper );
|
| 417 |
+ pJobSetup->mnPaperWidth = 0;
|
| 418 |
+ pJobSetup->mnPaperHeight = 0;
|
| 419 |
+ if( pJobSetup->mePaperFormat == PAPER_USER )
|
| 420 |
+ {
|
| 421 |
+ // transform to 100dth mm
|
| 422 |
+ width = PtTo10Mu( width );
|
| 423 |
+ height = PtTo10Mu( height );
|
| 424 |
+
|
| 425 |
+ if( rData.m_eOrientation == psp::orientation::Portrait )
|
| 426 |
+ {
|
| 427 |
+ pJobSetup->mnPaperWidth = width;
|
| 428 |
+ pJobSetup->mnPaperHeight= height;
|
| 429 |
+ }
|
| 430 |
+ else
|
| 431 |
+ {
|
| 432 |
+ pJobSetup->mnPaperWidth = height;
|
| 433 |
+ pJobSetup->mnPaperHeight= width;
|
| 434 |
+ }
|
| 435 |
+ }
|
| 436 |
+
|
| 437 |
+ // copy input slot
|
| 438 |
+ const PPDKey* pKey = NULL;
|
| 439 |
+ const PPDValue* pValue = NULL;
|
| 440 |
+
|
| 441 |
+ pJobSetup->mnPaperBin = 0xffff;
|
| 442 |
+ pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "InputSlot" ) ) );
|
| 443 |
+ if( pKey )
|
| 444 |
+ pValue = rData.m_aContext.getValue( pKey );
|
| 445 |
+ if( pKey && pValue )
|
| 446 |
+ {
|
| 447 |
+ for( pJobSetup->mnPaperBin = 0;
|
| 448 |
+ pValue != pKey->getValue( pJobSetup->mnPaperBin ) &&
|
| 449 |
+ pJobSetup->mnPaperBin < pKey->countValues();
|
| 450 |
+ pJobSetup->mnPaperBin++ )
|
| 451 |
+ ;
|
| 452 |
+ if( pJobSetup->mnPaperBin >= pKey->countValues() || pValue == pKey->getDefaultValue() )
|
| 453 |
+ pJobSetup->mnPaperBin = 0xffff;
|
| 454 |
+ }
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+ // copy the whole context
|
| 458 |
+ if( pJobSetup->mpDriverData )
|
| 459 |
+ rtl_freeMemory( pJobSetup->mpDriverData );
|
| 460 |
+
|
| 461 |
+ int nBytes;
|
| 462 |
+ void* pBuffer = NULL;
|
| 463 |
+ if( rData.getStreamBuffer( pBuffer, nBytes ) )
|
| 464 |
+ {
|
| 465 |
+ pJobSetup->mnDriverDataLen = nBytes;
|
| 466 |
+ pJobSetup->mpDriverData = (BYTE*)pBuffer;
|
| 467 |
+ }
|
| 468 |
+ else
|
| 469 |
+ {
|
| 470 |
+ pJobSetup->mnDriverDataLen = 0;
|
| 471 |
+ pJobSetup->mpDriverData = NULL;
|
| 472 |
+ }
|
| 473 |
+}
|
| 474 |
+
|
| 475 |
+psp::PrinterInfo JobSetup::GetPrinterInfo() const
|
| 476 |
+{
|
| 477 |
+ using namespace psp;
|
| 478 |
+
|
| 479 |
+ PrinterInfoManager& rManager = PrinterInfoManager::get();
|
| 480 |
+ PrinterInfo aInfo(rManager.getPrinterInfo(mpData->maPrinterName));
|
| 481 |
+ if (mpData->mpDriverData)
|
| 482 |
+ {
|
| 483 |
+ JobData::constructFromStreamBuffer(mpData->mpDriverData,
|
| 484 |
+ mpData->mnDriverDataLen, aInfo);
|
| 485 |
+ }
|
| 486 |
+
|
| 487 |
+ return aInfo;
|
| 488 |
+}
|
| 489 |
+
|
| 490 |
+void JobSetup::Reset( )
|
| 491 |
+{
|
| 492 |
+ if( ! mpData )
|
| 493 |
+ mpData = new ImplJobSetup();
|
| 494 |
+
|
| 495 |
+ using namespace psp;
|
| 496 |
+
|
| 497 |
+ PrinterInfoManager& rManager = PrinterInfoManager::get();
|
| 498 |
+ PrinterInfo aInfo(rManager.getPrinterInfo(mpData->maPrinterName));
|
| 499 |
+ if (mpData->mpDriverData )
|
| 500 |
+ {
|
| 501 |
+ JobData::constructFromStreamBuffer(mpData->mpDriverData,
|
| 502 |
+ mpData->mnDriverDataLen, aInfo);
|
| 503 |
+ }
|
| 504 |
+
|
| 505 |
+ int nDifferent = aInfo.m_aContext.countValuesModified();
|
| 506 |
+ for (int i = 0; i < nDifferent; ++i)
|
| 507 |
+ {
|
| 508 |
+ const PPDKey* pKey = aInfo.m_aContext.getModifiedKey(i);
|
| 509 |
+ bool bResult = aInfo.m_aContext.resetValue(pKey, true);
|
| 510 |
+ }
|
| 511 |
+
|
| 512 |
+ if (aInfo.m_pParser)
|
| 513 |
+ const_cast<PPDParser*>(aInfo.m_pParser)->Reset();
|
| 514 |
+
|
| 515 |
+ aInfo.m_aContext.rebuildFromStreamBuffer( NULL, 0 );
|
| 516 |
+
|
| 517 |
+ aInfo.m_bCupsJob=false;
|
| 518 |
+ aInfo.m_bNumberUpJob=false;
|
| 519 |
+ copyJobDataToJobSetup( mpData, aInfo );
|
| 520 |
+}
|
| 521 |
+
|
| 522 |
+void JobSetup::SetCupsKey( const String& rKey, const String& rValue )
|
| 523 |
+{
|
| 524 |
+ if( ! mpData )
|
| 525 |
+ mpData = new ImplJobSetup();
|
| 526 |
+
|
| 527 |
+ using namespace psp;
|
| 528 |
+
|
| 529 |
+ PrinterInfoManager& rManager = PrinterInfoManager::get();
|
| 530 |
+ PrinterInfo aInfo(rManager.getPrinterInfo(mpData->maPrinterName));
|
| 531 |
+ if (mpData->mpDriverData )
|
| 532 |
+ {
|
| 533 |
+ JobData::constructFromStreamBuffer(mpData->mpDriverData,
|
| 534 |
+ mpData->mnDriverDataLen, aInfo);
|
| 535 |
+ }
|
| 536 |
+ if (aInfo.m_pParser)
|
| 537 |
+ {
|
| 538 |
+ //fprintf(stderr, "key of %s, value of %s\n",
|
| 539 |
+ // rtl::OUStringToOString(rKey, RTL_TEXTENCODING_UTF8).getStr(),
|
| 540 |
+ // rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8).getStr());
|
| 541 |
+
|
| 542 |
+ if (const PPDKey* pKey = aInfo.m_pParser->getKey(rKey))
|
| 543 |
+ {
|
| 544 |
+ bool bFound = false;
|
| 545 |
+ for (int i = 0; i < pKey->countValues(); ++i)
|
| 546 |
+ {
|
| 547 |
+ const PPDValue *pValue = pKey->getValue(i);
|
| 548 |
+ //fprintf(stderr, "possible of %s\n", rtl::OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_UTF8).getStr());
|
| 549 |
+ if (rValue == pValue->m_aOption)
|
| 550 |
+ {
|
| 551 |
+ aInfo.m_aContext.setValue(pKey, pValue);
|
| 552 |
+ bFound = true;
|
| 553 |
+ break;
|
| 554 |
+ }
|
| 555 |
+ }
|
| 556 |
+ if (!bFound && rKey == String::CreateFromAscii("PageSize"))
|
| 557 |
+ {
|
| 558 |
+ String aString(rValue);
|
| 559 |
+ if (aString == String::CreateFromAscii("USLetter"))
|
| 560 |
+ aString = String::CreateFromAscii("Letter");
|
| 561 |
+ else if (aString == String::CreateFromAscii("USLegal"))
|
| 562 |
+ aString = String::CreateFromAscii("Legal");
|
| 563 |
+ for (int i = 0; i < pKey->countValues(); ++i)
|
| 564 |
+ {
|
| 565 |
+ const PPDValue *pValue = pKey->getValue(i);
|
| 566 |
+ if (aString == pValue->m_aOption)
|
| 567 |
+ {
|
| 568 |
+ aInfo.m_aContext.setValue(pKey, pValue);
|
| 569 |
+ bFound = true;
|
| 570 |
+ break;
|
| 571 |
+ }
|
| 572 |
+ }
|
| 573 |
+ }
|
| 574 |
+ //if (!bFound)
|
| 575 |
+ // fprintf(stderr, "Warning uknown PPD value %s\n", rtl::OUStringToOString(rValue, RTL_TEXTENCODING_UTF8).getStr());
|
| 576 |
+ }
|
| 577 |
+ else
|
| 578 |
+ {
|
| 579 |
+ PPDKey* pNewKey = new PPDKey( rKey );
|
| 580 |
+ pNewKey->setPseudoKey();
|
| 581 |
+ pNewKey->insertValue(String(RTL_CONSTASCII_USTRINGPARAM("None")));
|
| 582 |
+ PPDValue* pValue = pNewKey->insertValue(rValue);
|
| 583 |
+ pValue->m_eType = eInvocation;
|
| 584 |
+ pValue->m_aValue = rValue;
|
| 585 |
+ const_cast<PPDParser*>(aInfo.m_pParser)->insertKey( rKey, pNewKey );
|
| 586 |
+ aInfo.m_aContext.setValue(pNewKey, pValue);
|
| 587 |
+ }
|
| 588 |
+ }
|
| 589 |
+ if (rKey.CompareToAscii("number-up") == COMPARE_EQUAL)
|
| 590 |
+ {
|
| 591 |
+ aInfo.m_bNumberUpJob=rValue.ToInt32() > 1;
|
| 592 |
+ aInfo.m_eNumberUpOrientation=aInfo.m_eOrientation;
|
| 593 |
+ }
|
| 594 |
+ aInfo.m_bCupsJob=true;
|
| 595 |
+ copyJobDataToJobSetup( mpData, aInfo );
|
| 596 |
+
|
| 597 |
+}
|
| 598 |
+
|
| 599 |
// -----------------------------------------------------------------------
|
| 600 |
|
| 601 |
JobSetup& JobSetup::operator=( const JobSetup& rJobSetup )
|
| 602 |
Index: source/printer/cupsmgr.cxx
|
| 603 |
===================================================================
|
| 604 |
RCS file: /cvs/gsl/psprint/source/printer/cupsmgr.cxx,v
|
| 605 |
retrieving revision 1.12
|
| 606 |
diff -u -p -u -r1.12 cupsmgr.cxx
|
| 607 |
--- openoffice.org.orig/psprint/source/printer/cupsmgr.cxx 6 Jun 2005 16:07:42 -0000 1.12
|
| 608 |
+++ openoffice.org/psprint/source/printer/cupsmgr.cxx 25 Jul 2005 15:02:37 -0000
|
| 609 |
@@ -407,10 +407,15 @@
|
| 610 |
m_pDests( NULL ),
|
| 611 |
m_bNewDests( false )
|
| 612 |
{
|
| 613 |
+ startsearch();
|
| 614 |
+}
|
| 615 |
+
|
| 616 |
+void CUPSManager::startsearch()
|
| 617 |
+{
|
| 618 |
m_aDestThread = osl_createThread( run_dest_thread_stub, this );
|
| 619 |
}
|
| 620 |
|
| 621 |
-CUPSManager::~CUPSManager()
|
| 622 |
+void CUPSManager::stopsearch()
|
| 623 |
{
|
| 624 |
if( m_aDestThread )
|
| 625 |
{
|
| 626 |
@@ -422,6 +427,11 @@
|
| 627 |
|
| 628 |
if( m_nDests && m_pDests )
|
| 629 |
m_pCUPSWrapper->cupsFreeDests( m_nDests, (cups_dest_t*)m_pDests );
|
| 630 |
+}
|
| 631 |
+
|
| 632 |
+CUPSManager::~CUPSManager()
|
| 633 |
+{
|
| 634 |
+ stopsearch();
|
| 635 |
delete m_pCUPSWrapper;
|
| 636 |
}
|
| 637 |
|
| 638 |
@@ -519,9 +529,10 @@
|
| 639 |
|
| 640 |
// clear old stuff
|
| 641 |
m_aCUPSDestMap.clear();
|
| 642 |
-
|
| 643 |
+#if 0
|
| 644 |
if( ! (m_nDests && m_pDests ) )
|
| 645 |
return;
|
| 646 |
+#endif
|
| 647 |
|
| 648 |
if( isCUPSDisabled() )
|
| 649 |
return;
|
| 650 |
@@ -532,9 +543,9 @@
|
| 651 |
// this is needed to check for %%IncludeFeature support
|
| 652 |
// (#i65684#, #i65491#)
|
| 653 |
cups_dest_t* pDest = ((cups_dest_t*)m_pDests);
|
| 654 |
- const char* pOpt = m_pCUPSWrapper->cupsGetOption( "printer-info",
|
| 655 |
+ const char* pOpt = pDest ? m_pCUPSWrapper->cupsGetOption( "printer-info",
|
| 656 |
pDest->num_options,
|
| 657 |
- pDest->options );
|
| 658 |
+ pDest->options ) : 0;
|
| 659 |
if( pOpt )
|
| 660 |
m_bUseIncludeFeature = true;
|
| 661 |
|
| 662 |
@@ -614,6 +625,10 @@
|
| 663 |
|
| 664 |
if( it->second.m_aInfo.m_aFeatures.getLength() > 0 )
|
| 665 |
continue;
|
| 666 |
+
|
| 667 |
+ if (it->first == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Generic Printer")))
|
| 668 |
+ continue;
|
| 669 |
+
|
| 670 |
aRemovePrinters.push_back( it->first );
|
| 671 |
}
|
| 672 |
while( aRemovePrinters.begin() != aRemovePrinters.end() )
|
| 673 |
@@ -624,6 +639,7 @@
|
| 674 |
|
| 675 |
m_pCUPSWrapper->cupsSetPasswordCB( setPasswordCallback );
|
| 676 |
#endif // ENABLE_CUPS
|
| 677 |
+
|
| 678 |
}
|
| 679 |
|
| 680 |
#ifdef ENABLE_CUPS
|
| 681 |
@@ -882,6 +898,13 @@
|
| 682 |
rNumOptions = m_pCUPSWrapper->cupsAddOption( aKey.getStr(), aValue.getStr(), rNumOptions, (cups_option_t**)rOptions );
|
| 683 |
}
|
| 684 |
}
|
| 685 |
+ if (rJob.m_bNumberUpJob)
|
| 686 |
+ {
|
| 687 |
+ if (rJob.m_eNumberUpOrientation == orientation::Landscape)
|
| 688 |
+ rNumOptions = m_pCUPSWrapper->cupsAddOption( "orientation-requested", "4", rNumOptions, (cups_option_t**)rOptions );
|
| 689 |
+ else
|
| 690 |
+ rNumOptions = m_pCUPSWrapper->cupsAddOption( "orientation-requested", "1", rNumOptions, (cups_option_t**)rOptions );
|
| 691 |
+ }
|
| 692 |
}
|
| 693 |
}
|
| 694 |
|
| 695 |
Index: inc/cupsmgr.hxx
|
| 696 |
===================================================================
|
| 697 |
RCS file: /cvs/gsl/psprint/inc/cupsmgr.hxx,v
|
| 698 |
retrieving revision 1.9
|
| 699 |
diff -u -r1.9 cupsmgr.hxx
|
| 700 |
--- openoffice.org.orig/psprint/inc/cupsmgr.hxx 10 Jul 2006 16:29:13 -0000 1.9
|
| 701 |
+++ openoffice.org/psprint/inc/cupsmgr.hxx 29 Jan 2007 13:36:19 -0000
|
| 702 |
@@ -99,7 +99,9 @@
|
| 703 |
virtual void changePrinterInfo( const ::rtl::OUString& rPrinter, const PrinterInfo& rNewInfo );
|
| 704 |
|
| 705 |
// check if the printer configuration has changed
|
| 706 |
+ virtual void startsearch ();
|
| 707 |
virtual bool checkPrintersChanged( bool bWait );
|
| 708 |
+ virtual void stopsearch ();
|
| 709 |
|
| 710 |
// members for administration (->padmin)
|
| 711 |
// disable for CUPS
|
| 712 |
Index: inc/psprint/printerinfomanager.hxx
|
| 713 |
===================================================================
|
| 714 |
RCS file: /cvs/gsl/psprint/inc/psprint/printerinfomanager.hxx,v
|
| 715 |
retrieving revision 1.15.2.1
|
| 716 |
diff -u -r1.15.2.1 printerinfomanager.hxx
|
| 717 |
--- openoffice.org.orig/psprint/inc/psprint/printerinfomanager.hxx 24 Jan 2007 15:06:04 -0000 1.15.2.1
|
| 718 |
+++ openoffice.org/psprint/inc/psprint/printerinfomanager.hxx 29 Jan 2007 13:36:31 -0000
|
| 719 |
@@ -188,7 +188,9 @@
|
| 720 |
// check if the printer configuration has changed
|
| 721 |
// if bwait is true, then this method waits for eventual asynchronous
|
| 722 |
// printer discovery to finish
|
| 723 |
+ virtual void startsearch();
|
| 724 |
virtual bool checkPrintersChanged( bool bWait );
|
| 725 |
+ virtual void stopsearch();
|
| 726 |
|
| 727 |
// members for administration (->padmin)
|
| 728 |
|
| 729 |
Index: inc/printdlg.hxx
|
| 730 |
===================================================================
|
| 731 |
RCS file: /cvs/util/svtools/inc/printdlg.hxx,v
|
| 732 |
retrieving revision 1.9
|
| 733 |
diff -u -r1.9 printdlg.hxx
|
| 734 |
--- openoffice.org.orig/svtools/inc/svtools/printdlg.hxx 8 Sep 2005 10:06:06 -0000 1.9
|
| 735 |
+++ openoffice.org/svtools/inc/svtools/printdlg.hxx 16 Nov 2006 14:14:18 -0000
|
| 736 |
@@ -154,6 +154,9 @@
|
| 737 |
Link maOKHdlLink; // Link zum OK-Handler
|
| 738 |
|
| 739 |
String maAllFilterStr;
|
| 740 |
+ String maPaperFormatStr;
|
| 741 |
+ String maOrientationStr;
|
| 742 |
+ unsigned long mnNativeHandle;
|
| 743 |
|
| 744 |
SVT_DLLPRIVATE void ImplCheckOK();
|
| 745 |
SVT_DLLPRIVATE void ImplInitControls();
|
| 746 |
@@ -232,6 +235,8 @@
|
| 747 |
virtual short Execute();
|
| 748 |
|
| 749 |
void DisableHelp();
|
| 750 |
+
|
| 751 |
+ virtual unsigned long GetNativeHandle() const;
|
| 752 |
};
|
| 753 |
|
| 754 |
inline void PrintDialog::EnableRange( PrintDialogRange eRange )
|
| 755 |
Index: source/dialogs/printdlg.cxx
|
| 756 |
===================================================================
|
| 757 |
RCS file: /cvs/util/svtools/source/dialogs/printdlg.cxx,v
|
| 758 |
retrieving revision 1.23
|
| 759 |
diff -u -r1.23 printdlg.cxx
|
| 760 |
--- openoffice.org.orig/svtools/source/dialogs/printdlg.cxx 17 Sep 2006 14:45:21 -0000 1.23
|
| 761 |
+++ openoffice.org/svtools/source/dialogs/printdlg.cxx 16 Nov 2006 14:14:35 -0000
|
| 762 |
@@ -57,9 +57,49 @@
|
| 763 |
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
|
| 764 |
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
| 765 |
#include <comphelper/processfactory.hxx>
|
| 766 |
+extern void ImplDeletePrnQueueList();
|
| 767 |
+#include <com/sun/star/frame/XFrame.hpp>
|
| 768 |
+#include <com/sun/star/util/URL.hpp>
|
| 769 |
+#include <com/sun/star/util/XURLTransformer.hpp>
|
| 770 |
+#include <com/sun/star/frame/XDispatchProvider.hpp>
|
| 771 |
+#include <com/sun/star/beans/PropertyValue.hpp>
|
| 772 |
+#include <com/sun/star/view/XSelectionSupplier.hpp>
|
| 773 |
+#include <com/sun/star/document/XFilter.hpp>
|
| 774 |
+#include <com/sun/star/document/XExporter.hpp>
|
| 775 |
+#include <com/sun/star/io/XOutputStream.hpp>
|
| 776 |
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
|
| 777 |
+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
|
| 778 |
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
|
| 779 |
+#include <com/sun/star/container/XNamed.hpp>
|
| 780 |
+#include <unotools/streamwrap.hxx>
|
| 781 |
+#include <unotools/ucbstreamhelper.hxx>
|
| 782 |
+#include <rtl/bootstrap.hxx>
|
| 783 |
+
|
| 784 |
+#include "svtools/miscopt.hxx"
|
| 785 |
+
|
| 786 |
+#include <gtk/gtkprintunixdialog.h>
|
| 787 |
+#include <gtk/gtkstock.h>
|
| 788 |
+#include <gtk/gtkcheckbutton.h>
|
| 789 |
+#include <gtk/gtkcombobox.h>
|
| 790 |
+#include <gtk/gtklabel.h>
|
| 791 |
+#include <gtk/gtktable.h>
|
| 792 |
+#include <gtk/gtkcombobox.h>
|
| 793 |
+#include <gtk/gtkvbox.h>
|
| 794 |
+#include <gtk/gtknotebook.h>
|
| 795 |
+#include <psprint/printerinfomanager.hxx>
|
| 796 |
|
| 797 |
+using namespace osl;
|
| 798 |
using rtl::OUString;
|
| 799 |
using namespace com::sun::star;
|
| 800 |
+using namespace ::com::sun::star::frame;
|
| 801 |
+using namespace ::com::sun::star::beans;
|
| 802 |
+using namespace com::sun::star::view;
|
| 803 |
+using namespace com::sun::star::document;
|
| 804 |
+using namespace com::sun::star::sheet;
|
| 805 |
+using namespace com::sun::star::container;
|
| 806 |
+using namespace com::sun::star::io;
|
| 807 |
+using namespace com::sun::star::uno;
|
| 808 |
+using namespace com::sun::star::lang;
|
| 809 |
|
| 810 |
struct SvtPrinterImpl
|
| 811 |
{
|
| 812 |
@@ -116,8 +156,10 @@
|
| 813 |
maBtnCancel ( this, SvtResId( BTN_CANCEL ) ),
|
| 814 |
maBtnHelp ( this, SvtResId( BTN_HELP ) ),
|
| 815 |
mbWithSheetsAndCells( bWithSheetsAndCells ),
|
| 816 |
- maAllFilterStr ( SvtResId( STR_ALLFILTER ) )
|
| 817 |
-
|
| 818 |
+ maAllFilterStr ( SvtResId( STR_ALLFILTER ) ),
|
| 819 |
+ maPaperFormatStr ( SvtResId( STR_PAPER_PAPER_TXT ) ),
|
| 820 |
+ maOrientationStr ( SvtResId( STR_PAPER_ORIENTATION_TXT ) ),
|
| 821 |
+ mnNativeHandle(0)
|
| 822 |
{
|
| 823 |
FreeResource();
|
| 824 |
|
| 825 |
@@ -751,6 +793,304 @@
|
| 826 |
|
| 827 |
// -----------------------------------------------------------------------
|
| 828 |
|
| 829 |
+unsigned long PrintDialog::GetNativeHandle() const
|
| 830 |
+{
|
| 831 |
+ return !mnNativeHandle ? Window::GetNativeHandle() : mnNativeHandle;
|
| 832 |
+}
|
| 833 |
+
|
| 834 |
+#define ASCII_STR(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
|
| 835 |
+
|
| 836 |
+static void setcupskey(const gchar *key, const gchar *value, gpointer user_data)
|
| 837 |
+{
|
| 838 |
+ Printer *pPrinter = (Printer*)user_data;
|
| 839 |
+ if ((strlen(key) > 5) && (!strncmp(key, "cups-", 5)))
|
| 840 |
+ pPrinter->SetJobCupsKey( String::CreateFromAscii(key+5), String::CreateFromAscii(value));
|
| 841 |
+ else if ((!strcmp(key, "reverse")) && (!strcmp(value, "true")))
|
| 842 |
+ pPrinter->SetJobCupsKey(String::CreateFromAscii("OutputOrder"), String::CreateFromAscii("Reverse"));
|
| 843 |
+ else if ((!strcmp(key, "collate")) && (!strcmp(value, "true")))
|
| 844 |
+ pPrinter->SetJobCupsKey(String::CreateFromAscii("Collate"), String::CreateFromAscii("True"));
|
| 845 |
+ else if (!strcmp(key, "n-copies"))
|
| 846 |
+ pPrinter->SetJobCupsKey(String::CreateFromAscii("copies"), String::CreateFromAscii(value));
|
| 847 |
+}
|
| 848 |
+
|
| 849 |
+void ExportAsPDF(const rtl::OUString &rFileURL, PrintDialogRange eRange, const OUString &rRange)
|
| 850 |
+{
|
| 851 |
+ Reference < XFramesSupplier > xDesktop =
|
| 852 |
+ Reference < XFramesSupplier >(
|
| 853 |
+ ::comphelper::getProcessServiceFactory()->
|
| 854 |
+ createInstance( ASCII_STR("com.sun.star.frame.Desktop") ), UNO_QUERY );
|
| 855 |
+ Reference < XFrame > xFrame( xDesktop->getActiveFrame() );
|
| 856 |
+ if ( !xFrame.is() )
|
| 857 |
+ xFrame = Reference < XFrame >( xDesktop, UNO_QUERY );
|
| 858 |
+
|
| 859 |
+ Reference < XFilter >
|
| 860 |
+ xFilter( ::comphelper::getProcessServiceFactory()->
|
| 861 |
+ createInstance( ASCII_STR("com.sun.star.document.PDFFilter") ), UNO_QUERY );
|
| 862 |
+
|
| 863 |
+ if (xFilter.is())
|
| 864 |
+ {
|
| 865 |
+ Reference< XController > xController;
|
| 866 |
+ Reference< XComponent > xDoc;
|
| 867 |
+ if (xFrame.is())
|
| 868 |
+ xController = xFrame->getController();
|
| 869 |
+ if (xController.is())
|
| 870 |
+ xDoc = Reference< XComponent >( xController->getModel(), UNO_QUERY );
|
| 871 |
+
|
| 872 |
+ SvFileStream aStream (rFileURL, STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
|
| 873 |
+ Reference< XOutputStream > xOStm( new utl::OOutputStreamWrapper ( aStream ) );
|
| 874 |
+
|
| 875 |
+ Reference< XExporter > xExport(xFilter, UNO_QUERY);
|
| 876 |
+ xExport->setSourceDocument(xDoc);
|
| 877 |
+ Sequence<PropertyValue> aFilterData(2);
|
| 878 |
+ aFilterData[0].Name = ASCII_STR("PageLayout");
|
| 879 |
+ aFilterData[0].Value <<= sal_Int32(0);
|
| 880 |
+ aFilterData[1].Name = ASCII_STR("FirstPageOnLeft");
|
| 881 |
+ aFilterData[1].Value <<= sal_False;
|
| 882 |
+ switch (eRange)
|
| 883 |
+ {
|
| 884 |
+ case PRINTDIALOG_ALL:
|
| 885 |
+ case PRINTDIALOG_FROMTO:
|
| 886 |
+ break;
|
| 887 |
+ case PRINTDIALOG_RANGE:
|
| 888 |
+ aFilterData.realloc(aFilterData.getLength()+1);
|
| 889 |
+ aFilterData[aFilterData.getLength()-1].Name = ASCII_STR("PageRange");
|
| 890 |
+ aFilterData[aFilterData.getLength()-1].Value <<= rRange;
|
| 891 |
+ break;
|
| 892 |
+ case PRINTDIALOG_SELECTION:
|
| 893 |
+ {
|
| 894 |
+ Any aSelection;
|
| 895 |
+ try
|
| 896 |
+ {
|
| 897 |
+ if( xController.is() )
|
| 898 |
+ {
|
| 899 |
+ Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
|
| 900 |
+ if( xView.is() )
|
| 901 |
+ xView->getSelection() >>= aSelection;
|
| 902 |
+ }
|
| 903 |
+ }
|
| 904 |
+ catch( RuntimeException )
|
| 905 |
+ {
|
| 906 |
+ }
|
| 907 |
+ if (aSelection.hasValue())
|
| 908 |
+ {
|
| 909 |
+ aFilterData.realloc(aFilterData.getLength()+1);
|
| 910 |
+ aFilterData[aFilterData.getLength()-1].Name = ASCII_STR("Selection");
|
| 911 |
+ aFilterData[aFilterData.getLength()-1].Value <<= aSelection;
|
| 912 |
+ }
|
| 913 |
+ break;
|
| 914 |
+ }
|
| 915 |
+ }
|
| 916 |
+ Sequence<PropertyValue> aArgs(2);
|
| 917 |
+ aArgs[0].Name = ASCII_STR("FilterData");
|
| 918 |
+ aArgs[0].Value <<= aFilterData;
|
| 919 |
+ aArgs[1].Name = ASCII_STR("OutputStream");
|
| 920 |
+ aArgs[1].Value <<= xOStm;
|
| 921 |
+ xFilter->filter( aArgs );
|
| 922 |
+ }
|
| 923 |
+}
|
| 924 |
+
|
| 925 |
+struct ourhandle
|
| 926 |
+{
|
| 927 |
+ int papers;
|
| 928 |
+ int orients;
|
| 929 |
+ GtkWidget *pDialog;
|
| 930 |
+ GtkWidget *notebook;
|
| 931 |
+ GtkWidget *orientwidget;
|
| 932 |
+ GtkWidget *paperwidget;
|
| 933 |
+ Printer *pPrinter;
|
| 934 |
+ rtl::OUString sPrinter;
|
| 935 |
+ ourhandle() : papers(0), orients(0), pDialog(0), notebook(0), orientwidget(0), paperwidget(0), pPrinter(0) {}
|
| 936 |
+};
|
| 937 |
+
|
| 938 |
+static rtl::OUString OOoPrintName(GtkWidget *pDialog)
|
| 939 |
+{
|
| 940 |
+ rtl::OUString sPrinterName(ASCII_STR("Generic Printer"));
|
| 941 |
+
|
| 942 |
+ if (GtkPrintSettings* pSettings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG(pDialog)))
|
| 943 |
+ {
|
| 944 |
+ if (const gchar *uri = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_OUTPUT_URI))
|
| 945 |
+ {
|
| 946 |
+ if (gchar *pFile = g_filename_from_uri (uri, NULL, NULL))
|
| 947 |
+ {
|
| 948 |
+ if (pFile && strlen(pFile))
|
| 949 |
+ {
|
| 950 |
+ const gchar *pStr = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT);
|
| 951 |
+ if (pStr && !strcmp(pStr, "pdf"))
|
| 952 |
+ sPrinterName = rtl::OUString();
|
| 953 |
+ }
|
| 954 |
+ g_free(pFile);
|
| 955 |
+ g_object_unref(pSettings);
|
| 956 |
+ return sPrinterName;
|
| 957 |
+ }
|
| 958 |
+ }
|
| 959 |
+
|
| 960 |
+ if (GtkPrinter* pPrinter = gtk_print_unix_dialog_get_selected_printer(GTK_PRINT_UNIX_DIALOG(pDialog)))
|
| 961 |
+ {
|
| 962 |
+ const gchar *pStr = gtk_printer_get_name(pPrinter);
|
| 963 |
+ sPrinterName = rtl::OUString((const sal_Char *)pStr, strlen((const sal_Char*)(pStr)), RTL_TEXTENCODING_UTF8);
|
| 964 |
+ }
|
| 965 |
+ g_object_unref(pSettings);
|
| 966 |
+ }
|
| 967 |
+
|
| 968 |
+ return sPrinterName;
|
| 969 |
+}
|
| 970 |
+
|
| 971 |
+void SetProperties(ourhandle &rHandle, bool bForceUpdate)
|
| 972 |
+{
|
| 973 |
+ rtl::OUString sPrinter = OOoPrintName(rHandle.pDialog);
|
| 974 |
+
|
| 975 |
+ if (rHandle.sPrinter == sPrinter && !bForceUpdate)
|
| 976 |
+ return;
|
| 977 |
+
|
| 978 |
+ rHandle.sPrinter = sPrinter;
|
| 979 |
+
|
| 980 |
+ while (rHandle.orients)
|
| 981 |
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(rHandle.orientwidget), --rHandle.orients);
|
| 982 |
+ while (rHandle.papers)
|
| 983 |
+ gtk_combo_box_remove_text(GTK_COMBO_BOX(rHandle.paperwidget), --rHandle.papers);
|
| 984 |
+
|
| 985 |
+ gtk_widget_set_sensitive(rHandle.orientwidget, sPrinter.getLength());
|
| 986 |
+ gtk_widget_set_sensitive(rHandle.paperwidget, sPrinter.getLength());
|
| 987 |
+ rHandle.orients = 2;
|
| 988 |
+
|
| 989 |
+ if (!sPrinter.getLength())
|
| 990 |
+ return;
|
| 991 |
+
|
| 992 |
+ Printer *pFoo=0;
|
| 993 |
+ String sSelectedPaper;
|
| 994 |
+ if (rHandle.pPrinter && rtl::OUString(rHandle.pPrinter->GetName()) == sPrinter)
|
| 995 |
+ pFoo = rHandle.pPrinter;
|
| 996 |
+ else
|
| 997 |
+ pFoo = new Printer(sPrinter);
|
| 998 |
+
|
| 999 |
+ using namespace psp;
|
| 1000 |
+
|
| 1001 |
+ PrinterInfo aInfo(pFoo->GetPrinterInfo());
|
| 1002 |
+
|
| 1003 |
+ gtk_combo_box_append_text(GTK_COMBO_BOX(rHandle.orientwidget), "Portrait");
|
| 1004 |
+ gtk_combo_box_append_text(GTK_COMBO_BOX(rHandle.orientwidget), "Landscape");
|
| 1005 |
+ gtk_combo_box_set_active(GTK_COMBO_BOX(rHandle.orientwidget), aInfo.m_eOrientation == orientation::Landscape ? 1 : 0);
|
| 1006 |
+
|
| 1007 |
+ ::Orientation orient = pFoo->GetOrientation();
|
| 1008 |
+ gtk_combo_box_set_active(GTK_COMBO_BOX(rHandle.orientwidget), orient == ORIENTATION_LANDSCAPE ? 1 : 0);
|
| 1009 |
+ pFoo->SetOrientation(ORIENTATION_PORTRAIT);
|
| 1010 |
+ const vcl::PaperInfo &rPaperInfo = pFoo->GetCurrentPaperInfo();
|
| 1011 |
+ pFoo->SetOrientation(orient);
|
| 1012 |
+ sSelectedPaper = rPaperInfo.m_aPaperName;
|
| 1013 |
+
|
| 1014 |
+ if (aInfo.m_pParser)
|
| 1015 |
+ {
|
| 1016 |
+ const PPDKey* pKey = 0;
|
| 1017 |
+
|
| 1018 |
+ if ((pKey = aInfo.m_pParser->getKey(String(RTL_CONSTASCII_USTRINGPARAM("Duplex")))))
|
| 1019 |
+ {
|
| 1020 |
+ if (const PPDValue* pVal = aInfo.m_aContext.getValue( pKey ))
|
| 1021 |
+ {
|
| 1022 |
+ GtkPrintSettings* pTempSettings = gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(rHandle.pDialog));
|
| 1023 |
+
|
| 1024 |
+ String sDuplex(pVal->m_aOption);
|
| 1025 |
+ GtkPrintDuplex eDuplex = GTK_PRINT_DUPLEX_SIMPLEX;
|
| 1026 |
+
|
| 1027 |
+ if (pVal->m_aOption.EqualsIgnoreCaseAscii("DuplexNoTumble", 0, 14))
|
| 1028 |
+ eDuplex = GTK_PRINT_DUPLEX_HORIZONTAL;
|
| 1029 |
+ else if (pVal->m_aOption.EqualsIgnoreCaseAscii("DuplexTumble", 0, 12))
|
| 1030 |
+ eDuplex = GTK_PRINT_DUPLEX_VERTICAL;
|
| 1031 |
+
|
| 1032 |
+ if (gtk_print_settings_get_duplex(pTempSettings) != eDuplex)
|
| 1033 |
+ {
|
| 1034 |
+ gtk_print_settings_set_duplex(pTempSettings, eDuplex);
|
| 1035 |
+ gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(rHandle.pDialog), pTempSettings);
|
| 1036 |
+ }
|
| 1037 |
+ g_object_unref(pTempSettings);
|
| 1038 |
+ }
|
| 1039 |
+ }
|
| 1040 |
+
|
| 1041 |
+ if ((pKey = aInfo.m_pParser->getKey(String(RTL_CONSTASCII_USTRINGPARAM("PageSize")))))
|
| 1042 |
+ {
|
| 1043 |
+ int select = -1;
|
| 1044 |
+ const PPDValue* pSelectValue = sSelectedPaper.Len() ? 0 : aInfo.m_aContext.getValue(pKey);
|
| 1045 |
+ for (int i = 0; i < pKey->countValues(); i++)
|
| 1046 |
+ {
|
| 1047 |
+ const PPDValue* pValue = pKey->getValue(i);
|
| 1048 |
+ String aOptionText = pValue->m_aOptionTranslation.Len() ?
|
| 1049 |
+ pValue->m_aOptionTranslation : pValue->m_aOption;
|
| 1050 |
+
|
| 1051 |
+ if (aInfo.m_aContext.checkConstraints(pKey, pValue))
|
| 1052 |
+ {
|
| 1053 |
+ gtk_combo_box_append_text(GTK_COMBO_BOX(rHandle.paperwidget),
|
| 1054 |
+ rtl::OUStringToOString(aOptionText, RTL_TEXTENCODING_UTF8).getStr());
|
| 1055 |
+ if (pValue == pSelectValue || sSelectedPaper == aOptionText)
|
| 1056 |
+ select = i;
|
| 1057 |
+ ++rHandle.papers;
|
| 1058 |
+ }
|
| 1059 |
+ }
|
| 1060 |
+
|
| 1061 |
+ if (select != -1)
|
| 1062 |
+ gtk_combo_box_set_active(GTK_COMBO_BOX(rHandle.paperwidget), select);
|
| 1063 |
+ }
|
| 1064 |
+ }
|
| 1065 |
+
|
| 1066 |
+ if (pFoo != rHandle.pPrinter)
|
| 1067 |
+ delete pFoo;
|
| 1068 |
+}
|
| 1069 |
+
|
| 1070 |
+void switch_page_cb(GtkNotebook *, GtkNotebookPage *, guint, ourhandle *pHandle)
|
| 1071 |
+{
|
| 1072 |
+ if (pHandle)
|
| 1073 |
+ SetProperties(*pHandle, false);
|
| 1074 |
+}
|
| 1075 |
+
|
| 1076 |
+static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr)
|
| 1077 |
+{
|
| 1078 |
+ static bool bSet = false;
|
| 1079 |
+ if (bSet)
|
| 1080 |
+ return;
|
| 1081 |
+
|
| 1082 |
+ OUString sUILocale;
|
| 1083 |
+ try
|
| 1084 |
+ {
|
| 1085 |
+ uno::Reference<lang::XMultiServiceFactory> xConfigMgr =
|
| 1086 |
+ uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance(
|
| 1087 |
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
|
| 1088 |
+ UNO_QUERY_THROW );
|
| 1089 |
+
|
| 1090 |
+ Sequence< Any > theArgs(1);
|
| 1091 |
+ theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General");
|
| 1092 |
+
|
| 1093 |
+ uno::Reference< container::XNameAccess > xNameAccess =
|
| 1094 |
+ uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments(
|
| 1095 |
+ OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ),
|
| 1096 |
+ UNO_QUERY_THROW );
|
| 1097 |
+
|
| 1098 |
+ if (xNameAccess.is())
|
| 1099 |
+ xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale;
|
| 1100 |
+ } catch (...) {}
|
| 1101 |
+
|
| 1102 |
+ if (sUILocale.getLength())
|
| 1103 |
+ {
|
| 1104 |
+ sUILocale = rtl::OUString::createFromAscii("LANGUAGE=") + sUILocale.replace('-', '_');
|
| 1105 |
+ putenv(strdup(rtl::OUStringToOString(sUILocale, osl_getThreadTextEncoding()).getStr()));
|
| 1106 |
+ }
|
| 1107 |
+ bSet = true;
|
| 1108 |
+}
|
| 1109 |
+
|
| 1110 |
+static rtl::OString getPrintDialogSettings()
|
| 1111 |
+{
|
| 1112 |
+ rtl::OUString aIni;
|
| 1113 |
+ rtl::Bootstrap::get( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BRAND_BASE_DIR" ) ), aIni );
|
| 1114 |
+ aIni += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program/" SAL_CONFIGFILE( "bootstrap" ) ) );
|
| 1115 |
+ rtl::Bootstrap aBootstrap( aIni );
|
| 1116 |
+ rtl::OUString aUserPath;
|
| 1117 |
+ aBootstrap.getFrom( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UserInstallation" ) ), aUserPath );
|
| 1118 |
+ rtl::OUString aSysPath;
|
| 1119 |
+ if( osl_getSystemPathFromFileURL( aUserPath.pData, &aSysPath.pData ) == osl_File_E_None )
|
| 1120 |
+ {
|
| 1121 |
+ aUserPath = aSysPath;
|
| 1122 |
+ aUserPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/psprint/gtkprintdlg" ) );
|
| 1123 |
+ }
|
| 1124 |
+ return rtl::OUStringToOString(aUserPath, RTL_TEXTENCODING_UTF8);
|
| 1125 |
+}
|
| 1126 |
+
|
| 1127 |
short PrintDialog::Execute()
|
| 1128 |
{
|
| 1129 |
if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() )
|
| 1130 |
@@ -775,16 +1115,334 @@
|
| 1131 |
maNumCopies.SetSelection( Selection( 0, maNumCopies.GetText().Len() ) );
|
| 1132 |
ImplModifyControlHdl( NULL );
|
| 1133 |
|
| 1134 |
- // Dialog starten
|
| 1135 |
- short nRet = ModalDialog::Execute();
|
| 1136 |
-
|
| 1137 |
- // Wenn Dialog mit OK beendet wurde, dann die Daten updaten
|
| 1138 |
- if( nRet == TRUE )
|
| 1139 |
- {
|
| 1140 |
- if ( TEMPPRINTER() )
|
| 1141 |
- mpPrinter->SetPrinterProps( TEMPPRINTER() );
|
| 1142 |
- ImplFillDialogData();
|
| 1143 |
- }
|
| 1144 |
+ short nRet = false;
|
| 1145 |
+
|
| 1146 |
+ if (
|
| 1147 |
+ SvtMiscOptions().UseSystemFileDialog() &&
|
| 1148 |
+ !Application::GetDesktopEnvironment().equalsIgnoreAsciiCaseAscii("kde")
|
| 1149 |
+ )
|
| 1150 |
+ {
|
| 1151 |
+ unsigned long handle = GetParent() ? GetParent()->GetNativeHandle() : 0;
|
| 1152 |
+ GtkWindow *parent = handle ? GTK_WINDOW(handle) : NULL;
|
| 1153 |
+
|
| 1154 |
+ lcl_setGTKLanguage(::comphelper::getProcessServiceFactory());
|
| 1155 |
+ ourhandle aHandle;
|
| 1156 |
+ aHandle.pDialog = gtk_print_unix_dialog_new (NULL, parent);
|
| 1157 |
+
|
| 1158 |
+ rtl::OString aOptions(rtl::OUStringToOString(maBtnOptions.GetText(), RTL_TEXTENCODING_UTF8));
|
| 1159 |
+ aOptions = aOptions.replace('~','_');
|
| 1160 |
+
|
| 1161 |
+ gtk_dialog_add_button( GTK_DIALOG( aHandle.pDialog ), aOptions.getStr(), GTK_RESPONSE_HELP);
|
| 1162 |
+
|
| 1163 |
+ rtl::OUString aProperties(maBtnProperties.GetText());
|
| 1164 |
+ aProperties = aProperties.copy(0, aProperties.lastIndexOf(OUString(RTL_CONSTASCII_USTRINGPARAM(("...")))));
|
| 1165 |
+ aProperties = aProperties.replaceAt(aProperties.indexOf('~'), 1, OUString());
|
| 1166 |
+
|
| 1167 |
+ gtk_print_unix_dialog_set_manual_capabilities(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog),
|
| 1168 |
+ GtkPrintCapabilities(GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE |
|
| 1169 |
+ GTK_PRINT_CAPABILITY_REVERSE|GTK_PRINT_CAPABILITY_GENERATE_PDF|GTK_PRINT_CAPABILITY_GENERATE_PS));
|
| 1170 |
+
|
| 1171 |
+ GtkWidget *box = gtk_vbox_new(FALSE, 18);
|
| 1172 |
+ gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
| 1173 |
+
|
| 1174 |
+ GtkWidget *tablewidget = gtk_table_new (2, 2, FALSE);
|
| 1175 |
+ gtk_table_set_row_spacings (GTK_TABLE (tablewidget), 6);
|
| 1176 |
+ gtk_table_set_col_spacings (GTK_TABLE (tablewidget), 12);
|
| 1177 |
+
|
| 1178 |
+ gtk_box_pack_start (GTK_BOX (box), tablewidget, FALSE, FALSE, 0);
|
| 1179 |
+
|
| 1180 |
+
|
| 1181 |
+ aHandle.orientwidget = gtk_combo_box_new_text();
|
| 1182 |
+ aHandle.paperwidget = gtk_combo_box_new_text();
|
| 1183 |
+
|
| 1184 |
+ gtk_table_attach(GTK_TABLE(tablewidget), gtk_label_new(
|
| 1185 |
+ rtl::OUStringToOString(maOrientationStr, RTL_TEXTENCODING_UTF8).getStr()),
|
| 1186 |
+ 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 0, 0);
|
| 1187 |
+ gtk_table_attach(GTK_TABLE(tablewidget), aHandle.orientwidget, 1, 2, 0, 1,
|
| 1188 |
+ GTK_FILL, GTK_EXPAND, 0, 0);
|
| 1189 |
+ gtk_table_attach(GTK_TABLE(tablewidget), gtk_label_new(
|
| 1190 |
+ rtl::OUStringToOString(maPaperFormatStr, RTL_TEXTENCODING_UTF8).getStr()),
|
| 1191 |
+ 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 0, 0);
|
| 1192 |
+ gtk_table_attach(GTK_TABLE(tablewidget), aHandle.paperwidget, 1, 2, 1, 2,
|
| 1193 |
+ GTK_FILL, GTK_EXPAND, 0, 0);
|
| 1194 |
+
|
| 1195 |
+ gtk_widget_show_all(box);
|
| 1196 |
+
|
| 1197 |
+ rtl::OString sProperties(OUStringToOString(aProperties, RTL_TEXTENCODING_UTF8));
|
| 1198 |
+ gtk_print_unix_dialog_add_custom_tab(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog), box,
|
| 1199 |
+ gtk_label_new(sProperties.getStr()));
|
| 1200 |
+
|
| 1201 |
+ g_object_get(G_OBJECT(box),"parent", &aHandle.notebook,NULL);
|
| 1202 |
+
|
| 1203 |
+ //make this the child of the OOo document window, and make it
|
| 1204 |
+ //the parent of the future OOo options window
|
| 1205 |
+ if (parent) gtk_window_set_transient_for(GTK_WINDOW(aHandle.pDialog), parent);
|
| 1206 |
+ mnNativeHandle = reinterpret_cast<unsigned long>(aHandle.pDialog);
|
| 1207 |
+
|
| 1208 |
+ GtkPrintSettings* pTempSettings = gtk_print_settings_new_from_file(getPrintDialogSettings().getStr(), NULL);
|
| 1209 |
+ if (!pTempSettings)
|
| 1210 |
+ pTempSettings = gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog));
|
| 1211 |
+ if (const QueueInfo* pInfo = (const QueueInfo*)(maLbName.GetEntryData(maLbName.GetSelectEntryPos())))
|
| 1212 |
+ {
|
| 1213 |
+ gtk_print_settings_set_printer(pTempSettings, rtl::OUStringToOString(pInfo->GetPrinterName(),
|
| 1214 |
+ RTL_TEXTENCODING_UTF8).getStr());
|
| 1215 |
+ }
|
| 1216 |
+
|
| 1217 |
+ gtk_print_settings_set_int(pTempSettings, "n-copies", GetCopyCount());
|
| 1218 |
+ gtk_print_settings_set_collate(pTempSettings, IsCollateEnabled() && IsCollateChecked());
|
| 1219 |
+ if (mbRange)
|
| 1220 |
+ {
|
| 1221 |
+ GtkPageRange page_ranges;
|
| 1222 |
+ page_ranges.start = page_ranges.end = maRangeText.ToInt32()-1;
|
| 1223 |
+ gtk_print_settings_set_page_ranges(pTempSettings, &page_ranges, 1);
|
| 1224 |
+ gtk_print_unix_dialog_set_current_page(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog), page_ranges.start);
|
| 1225 |
+ }
|
| 1226 |
+ gtk_print_unix_dialog_set_settings(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog), pTempSettings);
|
| 1227 |
+ g_object_unref(pTempSettings);
|
| 1228 |
+
|
| 1229 |
+ aHandle.pPrinter = mpPrinter;
|
| 1230 |
+
|
| 1231 |
+ SetProperties(aHandle, true);
|
| 1232 |
+
|
| 1233 |
+ gulong nHID_PageChange=0;
|
| 1234 |
+ if (aHandle.notebook && GTK_IS_NOTEBOOK(aHandle.notebook))
|
| 1235 |
+ {
|
| 1236 |
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(aHandle.notebook), 0);
|
| 1237 |
+ nHID_PageChange = g_signal_connect(G_OBJECT(aHandle.notebook), "switch-page", G_CALLBACK(switch_page_cb), &aHandle);
|
| 1238 |
+ }
|
| 1239 |
+
|
| 1240 |
+ bool bContinue = true;
|
| 1241 |
+ while(bContinue)
|
| 1242 |
+ {
|
| 1243 |
+ bContinue = false;
|
| 1244 |
+ gint nStatus = gtk_dialog_run( GTK_DIALOG( aHandle.pDialog ) );
|
| 1245 |
+ switch( nStatus )
|
| 1246 |
+ {
|
| 1247 |
+ case GTK_RESPONSE_HELP:
|
| 1248 |
+ ClickOptionsHdl();
|
| 1249 |
+ bContinue = true;
|
| 1250 |
+ break;
|
| 1251 |
+ case GTK_RESPONSE_OK:
|
| 1252 |
+ {
|
| 1253 |
+ GtkPrintSettings* pSettings = gtk_print_unix_dialog_get_settings (GTK_PRINT_UNIX_DIALOG(aHandle.pDialog));
|
| 1254 |
+
|
| 1255 |
+ rtl::OUString sPath;
|
| 1256 |
+ if (const gchar *uri = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_OUTPUT_URI))
|
| 1257 |
+ {
|
| 1258 |
+ if (gchar *pFile = g_filename_from_uri (uri, NULL, NULL))
|
| 1259 |
+ {
|
| 1260 |
+ sPath = rtl::OUString((const sal_Char *)pFile, strlen((const sal_Char*)(pFile)), osl_getThreadTextEncoding());
|
| 1261 |
+ g_free(pFile);
|
| 1262 |
+ }
|
| 1263 |
+ }
|
| 1264 |
+ const gchar *pStr = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_PRINT_PAGES);
|
| 1265 |
+ if (pStr && !strcmp(pStr, "ranges"))
|
| 1266 |
+ {
|
| 1267 |
+ maRangeText = String();
|
| 1268 |
+ gint num_ranges;
|
| 1269 |
+ const GtkPageRange* pRanges = gtk_print_settings_get_page_ranges(pSettings, &num_ranges);
|
| 1270 |
+ for (gint i = 0; i < num_ranges; ++i)
|
| 1271 |
+ {
|
| 1272 |
+ maRangeText.Append(String::CreateFromInt32(pRanges[i].start+1));
|
| 1273 |
+ if (pRanges[i].start != pRanges[i].end)
|
| 1274 |
+ {
|
| 1275 |
+ maRangeText.AppendAscii("-");
|
| 1276 |
+ maRangeText.Append(String::CreateFromInt32(pRanges[i].end+1));
|
| 1277 |
+ }
|
| 1278 |
+
|
| 1279 |
+ if (i != num_ranges-1)
|
| 1280 |
+ maRangeText.AppendAscii(",");
|
| 1281 |
+ }
|
| 1282 |
+ meCheckRange = PRINTDIALOG_RANGE;
|
| 1283 |
+ }
|
| 1284 |
+ else if (pStr && !strcmp(pStr, "current"))
|
| 1285 |
+ {
|
| 1286 |
+ meCheckRange = PRINTDIALOG_RANGE;
|
| 1287 |
+
|
| 1288 |
+ try
|
| 1289 |
+ {
|
| 1290 |
+ Reference < XFramesSupplier > xDesktop = Reference < XFramesSupplier >(
|
| 1291 |
+ ::comphelper::getProcessServiceFactory()->
|
| 1292 |
+ createInstance( ASCII_STR("com.sun.star.frame.Desktop") ), UNO_QUERY );
|
| 1293 |
+ Reference < XFrame > xFrame( xDesktop->getActiveFrame() );
|
| 1294 |
+ if ( !xFrame.is() )
|
| 1295 |
+ xFrame = Reference < XFrame >( xDesktop, UNO_QUERY );
|
| 1296 |
+
|
| 1297 |
+ Reference< XController > xController;
|
| 1298 |
+ Reference< XSpreadsheetView > xSpreadsheetView;
|
| 1299 |
+ Reference< XSpreadsheet> xSheet;
|
| 1300 |
+ Reference< XSpreadsheetDocument > xSheetDoc;
|
| 1301 |
+ Reference< XIndexAccess > xSheets;
|
| 1302 |
+ Reference< XNamed > xName;
|
| 1303 |
+
|
| 1304 |
+ if (xFrame.is())
|
| 1305 |
+ xController = xFrame->getController();
|
| 1306 |
+ if (xController.is())
|
| 1307 |
+ xSpreadsheetView = Reference< XSpreadsheetView >(xController, UNO_QUERY);
|
| 1308 |
+ if (xSpreadsheetView.is())
|
| 1309 |
+ xSheet = Reference< XSpreadsheet>(xSpreadsheetView->getActiveSheet());
|
| 1310 |
+ if (xSheet.is())
|
| 1311 |
+ xName = Reference < XNamed >(xSheet, UNO_QUERY);
|
| 1312 |
+ if (xName.is())
|
| 1313 |
+ xSheetDoc = Reference< XSpreadsheetDocument >(xController->getModel(), UNO_QUERY);
|
| 1314 |
+ if (xSheetDoc.is())
|
| 1315 |
+ xSheets = Reference< XIndexAccess >(xSheetDoc->getSheets(), UNO_QUERY);
|
| 1316 |
+ if (xSheets.is())
|
| 1317 |
+ {
|
| 1318 |
+ const rtl::OUString &rName = xName->getName();
|
| 1319 |
+
|
| 1320 |
+ sal_Int32 i;
|
| 1321 |
+
|
| 1322 |
+ for( i = 0; i < xSheets->getCount(); ++i)
|
| 1323 |
+ {
|
| 1324 |
+ Reference < XNamed > xItem =
|
| 1325 |
+ Reference < XNamed >(xSheets->getByIndex(i), UNO_QUERY);
|
| 1326 |
+ if (rName == xItem->getName())
|
| 1327 |
+ break;
|
| 1328 |
+ }
|
| 1329 |
+
|
| 1330 |
+ if (i < xSheets->getCount())
|
| 1331 |
+ maRangeText = String::CreateFromInt32( i + 1 );
|
| 1332 |
+ }
|
| 1333 |
+ }
|
| 1334 |
+ catch (...) {}
|
| 1335 |
+ }
|
| 1336 |
+ else
|
| 1337 |
+ meCheckRange = PRINTDIALOG_ALL;
|
| 1338 |
+
|
| 1339 |
+ //Tell OOo to only print 1 simple copy, we'll stick everything
|
| 1340 |
+ //else through cups
|
| 1341 |
+ SetCopyCount(1);
|
| 1342 |
+ EnableCollate(false);
|
| 1343 |
+ CheckCollate(false);
|
| 1344 |
+
|
| 1345 |
+ pStr = 0;
|
| 1346 |
+
|
| 1347 |
+ if (sPath.getLength())
|
| 1348 |
+ pStr = gtk_print_settings_get(pSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT);
|
| 1349 |
+
|
| 1350 |
+ if (pStr && !strcmp(pStr, "pdf"))
|
| 1351 |
+ {
|
| 1352 |
+ gtk_widget_hide( aHandle.pDialog );
|
| 1353 |
+ rtl::OUString sFileURL;
|
| 1354 |
+ FileBase::getFileURLFromSystemPath(sPath, sFileURL);
|
| 1355 |
+ ExportAsPDF(sFileURL, meCheckRange, maRangeText);
|
| 1356 |
+ }
|
| 1357 |
+ else
|
| 1358 |
+ {
|
| 1359 |
+ nRet = TRUE;
|
| 1360 |
+ rtl::OUString sNewPrinterName(mpPrinter->GetName());
|
| 1361 |
+
|
| 1362 |
+ if (sPath.getLength())
|
| 1363 |
+ sNewPrinterName = ASCII_STR("Generic Printer");
|
| 1364 |
+ else if (GtkPrinter* pPrinter = gtk_print_unix_dialog_get_selected_printer(GTK_PRINT_UNIX_DIALOG(aHandle.pDialog)))
|
| 1365 |
+ {
|
| 1366 |
+ pStr = gtk_print_settings_get(pSettings, "lpr-commandline");
|
| 1367 |
+ if (pStr && *pStr)
|
| 1368 |
+ {
|
| 1369 |
+ sNewPrinterName = ASCII_STR("Generic Printer");
|
| 1370 |
+ psp::PrinterInfoManager& rManager( psp::PrinterInfoManager::get() );
|
| 1371 |
+ psp::PrinterInfo aInfo(rManager.getPrinterInfo(sNewPrinterName));
|
| 1372 |
+ aInfo.m_aCommand = rtl::OUString((const sal_Char *)pStr, strlen((const sal_Char*)(pStr)), RTL_TEXTENCODING_UTF8);
|
| 1373 |
+ rManager.changePrinterInfo(sNewPrinterName, aInfo);
|
| 1374 |
+ }
|
| 1375 |
+ else
|
| 1376 |
+ {
|
| 1377 |
+ pStr = gtk_printer_get_name(pPrinter);
|
| 1378 |
+ sNewPrinterName = rtl::OUString((const sal_Char *)pStr, strlen((const sal_Char*)(pStr)), RTL_TEXTENCODING_UTF8);
|
| 1379 |
+ }
|
| 1380 |
+ }
|
| 1381 |
+
|
| 1382 |
+ OUString sOldPrinterName(mpPrinter->GetName());
|
| 1383 |
+ if (sNewPrinterName != sOldPrinterName)
|
| 1384 |
+ {
|
| 1385 |
+ for (int i = 0; i < 2; ++i)
|
| 1386 |
+ {
|
| 1387 |
+ if (const QueueInfo* pInfo = Printer::GetQueueInfo( sNewPrinterName, false ))
|
| 1388 |
+ {
|
| 1389 |
+ Printer aTempPrinter(*pInfo);
|
| 1390 |
+ mpPrinter->SetPrinterProps(&aTempPrinter);
|
| 1391 |
+ break;
|
| 1392 |
+ }
|
| 1393 |
+ else
|
| 1394 |
+ {
|
| 1395 |
+ if (!i)
|
| 1396 |
+ {
|
| 1397 |
+ psp::PrinterInfoManager& rManager( psp::PrinterInfoManager::get() );
|
| 1398 |
+ rManager.stopsearch();
|
| 1399 |
+ rManager.startsearch();
|
| 1400 |
+ rManager.checkPrintersChanged(true);
|
| 1401 |
+ ImplDeletePrnQueueList();
|
| 1402 |
+ }
|
| 1403 |
+ else
|
| 1404 |
+ {
|
| 1405 |
+ fprintf(stderr, "OOo UNKNOWN PRINTER \"%s\"\n",
|
| 1406 |
+ rtl::OUStringToOString(sNewPrinterName, RTL_TEXTENCODING_UTF8).getStr());
|
| 1407 |
+ }
|
| 1408 |
+ }
|
| 1409 |
+ }
|
| 1410 |
+ }
|
| 1411 |
+ mpPrinter->Reset();
|
| 1412 |
+
|
| 1413 |
+ if (sPath.getLength())
|
| 1414 |
+ {
|
| 1415 |
+ mpPrinter->EnablePrintFile(true);
|
| 1416 |
+ mpPrinter->SetPrintFile(sPath);
|
| 1417 |
+ }
|
| 1418 |
+
|
| 1419 |
+ if (1 == gtk_combo_box_get_active(GTK_COMBO_BOX(aHandle.orientwidget)))
|
| 1420 |
+ mpPrinter->SetOrientation(ORIENTATION_LANDSCAPE);
|
| 1421 |
+ else
|
| 1422 |
+ mpPrinter->SetOrientation(ORIENTATION_PORTRAIT);
|
| 1423 |
+ gtk_print_settings_foreach(pSettings, setcupskey, mpPrinter);
|
| 1424 |
+
|
| 1425 |
+ mpPrinter->SetOrientation(ORIENTATION_PORTRAIT);
|
| 1426 |
+
|
| 1427 |
+ int nPapers = mpPrinter->GetPaperInfoCount();
|
| 1428 |
+ pStr = gtk_combo_box_get_active_text(GTK_COMBO_BOX(aHandle.paperwidget));
|
| 1429 |
+ if ( pStr && nPapers )
|
| 1430 |
+ {
|
| 1431 |
+ rtl::OUString sPaper((const sal_Char*)pStr, strlen((const sal_Char*)(pStr)), RTL_TEXTENCODING_UTF8);
|
| 1432 |
+ for (int i = 0; i < nPapers; ++i)
|
| 1433 |
+ {
|
| 1434 |
+ const vcl::PaperInfo &rInfo = mpPrinter->GetPaperInfo(i);
|
| 1435 |
+ if (rtl::OUString(rInfo.m_aPaperName) == sPaper)
|
| 1436 |
+ {
|
| 1437 |
+ mpPrinter->SetPaperFromInfo(rInfo);
|
| 1438 |
+ break;
|
| 1439 |
+ }
|
| 1440 |
+ }
|
| 1441 |
+ }
|
| 1442 |
+
|
| 1443 |
+ if (1 == gtk_combo_box_get_active(GTK_COMBO_BOX(aHandle.orientwidget)))
|
| 1444 |
+ mpPrinter->SetOrientation(ORIENTATION_LANDSCAPE);
|
| 1445 |
+ }
|
| 1446 |
+ gtk_print_settings_to_file(pSettings, getPrintDialogSettings().getStr(), NULL);
|
| 1447 |
+ g_object_unref(pSettings);
|
| 1448 |
+ }
|
| 1449 |
+ break;
|
| 1450 |
+ default:
|
| 1451 |
+ break;
|
| 1452 |
+ }
|
| 1453 |
+ }
|
| 1454 |
+ gtk_widget_hide( aHandle.pDialog );
|
| 1455 |
+ if (nHID_PageChange)
|
| 1456 |
+ g_signal_handler_disconnect(G_OBJECT(aHandle.notebook), nHID_PageChange);
|
| 1457 |
+ gtk_widget_destroy( aHandle.pDialog );
|
| 1458 |
+ }
|
| 1459 |
+ else
|
| 1460 |
+ {
|
| 1461 |
+ // Dialog starten
|
| 1462 |
+ nRet = ModalDialog::Execute();
|
| 1463 |
+
|
| 1464 |
+ // Wenn Dialog mit OK beendet wurde, dann die Daten updaten
|
| 1465 |
+ if( nRet == TRUE )
|
| 1466 |
+ {
|
| 1467 |
+ if ( TEMPPRINTER() )
|
| 1468 |
+ mpPrinter->SetPrinterProps( TEMPPRINTER() );
|
| 1469 |
+ ImplFillDialogData();
|
| 1470 |
+ }
|
| 1471 |
+ }
|
| 1472 |
|
| 1473 |
maStatusTimer.Stop();
|
| 1474 |
|
| 1475 |
@@ -798,4 +1456,3 @@
|
| 1476 |
mpPrinterImpl->m_bHelpDisabled = sal_True;
|
| 1477 |
maBtnHelp.Disable();
|
| 1478 |
}
|
| 1479 |
-
|
| 1480 |
Index: source/dialogs/printdlg.hrc
|
| 1481 |
===================================================================
|
| 1482 |
RCS file: /cvs/util/svtools/source/dialogs/printdlg.hrc,v
|
| 1483 |
retrieving revision 1.5
|
| 1484 |
diff -u -r1.5 printdlg.hrc
|
| 1485 |
--- openoffice.org.orig/svtools/source/dialogs/printdlg.hrc 8 Sep 2005 15:17:16 -0000 1.5
|
| 1486 |
+++ openoffice.org/svtools/source/dialogs/printdlg.hrc 16 Nov 2006 14:14:40 -0000
|
| 1487 |
@@ -78,5 +78,6 @@
|
| 1488 |
#define BTN_HELP 53
|
| 1489 |
#define BTN_OPTIONS 54
|
| 1490 |
|
| 1491 |
-#define STR_ALLFILTER 10
|
| 1492 |
-
|
| 1493 |
+#define STR_ALLFILTER 10
|
| 1494 |
+#define STR_PAPER_PAPER_TXT 11
|
| 1495 |
+#define STR_PAPER_ORIENTATION_TXT 12
|
| 1496 |
Index: source/gdi/print.cxx
|
| 1497 |
===================================================================
|
| 1498 |
RCS file: /cvs/gsl/vcl/source/gdi/print.cxx,v
|
| 1499 |
retrieving revision 1.57
|
| 1500 |
diff -u -r1.57 print.cxx
|
| 1501 |
--- openoffice.org.orig/vcl/source/gdi/print.cxx 17 Sep 2006 12:09:37 -0000 1.57
|
| 1502 |
+++ openoffice.org/vcl/source/gdi/print.cxx 20 Nov 2006 14:58:48 -0000
|
| 1503 |
@@ -799,6 +799,17 @@
|
| 1504 |
return FALSE;
|
| 1505 |
}
|
| 1506 |
|
| 1507 |
+psp::PrinterInfo Printer::GetPrinterInfo() const
|
| 1508 |
+{
|
| 1509 |
+ if (maJobSetup.GetPrinterName() == maPrinterName)
|
| 1510 |
+ return maJobSetup.GetPrinterInfo();
|
| 1511 |
+
|
| 1512 |
+ using namespace psp;
|
| 1513 |
+ PrinterInfoManager& rManager = PrinterInfoManager::get();
|
| 1514 |
+ PrinterInfo aInfo(rManager.getPrinterInfo(maPrinterName));
|
| 1515 |
+ return aInfo;
|
| 1516 |
+}
|
| 1517 |
+
|
| 1518 |
// -----------------------------------------------------------------------
|
| 1519 |
|
| 1520 |
|
| 1521 |
Index: source/dialogs/printdlg.src
|
| 1522 |
===================================================================
|
| 1523 |
RCS file: /cvs/util/svtools/source/dialogs/printdlg.src,v
|
| 1524 |
retrieving revision 1.45
|
| 1525 |
diff -u -r1.45 printdlg.src
|
| 1526 |
--- openoffice.org/svtools/source/dialogs/printdlg.src 23 Sep 2005 14:52:41 -0000 1.45
|
| 1527 |
+++ openoffice.org.orig/svtools/source/dialogs/printdlg.src 16 Nov 2006 14:14:44 -0000
|
| 1528 |
@@ -256,6 +256,16 @@
|
| 1529 |
{
|
| 1530 |
Text [ en-US ] = "<All>";
|
| 1531 |
};
|
| 1532 |
+ String STR_PAPER_PAPER_TXT
|
| 1533 |
+ {
|
| 1534 |
+ Text [ de ] = "Papierformat:";
|
| 1535 |
+ Text [ en-US ] = "Paper size:";
|
| 1536 |
+ };
|
| 1537 |
+ String STR_PAPER_ORIENTATION_TXT
|
| 1538 |
+ {
|
| 1539 |
+ Text [ de ] = "Orientierung:";
|
| 1540 |
+ Text [ en-US ] = "Orientation:";
|
| 1541 |
+ };
|
| 1542 |
};
|
| 1543 |
|
| 1544 |
Image RID_IMG_PRNDLG_COLLATE
|
| 1545 |
--- openoffice.org.orig/psprint/source/printer/printerinfomanager.cxx 2007-01-30 10:03:20.000000000 +0000
|
| 1546 |
+++ openoffice.org/psprint/source/printer/printerinfomanager.cxx 2007-01-29 12:49:51.000000000 +0000
|
| 1547 |
@@ -137,6 +137,14 @@
|
| 1548 |
|
| 1549 |
// -----------------------------------------------------------------
|
| 1550 |
|
| 1551 |
+void PrinterInfoManager::startsearch()
|
| 1552 |
+{
|
| 1553 |
+}
|
| 1554 |
+
|
| 1555 |
+void PrinterInfoManager::stopsearch()
|
| 1556 |
+{
|
| 1557 |
+}
|
| 1558 |
+
|
| 1559 |
bool PrinterInfoManager::checkPrintersChanged( bool bWait )
|
| 1560 |
{
|
| 1561 |
// check if files were created, deleted or modified since initialize()
|
| 1562 |
Index: inc/print.h
|
| 1563 |
===================================================================
|
| 1564 |
RCS file: /cvs/gsl/vcl/inc/print.h,v
|
| 1565 |
retrieving revision 1.3
|
| 1566 |
diff -u -r1.3 print.h
|
| 1567 |
--- openoffice.org.orig/vcl/inc/vcl/print.h 9 Sep 2005 11:15:23 -0000 1.3
|
| 1568 |
+++ openoffice.org/vcl/inc/vcl/print.h 15 Mar 2007 12:07:29 -0000
|
| 1569 |
@@ -82,6 +82,6 @@
|
| 1570 |
// - Prototypes -
|
| 1571 |
// --------------
|
| 1572 |
|
| 1573 |
-void ImplDeletePrnQueueList();
|
| 1574 |
+VCL_DLLPUBLIC void ImplDeletePrnQueueList();
|
| 1575 |
|
| 1576 |
#endif // _SV_PRINT_H
|
| 1577 |
--- openoffice.org.orig/sfx2/source/view/viewprn.cxx 2007-05-01 13:18:31.000000000 +0100
|
| 1578 |
+++ openoffice.org/sfx2/source/view/viewprn.cxx 2007-05-01 13:18:44.000000000 +0100
|
| 1579 |
@@ -203,6 +203,7 @@
|
| 1580 |
SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( _pPrintParent ? static_cast<Window*>(_pPrintParent)
|
| 1581 |
: static_cast<Window*>(_pSetupParent),
|
| 1582 |
_pViewSh, _pOptions );
|
| 1583 |
+ pDlg->SetNativeParent(_pPrintParent ? _pPrintParent->GetNativeHandle() : 0);
|
| 1584 |
if ( _bHelpDisabled )
|
| 1585 |
pDlg->DisableHelp();
|
| 1586 |
if ( pDlg->Execute() == RET_OK )
|
| 1587 |
Index: inc/salframe.hxx
|
| 1588 |
===================================================================
|
| 1589 |
RCS file: /cvs/gsl/vcl/inc/Attic/salframe.hxx,v
|
| 1590 |
retrieving revision 1.30
|
| 1591 |
diff -u -r1.30 salframe.hxx
|
| 1592 |
--- openoffice.org.orig/vcl/inc/vcl/salframe.hxx 1 Nov 2006 15:28:55 -0000 1.30
|
| 1593 |
+++ openoffice.org/vcl/inc/vcl/salframe.hxx 1 May 2007 12:21:25 -0000
|
| 1594 |
@@ -284,6 +284,9 @@
|
| 1595 |
// (e.g. input methods, printer update handlers).
|
| 1596 |
long CallCallback( USHORT nEvent, const void* pEvent ) const
|
| 1597 |
{ return m_pProc ? m_pProc( m_pWindow, const_cast<SalFrame*>(this), nEvent, pEvent ) : 0; }
|
| 1598 |
+
|
| 1599 |
+ virtual unsigned long GetNativeHandle() const { return 0; }
|
| 1600 |
+ virtual void SetNativeParent(unsigned long ) {}
|
| 1601 |
};
|
| 1602 |
|
| 1603 |
|
| 1604 |
Index: inc/window.hxx
|
| 1605 |
===================================================================
|
| 1606 |
RCS file: /cvs/gsl/vcl/inc/Attic/window.hxx,v
|
| 1607 |
retrieving revision 1.80.24.1
|
| 1608 |
diff -u -r1.80.24.1 window.hxx
|
| 1609 |
--- openoffice.org.orig/vcl/inc/vcl/window.hxx 19 Jan 2007 16:10:11 -0000 1.80.24.1
|
| 1610 |
+++ openoffice.org/vcl/inc/vcl/window.hxx 1 May 2007 12:21:29 -0000
|
| 1611 |
@@ -1133,6 +1133,9 @@
|
| 1612 |
|
| 1613 |
virtual XubString GetSurroundingText() const;
|
| 1614 |
virtual Selection GetSurroundingTextSelection() const;
|
| 1615 |
+
|
| 1616 |
+ virtual unsigned long GetNativeHandle() const;
|
| 1617 |
+ virtual void SetNativeParent(unsigned long nParent);
|
| 1618 |
};
|
| 1619 |
|
| 1620 |
|
| 1621 |
Index: source/window/window.cxx
|
| 1622 |
===================================================================
|
| 1623 |
RCS file: /cvs/gsl/vcl/source/window/window.cxx,v
|
| 1624 |
retrieving revision 1.249.24.3
|
| 1625 |
diff -u -r1.249.24.3 window.cxx
|
| 1626 |
--- openoffice.org.orig/vcl/source/window/window.cxx 26 Jan 2007 12:14:38 -0000 1.249.24.3
|
| 1627 |
+++ openoffice.org/vcl/source/window/window.cxx 1 May 2007 12:21:53 -0000
|
| 1628 |
@@ -4267,6 +4272,16 @@
|
| 1629 |
pFocusWin->mpFontCache->Release( pFontEntry );
|
| 1630 |
}
|
| 1631 |
|
| 1632 |
+unsigned long Window::GetNativeHandle() const
|
| 1633 |
+{
|
| 1634 |
+ return ImplGetFrame() ? ImplGetFrame()->GetNativeHandle() : 0;
|
| 1635 |
+}
|
| 1636 |
+
|
| 1637 |
+void Window::SetNativeParent(unsigned long nParent)
|
| 1638 |
+{
|
| 1639 |
+ if (ImplGetFrame()) ImplGetFrame()->SetNativeParent(nParent);
|
| 1640 |
+}
|
| 1641 |
+
|
| 1642 |
// -----------------------------------------------------------------------
|
| 1643 |
|
| 1644 |
Window::Window( WindowType nType )
|
| 1645 |
Index: unx/gtk/window/gtkframe.cxx
|
| 1646 |
===================================================================
|
| 1647 |
RCS file: /cvs/gsl/vcl/unx/gtk/window/gtkframe.cxx,v
|
| 1648 |
retrieving revision 1.59
|
| 1649 |
diff -u -r1.59 gtkframe.cxx
|
| 1650 |
--- openoffice.org.orig/vcl/unx/gtk/window/gtkframe.cxx 21 Dec 2006 12:04:26 -0000 1.59
|
| 1651 |
+++ openoffice.org/vcl/unx/gtk/window/gtkframe.cxx 1 May 2007 12:22:00 -0000
|
| 1652 |
@@ -719,6 +719,17 @@
|
| 1653 |
return (GtkSalFrame *) g_object_get_data( G_OBJECT( pWindow ), "SalFrame" );
|
| 1654 |
}
|
| 1655 |
|
| 1656 |
+unsigned long GtkSalFrame::GetNativeHandle() const
|
| 1657 |
+{
|
| 1658 |
+ return reinterpret_cast<unsigned long>(m_pWindow);
|
| 1659 |
+}
|
| 1660 |
+
|
| 1661 |
+void GtkSalFrame::SetNativeParent(unsigned long nParent)
|
| 1662 |
+{
|
| 1663 |
+ if (GtkWindow* pNativeParent = GTK_WINDOW(nParent))
|
| 1664 |
+ gtk_window_set_transient_for( GTK_WINDOW(m_pWindow), pNativeParent );
|
| 1665 |
+}
|
| 1666 |
+
|
| 1667 |
void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
|
| 1668 |
{
|
| 1669 |
if( nStyle & SAL_FRAME_STYLE_DEFAULT ) // ensure default style
|
| 1670 |
Index: unx/inc/plugins/gtk/gtkframe.hxx
|
| 1671 |
===================================================================
|
| 1672 |
RCS file: /cvs/gsl/vcl/unx/inc/plugins/gtk/gtkframe.hxx,v
|
| 1673 |
retrieving revision 1.25
|
| 1674 |
diff -u -r1.25 gtkframe.hxx
|
| 1675 |
--- openoffice.org.orig/vcl/unx/inc/plugins/gtk/gtkframe.hxx 1 Nov 2006 15:30:08 -0000 1.25
|
| 1676 |
+++ openoffice.org/vcl/unx/inc/plugins/gtk/gtkframe.hxx 1 May 2007 12:22:02 -0000
|
| 1677 |
@@ -389,6 +389,9 @@
|
| 1678 |
virtual void EndSetClipRegion();
|
| 1679 |
|
| 1680 |
static GtkSalFrame *getFromWindow( GtkWindow *pWindow );
|
| 1681 |
+
|
| 1682 |
+ virtual unsigned long GetNativeHandle() const;
|
| 1683 |
+ virtual void SetNativeParent(unsigned long nParent);
|
| 1684 |
};
|
| 1685 |
|
| 1686 |
|