[Libreoffice-commits] core.git: 4 commits - cui/uiconfig extras/source include/vcl vcl/inc vcl/source vcl/uiconfig
Caolán McNamara
caolanm at redhat.com
Mon May 20 03:26:41 PDT 2013
cui/uiconfig/ui/optgeneralpage.ui | 4 -
cui/uiconfig/ui/optmemorypage.ui | 2
cui/uiconfig/ui/select_persona_dialog.ui | 2
extras/source/glade/libreoffice-catalog.xml.in | 3
include/vcl/print.hxx | 2
vcl/inc/printdlg.hxx | 1
vcl/source/gdi/print3.cxx | 83 ++++++++++++++++++-------
vcl/source/window/printdlg.cxx | 12 +++
vcl/uiconfig/ui/printdialog.ui | 20 +++++-
9 files changed, 100 insertions(+), 29 deletions(-)
New commits:
commit 235941bcd0e59c2831d5bc28683119eb6a2fd982
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 20 11:25:41 2013 +0100
accidental hardcoding of %PRODUCTNAME as LibreOffice in some .ui files
Change-Id: I1e6c2c1b64d8566b29c1a1510040aadbca2d977e
diff --git a/cui/uiconfig/ui/optgeneralpage.ui b/cui/uiconfig/ui/optgeneralpage.ui
index 0db876a..7958965 100644
--- a/cui/uiconfig/ui/optgeneralpage.ui
+++ b/cui/uiconfig/ui/optgeneralpage.ui
@@ -140,7 +140,7 @@
<property name="column_spacing">6</property>
<child>
<object class="GtkCheckButton" id="filedlg">
- <property name="label" translatable="yes">_Use LibreOffice dialogs</property>
+ <property name="label" translatable="yes">_Use %PRODUCTNAME dialogs</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -205,7 +205,7 @@
<property name="left_padding">12</property>
<child>
<object class="GtkCheckButton" id="printdlg">
- <property name="label" translatable="yes">Use LibreOffice _dialogs</property>
+ <property name="label" translatable="yes">Use %PRODUCTNAME _dialogs</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/cui/uiconfig/ui/optmemorypage.ui b/cui/uiconfig/ui/optmemorypage.ui
index 3675e6c..d8c91b7 100644
--- a/cui/uiconfig/ui/optmemorypage.ui
+++ b/cui/uiconfig/ui/optmemorypage.ui
@@ -124,7 +124,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">_Use for LibreOffice</property>
+ <property name="label" translatable="yes">_Use for %PRODUCTNAME</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">graphiccache</property>
</object>
diff --git a/cui/uiconfig/ui/select_persona_dialog.ui b/cui/uiconfig/ui/select_persona_dialog.ui
index 7db2004..84b1201 100644
--- a/cui/uiconfig/ui/select_persona_dialog.ui
+++ b/cui/uiconfig/ui/select_persona_dialog.ui
@@ -79,7 +79,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">First visit Firefox Themes (https://addons.mozilla.org/firefox/themes). Find the Theme you like, and want to choose for LibreOffice.</property>
+ <property name="label" translatable="yes">First visit Firefox Themes (https://addons.mozilla.org/firefox/themes). Find the Theme you like, and want to choose for %PRODUCTNAME.</property>
<property name="wrap">True</property>
<property name="max_width_chars">54</property>
</object>
commit f937ef20f57b306191f7583c2d47b5ad3f2a73ee
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 20 11:00:19 2013 +0100
Related: fdo#61186 add a toggle to override the paper format
We now need a mechanism to instruct the print dialog that we want to force
printing to use the printer settings configured paper. Particularly
useful for nup printing and brochures
scenario 3: forcing printing to use the printer settings paper
a file->printer settings->properties->paper
set a paper size, ideally something not used in the test doc, e.g. Executive
b file->print->page layout and set pages per sheet to 4
the auto selection for paper will be the first paper size in use, i.e.
legal
c flip to options and toggle "use only paper size from printer preferences"
preview should reconfigure as "Executive"
Change-Id: Ie224c252c2cb6c9ee21be5c54e470bca1c7eb0bb
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index f40801e..40997dd 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -521,6 +521,8 @@ public:
VCL_PLUGIN_PUBLIC void setLastPage( sal_Bool i_bLastPage );
SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse );
SAL_DLLPRIVATE bool getReversePrint() const;
+ SAL_DLLPRIVATE void setPapersizeFromSetup( sal_Bool i_bPapersizeFromSetup );
+ SAL_DLLPRIVATE bool getPapersizeFromSetup() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter();
SAL_DLLPRIVATE void resetPaperToLastConfigured();
VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState );
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 30e5fe8..f879a63 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -175,6 +175,7 @@ namespace vcl
public:
CheckBox* mpToFileBox;
CheckBox* mpCollateSingleJobsBox;
+ CheckBox* mpPapersizeFromSetup;
OutputOptPage( VclBuilder* );
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index cea6bc3..7ea71cc 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -151,6 +151,7 @@ public:
sal_Bool mbFirstPage;
sal_Bool mbLastPage;
sal_Bool mbReversePageOrder;
+ sal_Bool mbPapersizeFromSetup;
view::PrintableState meJobState;
vcl::PrinterController::MultiPageSetup maMultiPage;
@@ -161,9 +162,6 @@ public:
// set by user through printer properties subdialog of printer settings dialog
Size maDefaultPageSize;
- // Set by user through printer properties subdialog of print dialog.
- // if set, pages are centered and trimmed onto the fixed page
- Size maFixedPageSize;
// set by user through printer properties subdialog of printer settings dialog
sal_Int32 mnDefaultPaperBin;
// Set by user through printer properties subdialog of print dialog.
@@ -187,6 +185,7 @@ public:
mbFirstPage( sal_True ),
mbLastPage( sal_False ),
mbReversePageOrder( sal_False ),
+ mbPapersizeFromSetup( sal_False ),
meJobState( view::PrintableState_JOB_STARTED ),
mpProgress( NULL ),
mnDefaultPaperBin( -1 ),
@@ -196,14 +195,14 @@ public:
Size getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const
{
- if( maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0 )
- return maFixedPageSize;
+ if( mbPapersizeFromSetup )
+ return maDefaultPageSize;
if( maMultiPage.nRows * maMultiPage.nColumns > 1 && ! bNoNUP )
return maMultiPage.aPaperSize;
return i_rPageSize;
}
bool isFixedPageSize() const
- { return maFixedPageSize.Width() != 0 && maFixedPageSize.Height() != 0; }
+ { return mbPapersizeFromSetup; }
PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP );
void resetPaperToLastConfigured();
};
@@ -407,6 +406,14 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
pController->setReversePrint( bReverse );
}
+ beans::PropertyValue* pPapersizeFromSetupVal = i_pController->getValue( OUString( "PapersizeFromSetup" ) );
+ if( pPapersizeFromSetupVal )
+ {
+ sal_Bool bPapersizeFromSetup = sal_False;
+ pPapersizeFromSetupVal->Value >>= bPapersizeFromSetup;
+ pController->setPapersizeFromSetup( bPapersizeFromSetup );
+ }
+
// setup NUp printing from properties
sal_Int32 nRows = i_pController->getIntProperty( OUString( "NUpRows" ), 1 );
sal_Int32 nCols = i_pController->getIntProperty( OUString( "NUpColumns" ), 1 );
@@ -766,7 +773,6 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
mpImplData->maDefaultPageSize = mpImplData->mpPrinter->GetPaperSize();
mpImplData->mpPrinter->Pop();
mpImplData->mnFixedPaperBin = -1;
- mpImplData->maFixedPageSize = Size();
}
void PrinterController::resetPrinterOptions( bool i_bFileOutput )
@@ -797,19 +803,25 @@ bool PrinterController::setupPrinter( Window* i_pParent )
Size aNewPaperSize(mpImplData->mpPrinter->GetPaperSize());
if (bRet)
{
- // was papersize or bin overridden ? if so we need to take action
- if( aNewPaperSize != aPaperSize )
+ bool bInvalidateCache = false;
+
+ // was papersize overridden ? if so we need to take action if we're
+ // configured to use the driver papersize
+ if (aNewPaperSize != mpImplData->maDefaultPageSize)
{
- mpImplData->maFixedPageSize = aNewPaperSize;
+ mpImplData->maDefaultPageSize = aNewPaperSize;
+ bInvalidateCache = getPapersizeFromSetup();
}
+ // was bin overridden ? if so we need to take action
sal_uInt16 nNewPaperBin = mpImplData->mpPrinter->GetPaperBin();
- if( nNewPaperBin != nPaperBin )
+ if (nNewPaperBin != nPaperBin)
{
mpImplData->mnFixedPaperBin = nNewPaperBin;
+ bInvalidateCache = true;
}
- if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin )
+ if (bInvalidateCache)
{
mpImplData->maPageCache.invalidate();
}
@@ -897,14 +909,11 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
//print dialog
void vcl::ImplPrinterControllerData::resetPaperToLastConfigured()
{
- Size aPaperSize(maDefaultPageSize);
- if (maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0)
- aPaperSize = maFixedPageSize;
mpPrinter->Push();
mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
Size aCurSize(mpPrinter->GetPaperSize());
- if (aPaperSize != aCurSize)
- mpPrinter->SetPaperSizeUser(aPaperSize, !isFixedPageSize());
+ if (aCurSize != maDefaultPageSize)
+ mpPrinter->SetPaperSizeUser(maDefaultPageSize, !isFixedPageSize());
mpPrinter->Pop();
}
@@ -1331,6 +1340,16 @@ bool PrinterController::getReversePrint() const
return mpImplData->mbReversePageOrder;
}
+void PrinterController::setPapersizeFromSetup( sal_Bool i_bPapersizeFromSetup )
+{
+ mpImplData->mbPapersizeFromSetup = i_bPapersizeFromSetup;
+}
+
+bool PrinterController::getPapersizeFromSetup() const
+{
+ return mpImplData->mbPapersizeFromSetup;
+}
+
Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const
{
boost::unordered_set< OUString, OUStringHash > aMergeSet;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 97804a9..f11044c 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -534,6 +534,7 @@ PrintDialog::OutputOptPage::OutputOptPage( VclBuilder *pUIBuilder )
{
pUIBuilder->get(mpToFileBox, "printtofile");
pUIBuilder->get(mpCollateSingleJobsBox, "singleprintjob");
+ pUIBuilder->get(mpPapersizeFromSetup, "papersizefromsetup");
}
void PrintDialog::OutputOptPage::readFromSettings()
@@ -671,6 +672,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterCont
maJobPage.mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.mpBorderCB->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.mpToFileBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
+ maOptionsPage.mpPapersizeFromSetup->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maJobPage.mpReverseOrderBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.mpCollateSingleJobsBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.mpPagesBtn->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
@@ -723,7 +725,7 @@ void PrintDialog::readFromSettings()
maNUpPage.readFromSettings();
maOptionsPage.readFromSettings();
- // read last selected tab page; if it exists, actiavte it
+ // read last selected tab page; if it exists, activate it
SettingsConfigItem* pItem = SettingsConfigItem::get();
OUString aValue = pItem->getValue( OUString( "PrintDialog" ),
OUString( "LastPage" ) );
@@ -1534,6 +1536,14 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
maPController->resetPrinterOptions( maOptionsPage.mpToFileBox->IsChecked() );
preparePreview( true, true );
}
+ else if( pButton == maOptionsPage.mpPapersizeFromSetup )
+ {
+ sal_Bool bChecked = maOptionsPage.mpPapersizeFromSetup->IsChecked();
+ maPController->setPapersizeFromSetup( bChecked );
+ maPController->setValue( OUString( "PapersizeFromSetup" ),
+ makeAny( bChecked ) );
+ preparePreview( true, true );
+ }
else if( pButton == maNUpPage.mpBrochureBtn )
{
PropertyValue* pVal = getValueForWindow( pButton );
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index a0d9453..2aa464b 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
+ <!-- interface-requires LibreOffice 1.0 -->
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">16384</property>
@@ -1128,8 +1129,6 @@
<object class="vcllo-ShowNupOrderWindow" id="orderpreview">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
- <property name="vexpand">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
</object>
@@ -1464,6 +1463,23 @@
<property name="height">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="papersizefromsetup">
+ <property name="label" translatable="yes">Use only paper size from printer preferences</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="no_show_all">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
</object>
</child>
</object>
commit 62a68bbbe0acea471a04a702ca1372495fc7a2fb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 20 10:20:14 2013 +0100
add NUP preview stub to glade catalog
Change-Id: Ic269107fd842950f881adc5a62783e55889cf742
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index c369903..58b99ac 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -117,6 +117,9 @@
<glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow"
generic-name="Print Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
+ <glade-widget-class title="NUP Preview" name="vcllo-ShowNupOrderWindow"
+ generic-name="NUP Preview" parent="GtkDrawingArea"
+ icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Rectangle Control" name="svxlo-SvxRectCtl"
generic-name="Rectangle Control" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
commit 71ebe4404b6e7c78a7d2e352f6af88d57209680a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon May 20 10:11:46 2013 +0100
Related: fdo#61186 always operate on printer settings paper format
scenario 2: with attached test document
a file->printer settings->properties->paper
set a paper size, ideally something not used in the test doc, e.g. Executive
b file->print->properties
the paper size here should now still be what was selected in a and
*not* what happened to be the current page format shown in the preview
which is legal
Change-Id: Ie2f440621201d309eb20a650122f9ff7bff441da
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index f230214..cea6bc3 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -781,26 +781,46 @@ bool PrinterController::setupPrinter( Window* i_pParent )
bool bRet = false;
if( mpImplData->mpPrinter.get() )
{
- // get old data
- Size aPaperSize( mpImplData->mpPrinter->PixelToLogic(
- mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ mpImplData->mpPrinter->Push();
+ mpImplData->mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
+
+ // get current data
+ Size aPaperSize(mpImplData->mpPrinter->GetPaperSize());
sal_uInt16 nPaperBin = mpImplData->mpPrinter->GetPaperBin();
+ // reset paper size back to last configured size, not
+ // whatever happens to be the current page
+ resetPaperToLastConfigured();
+
// call driver setup
bRet = mpImplData->mpPrinter->Setup( i_pParent );
- if( bRet )
+ Size aNewPaperSize(mpImplData->mpPrinter->GetPaperSize());
+ if (bRet)
{
- // was papersize or bin overridden ? if so we need to take action
- Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic(
- mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ // was papersize or bin overridden ? if so we need to take action
+ if( aNewPaperSize != aPaperSize )
+ {
+ mpImplData->maFixedPageSize = aNewPaperSize;
+ }
+
sal_uInt16 nNewPaperBin = mpImplData->mpPrinter->GetPaperBin();
+ if( nNewPaperBin != nPaperBin )
+ {
+ mpImplData->mnFixedPaperBin = nNewPaperBin;
+ }
+
if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin )
{
- mpImplData->maFixedPageSize = aNewPaperSize;
mpImplData->maPageCache.invalidate();
- mpImplData->mnFixedPaperBin = nNewPaperBin;
}
}
+ else
+ {
+ //restore to whatever it was before we entered this method
+ if (aPaperSize != aNewPaperSize)
+ mpImplData->mpPrinter->SetPaperSizeUser(aPaperSize, !mpImplData->isFixedPageSize());
+ }
+ mpImplData->mpPrinter->Pop();
}
return bRet;
}
More information about the Libreoffice-commits
mailing list