build | 18 +- configure.ac | 2 cui/uiconfig/ui/aboutdialog.ui | 2 fuzzyDiffGitBranches.pl | 45 +++++++ i18npool/source/localedata/localedata.cxx | 2 include/formula/grammar.hxx | 6 include/sfx2/viewsh.hxx | 3 include/test/calc_unoapi_test.hxx | 31 +++++ include/vcl/print.hxx | 17 +- include/vcl/printerinfomanager.hxx | 1 oox/source/core/xmlfilterbase.cxx | 6 oox/source/token/namespaces.hxx.tail | 1 oox/source/token/namespaces.txt | 2 oox/source/token/tokens.txt | 8 + padmin/source/prtsetup.cxx | 32 +++-- padmin/source/prtsetup.hxx | 6 patch-office-debs.sh | 116 +++++++++--------- postprocess/CustomTarget_registry.mk | 35 ++--- python3/UnpackedTarball_python3.mk | 1 python3/python-3.3.3-py17797.patch.1 | 44 +++++++ sc/CppunitTest_sc_condformats.mk | 111 +++++++++++++++++ sc/Module_sc.mk | 1 sc/inc/attarray.hxx | 1 sc/inc/calcconfig.hxx | 3 sc/inc/document.hxx | 6 sc/inc/sc.hrc | 5 sc/inc/unonames.hxx | 1 sc/qa/extras/sccondformats.cxx | 136 ++++++++++++++++++++++ sc/qa/unit/ucalc.cxx | 21 +-- sc/source/core/data/attarray.cxx | 8 - sc/source/core/data/documen2.cxx | 3 sc/source/core/data/documen9.cxx | 10 + sc/source/core/data/drwlayer.cxx | 59 +++++++++ sc/source/core/inc/interpre.hxx | 5 sc/source/core/tool/calcconfig.cxx | 20 ++- sc/source/core/tool/interpr1.cxx | 22 ++- sc/source/core/tool/interpr4.cxx | 10 + sc/source/filter/excel/excdoc.cxx | 14 ++ sc/source/filter/excel/xeextlst.cxx | 45 +++++++ sc/source/filter/inc/extlstcontext.hxx | 22 +++ sc/source/filter/inc/xeextlst.hxx | 17 ++ sc/source/filter/oox/excelfilter.cxx | 23 ++- sc/source/filter/oox/extlstcontext.cxx | 56 +++++++++ sc/source/filter/oox/workbookfragment.cxx | 3 sc/source/filter/oox/workbookhelper.cxx | 14 ++ sc/source/ui/app/scmod.cxx | 9 + sc/source/ui/docshell/docsh6.cxx | 8 + sc/source/ui/inc/docsh.hxx | 1 sc/source/ui/optdlg/calcoptionsdlg.cxx | 11 + sc/source/ui/optdlg/calcoptionsdlg.hxx | 1 sc/source/ui/src/scstring.src | 5 sc/source/ui/unoobj/cellsuno.cxx | 28 +++- sc/source/ui/unoobj/confuno.cxx | 57 +++++++++ sd/source/ui/remotecontrol/BluetoothServer.cxx | 2 sd/source/ui/view/DocumentRenderer.cxx | 25 ---- sfx2/source/view/viewprn.cxx | 4 sfx2/source/view/viewsh.cxx | 1 solenv/bin/modules/installer/windows/msiglobal.pm | 2 svl/source/numbers/zforfind.cxx | 38 +++++- svx/source/svdraw/svdoashp.cxx | 1 sw/inc/docary.hxx | 3 sw/inc/editsh.hxx | 1 sw/source/core/doc/docfmt.cxx | 15 ++ sw/source/core/doc/docnew.cxx | 28 ++++ sw/source/core/edit/edfld.cxx | 7 - sw/source/filter/ww8/docxattributeoutput.cxx | 9 + sw/source/filter/ww8/docxattributeoutput.hxx | 3 sw/source/filter/ww8/docxexport.cxx | 11 + sw/source/filter/ww8/wrtw8sty.cxx | 7 - sw/source/filter/ww8/wrtww8.hxx | 13 +- sw/source/filter/ww8/ww8par.cxx | 14 ++ sw/source/ui/dbui/dbmgr.cxx | 79 +++++++----- sysui/desktop/menus/base.desktop | 2 sysui/desktop/menus/calc.desktop | 2 sysui/desktop/menus/draw.desktop | 2 sysui/desktop/menus/impress.desktop | 2 sysui/desktop/menus/math.desktop | 2 sysui/desktop/menus/qstart.desktop | 2 sysui/desktop/menus/startcenter.desktop | 2 sysui/desktop/menus/writer.desktop | 2 sysui/desktop/menus/xsltfilter.desktop | 2 test/Library_subsequenttest.mk | 1 test/source/calc_unoapi_test.cxx | 37 +++++ translations | 2 vcl/generic/print/genprnpsp.cxx | 1 vcl/inc/jobset.h | 1 vcl/source/gdi/jobset.cxx | 2 vcl/source/gdi/pdfwriter_impl.cxx | 9 - vcl/source/gdi/print.cxx | 4 vcl/source/gdi/print3.cxx | 59 +++++---- vcl/unx/generic/printer/cupsmgr.cxx | 4 vcl/unx/kde4/KDE4FilePicker.cxx | 11 + vcl/unx/kde4/KDE4FilePicker.hxx | 2 93 files changed, 1268 insertions(+), 260 deletions(-)
New commits: commit 670cbd4fe1858d2255d981476401ecbd6adda5bb Merge: f001548 01b2bbb Author: Juergen Funk <juergen.funk...@cib.de> Date: Tue Aug 25 08:14:43 2015 +0200 Merge remote-tracking branch 'lhm/private/jmux/libreoffice-4-1-6+backports' into private/jmux/libreoffice-4-1-6+all commit 01b2bbbdb5c2bfc8c4760b248e3c16bd216b3fa9 Author: Vasily Melenchuk <vasily.melenc...@cib.de> Date: Thu Aug 20 15:48:04 2015 +0200 tdf#92324 Fixed MailMerge printing with values from database Locking of ExpFields is required to lock current state of fields and database cursor: generation of print preview and some other operations can cause changing of current database record, especially if document contains nextrecord fields. Reviewed-on: https://gerrit.libreoffice.org/17857 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit 959a5043ccb4bb027e0149a56d31ebb78d5eb862) Conflicts: sw/inc/editsh.hxx sw/source/core/edit/edfld.cxx sw/source/uibase/dbui/dbmgr.cxx Change-Id: If0466ef2489d96264380b5978ef7d7cf3f545c23 diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 6e49721..c214f39 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -394,6 +394,7 @@ public: void UpdateExpFlds(sal_Bool bCloseDB = sal_False);///< only every expression fields update void LockExpFlds(); void UnlockExpFlds(); + bool IsExpFldsLocked() const; SwFldUpdateFlags GetFldUpdateFlags(sal_Bool bDocSettings = sal_False) const; void SetFldUpdateFlags( SwFldUpdateFlags eFlags ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index ede37d0..22d426d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -469,6 +469,11 @@ void SwEditShell::UnlockExpFlds() } +bool SwEditShell::IsExpFldsLocked() const +{ + return GetDoc()->IsExpFldsLocked(); +} + void SwEditShell::SetFldUpdateFlags( SwFldUpdateFlags eFlags ) { getIDocumentSettingAccess()->setFieldUpdateFlags( eFlags ); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 3124540..e90b38c 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1155,14 +1155,21 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, pWorkDoc->EmbedAllLinks(); // #i69458# lock fields to prevent access to the result set while calculating layout + // tdf#92324: and do not unlock: keep document locked during printing to avoid + // ExpFields update during printing, generation of preview, etc. rWorkShell.LockExpFlds(); rWorkShell.CalcLayout(); - rWorkShell.UnlockExpFlds(); } SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh)); + // tdf#92324: Allow ExpFields update only by explicit instruction to avoid + // database cursor movement on any other fields update, for example during + // print preview and other operations + if ( rWorkShell.IsExpFldsLocked() ) + rWorkShell.UnlockExpFlds(); rWorkShell.ViewShell::UpdateFlds(); + rWorkShell.LockExpFlds(); SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh)); // launch MailMergeEvent if required @@ -1400,6 +1407,12 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, } while( !bCancel && (bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord())); + if ( xWorkDocSh.Is() && pWorkView->GetWrtShell().IsExpFldsLocked() ) + { + // Unlock ducment fields after merge complete + pWorkView->GetWrtShell().UnlockExpFlds(); + } + if( !bCreateSingleFile ) { if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER ) commit 95c340cf1a52b55aa40ac0ed97f02b4bcd5c23b0 Merge: 14910a4 9531d6f Author: Thorsten Behrens <thorsten.behr...@cib.de> Date: Thu Aug 20 14:33:37 2015 +0200 Merge branch 'private/bubli/lhm-4-1-6-backports' into private/jmux/libreoffice-4-1-6+backports commit 9531d6f899cdff7cc143f9935cfb88a16adffff9 Author: Thorsten Behrens <thorsten.behr...@cib.de> Date: Mon Aug 17 10:40:44 2015 +0200 Validate and re-indent mailmerge speedup fix Seems on master, e0ad036eed6b151ea81311fcf9ba46f1726b103c was mis-merged, fixed by Caolan via af8f938531909122ff7a056c2206af857324fdf3. It's actually correct here, just the indent was off. Change-Id: I457150cbebd09b7f1663f03a9ca144ca47532145 diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index c8c2572..3124540 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1231,45 +1231,45 @@ sal_Bool SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, rMergeDescriptor.pMailMergeConfigItem->AddMergedDocument( aMergeInfo ); } } - else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER ) - { - assert(!bCreateSingleFile); - if( 1 == nDocNo ) // set up printing only once at the beginning + else if( rMergeDescriptor.nMergeType == DBMGR_MERGE_PRINTER ) { - // printing should be done synchronously otherwise the document - // might already become invalid during the process - uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions ); - - aOptions.realloc( 2 ); - aOptions[ 0 ].Name = "Wait"; - aOptions[ 0 ].Value <<= sal_True; - aOptions[ 1 ].Name = "MonitorVisible"; - aOptions[ 1 ].Value <<= sal_False; - // move print options - const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray(); - for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption) + assert(!bCreateSingleFile); + if( 1 == nDocNo ) // set up printing only once at the beginning { - if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName" - || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages" - || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" ) + // printing should be done synchronously otherwise the document + // might already become invalid during the process + uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions ); + + aOptions.realloc( 2 ); + aOptions[ 0 ].Name = "Wait"; + aOptions[ 0 ].Value <<= sal_True; + aOptions[ 1 ].Name = "MonitorVisible"; + aOptions[ 1 ].Value <<= sal_False; + // move print options + const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray(); + for( sal_Int32 nOption = 0, nIndex = 1 ; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption) { - // add an option - aOptions.realloc( nIndex + 1 ); - aOptions[ nIndex ].Name = pPrintOptions[nOption].Name; - aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ; + if( pPrintOptions[nOption].Name == "CopyCount" || pPrintOptions[nOption].Name == "FileName" + || pPrintOptions[nOption].Name == "Collate" || pPrintOptions[nOption].Name == "Pages" + || pPrintOptions[nOption].Name == "Wait" || pPrintOptions[nOption].Name == "PrinterName" ) + { + // add an option + aOptions.realloc( nIndex + 1 ); + aOptions[ nIndex ].Name = pPrintOptions[nOption].Name; + aOptions[ nIndex++ ].Value = pPrintOptions[nOption].Value ; + } } - } - pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync ); - SfxPrinter* pDocPrt = pWorkView->GetPrinter(false); - JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : pWorkView->GetJobSetup(); - Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup ); + pWorkView->StartPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync ); + SfxPrinter* pDocPrt = pWorkView->GetPrinter(false); + JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : pWorkView->GetJobSetup(); + Printer::PreparePrintJob( pWorkView->GetPrinterController(), aJobSetup ); #if ENABLE_CUPS - psp::PrinterInfoManager::get().startBatchPrint(); + psp::PrinterInfoManager::get().startBatchPrint(); #endif + } + if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController())) + bCancel = true; } - if( !Printer::ExecutePrintJob( pWorkView->GetPrinterController())) - bCancel = true; - } else { assert( createTempFile ); commit 8f8d70070f437d37bdcb827faa1ea99c82dbd09f Author: Thorsten Behrens <thorsten.behr...@cib.de> Date: Thu Aug 13 17:17:22 2015 +0200 tdf#44388: handle the NULL clip correctly for pdf output With the rework to use basegfx polygon clipping (a334752), the case 'fully clipped away', aka NULL clip, aka nothing visible, stopped working. Manifests itself as an empty clip polygon, but with m_bClipRegion being true. Explicitely write out as zero-surface clip polygon. i#65128 is related. Change-Id: I57389fcd057d75dfa4e0de9ebb86794437c70b55 (cherry picked from commit 86b47f5138c0c5b882359a48052a796bc91a5afb) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index c478dff..ed55002 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -10608,14 +10608,14 @@ void PDFWriterImpl::updateGraphicsState() if( m_aCurrentPDFState.m_bClipRegion != rNewState.m_bClipRegion || ( rNewState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion != rNewState.m_aClipRegion ) ) { - if( m_aCurrentPDFState.m_bClipRegion && m_aCurrentPDFState.m_aClipRegion.count() ) + if( m_aCurrentPDFState.m_bClipRegion ) { aLine.append( "Q " ); // invalidate everything but the clip region m_aCurrentPDFState = GraphicsState(); rNewState.m_nUpdateFlags = sal::static_int_cast<sal_uInt16>(~GraphicsState::updateClipRegion); } - if( rNewState.m_bClipRegion && rNewState.m_aClipRegion.count() ) + if( rNewState.m_bClipRegion ) { // clip region is always stored in private PDF mapmode MapMode aNewMapMode = rNewState.m_aMapMode; @@ -10624,7 +10624,10 @@ void PDFWriterImpl::updateGraphicsState() m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode; aLine.append( "q " ); - m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine ); + if( rNewState.m_aClipRegion.count() ) + m_aPages.back().appendPolyPolygon( rNewState.m_aClipRegion, aLine ); + else + aLine.append( "0 0 m h " ); // NULL clip, i.e. nothing visible aLine.append( "W* n\n" ); rNewState.m_aMapMode = aNewMapMode; getReferenceDevice()->SetMapMode( rNewState.m_aMapMode ); commit f00154826af373d92848233289ce1e3f6e76d316 Merge: acab904 14910a4 Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Fri Aug 14 14:54:47 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+backports' into private/jmux/libreoffice-4-1-6+all commit acab90404f7bffdeef6b55a7a57cd25c39b965c0 Merge: 020e159 61a4fa6 Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Fri Aug 14 14:54:36 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+lhm' into private/jmux/libreoffice-4-1-6+all commit 14910a42d126e0c08f7cfaa4ce94d33bed3126c3 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Tue Jul 7 12:08:33 2015 +0200 Related tdf#91362: disable paper size & orientation selection Unless 'Use only papersize from printer prefs' is toggled on, whatever the user sets here doesn't have any effect on the actual printing (page settings from the document are used instead). It is misleading to have the user believe otherwise. It was really challenging to have this one toggle get all the way down through several layers of abstraction, though ... Change-Id: If240084ca23b3946a92882a6ee47dbc161b3b86c Reviewed-on: https://gerrit.libreoffice.org/16812 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Katarina Behrens <katarina.behr...@cib.de> (cherry picked from commit 2a1fe443a8343642292444be19cbd10700e7e01c) Conflicts: include/vcl/print.hxx include/vcl/printerinfomanager.hxx vcl/generic/print/prtsetup.cxx vcl/inc/jobset.h vcl/source/gdi/print.cxx vcl/source/gdi/print3.cxx diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 4a92709..b62311c 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -302,7 +302,7 @@ public: const JobSetup& GetJobSetup() const { return maJobSetup; } void SetJobValue( const OUString& rKey, const OUString& rValue ) { maJobSetup.SetValue( rKey, rValue ); } - sal_Bool Setup( Window* pWindow = NULL ); + sal_Bool Setup( Window* pWindow = NULL, bool bPapersizeFromSetup = false ); sal_Bool SetPrinterProps( const Printer* pPrinter ); // SetPrinterOptions is used internally only now diff --git a/include/vcl/printerinfomanager.hxx b/include/vcl/printerinfomanager.hxx index d93f43d..a6cbbcb 100644 --- a/include/vcl/printerinfomanager.hxx +++ b/include/vcl/printerinfomanager.hxx @@ -64,6 +64,7 @@ struct PrinterInfo : JobData m_aFontSubstitutes; boost::unordered_map< fontID, fontID > m_aFontSubstitutions; + bool m_bPapersizeFromSetup; PrinterInfo() : JobData(), diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index aa0651e..02dfaa0 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -283,6 +283,14 @@ void RTSPaperPage::update() m_pSlotText->Enable( sal_False ); m_pSlotBox->Enable( sal_False ); } + + // disable those, unless user wants to use papersize from printer prefs + // as they have no influence on what's going to be printed anyway + if (!m_pParent->m_aJobData.m_bPapersizeFromSetup) + { + m_pPaperBox->Enable( sal_False ); + m_pOrientBox->Enable( sal_False ); + } } // -------------------------------------------------------------------------- diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 9ffb69c..cdb845d 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -577,6 +577,7 @@ sal_Bool PspSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pJobSetup ) SetData( ~0, pJobSetup ); JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo ); } + aInfo.m_bPapersizeFromSetup = pJobSetup->mbPapersizeFromSetup; if( pSetupFunction( aInfo ) ) { diff --git a/vcl/inc/jobset.h b/vcl/inc/jobset.h index 262e8b5..f90a9cd 100644 --- a/vcl/inc/jobset.h +++ b/vcl/inc/jobset.h @@ -56,6 +56,7 @@ struct ImplJobSetup sal_uIntPtr mnDriverDataLen; // length of system specific data sal_uInt8* mpDriverData; // system specific data (will be streamed a byte block) ::boost::unordered_map< OUString, OUString, OUStringHash > maValueMap; + bool mbPapersizeFromSetup; ImplJobSetup(); ImplJobSetup( const ImplJobSetup& rJobSetup ); diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 9ec7cf0..7098bbb 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -62,6 +62,7 @@ ImplJobSetup::ImplJobSetup() mnPaperHeight = 0; mnDriverDataLen = 0; mpDriverData = NULL; + mbPapersizeFromSetup = false; } ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : @@ -84,6 +85,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : } else mpDriverData = NULL; + mbPapersizeFromSetup = rJobSetup.mbPapersizeFromSetup; maValueMap = rJobSetup.maValueMap; } diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index bbda65f..f2fa9e2 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -752,7 +752,7 @@ sal_Bool Printer::SetJobSetup( const JobSetup& rSetup ) -sal_Bool Printer::Setup( Window* pWindow ) +sal_Bool Printer::Setup( Window* pWindow, bool bPapersizeFromSetup ) { if ( IsDisplayPrinter() ) return sal_False; @@ -761,6 +761,8 @@ sal_Bool Printer::Setup( Window* pWindow ) return sal_False; JobSetup aJobSetup = maJobSetup; + ImplJobSetup* pData = aJobSetup.ImplGetData(); + pData->mbPapersizeFromSetup = bPapersizeFromSetup; SalFrame* pFrame; if ( !pWindow ) pWindow = ImplGetDefaultWindow(); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index d3e99d6..43818c9 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -826,7 +826,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) } // call driver setup - bRet = mpImplData->mpPrinter->Setup( i_pParent ); + bRet = mpImplData->mpPrinter->Setup( i_pParent, getPapersizeFromSetup() ); Size aNewPaperSize(mpImplData->mpPrinter->GetPaperSize()); if (bRet) { commit bb33747a1769c598f10d00d02a015c3757244cfe Author: Katarina Behrens <katarina.behr...@cib.de> Date: Thu Jul 2 15:34:11 2015 +0200 tdf#91362: Make "printer was modified" status persistent To test: Scenario 1: * go to Writer -> Format -> Page * select page format and orientation, if possible a different one than the default in your env. * File -> Print -> Properties should now show those values (and not the default values from the printer) Scenario 2 (aka Scenario 2 from tdf#61186) * now go to File -> Printer settings * change page format and orientation, if possible to yet a different one than the printer default and a page one * File -> Print -> Properties should now show what was selected in Printer settings and not the format of the page Change-Id: Ibc84540f428b79dbec2587c50eefe526a62751b3 Reviewed-on: https://gerrit.libreoffice.org/16716 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 0251e61640b94094918406b33ee7b05564409feb) Conflicts: include/sfx2/viewsh.hxx sfx2/source/view/viewprn.cxx sfx2/source/view/viewsh.cxx vcl/generic/print/prtsetup.cxx vcl/source/gdi/print3.cxx diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 57d067d..1e1c760 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -140,7 +140,8 @@ friend class SfxPrinterController; SfxViewFrame* pFrame; SfxShell* pSubShell; Window* pWindow; - sal_Bool bNoNewWindow; + sal_Bool bNoNewWindow; + sal_Bool mbPrinterSettingsModified; protected: virtual void Activate(sal_Bool IsMDIActivate); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 4fa9740..4a92709 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -531,6 +531,8 @@ public: SAL_DLLPRIVATE bool getReversePrint() const; SAL_DLLPRIVATE void setPapersizeFromSetup( sal_Bool i_bPapersizeFromSetup ); SAL_DLLPRIVATE bool getPapersizeFromSetup() const; + VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup ); + VCL_PLUGIN_PUBLIC bool getPrinterModified() const; SAL_DLLPRIVATE void pushPropertiesToPrinter(); SAL_DLLPRIVATE void resetPaperToLastConfigured(); VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState ); diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index d15dd13..aa0651e 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -311,12 +311,12 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) } if( pKey ) { - m_pParent->SetDataModified( true ); PPDValue* pValue = (PPDValue*)pBox->GetEntryData( pBox->GetSelectEntryPos() ); m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); update(); } + m_pParent->SetDataModified( true ); return 0; } diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index e424cbd..e0defb0 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -624,6 +624,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( OUString( "JobName" ), makeAny( OUString( pObjShell->GetTitle(0) ) ) ); + pController->setPrinterModified( mbPrinterSettingsModified ); } void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, sal_Bool bIsAPI, sal_Bool bIsDirect ) @@ -882,6 +883,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) // forget new printer, it was taken over (as pPrinter) or deleted pDlgPrinter = NULL; + mbPrinterSettingsModified = true; } else diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 0ac1b20..8e314b4 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1238,6 +1238,7 @@ SfxViewShell::SfxViewShell , pSubShell(0) , pWindow(0) , bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) ) +, mbPrinterSettingsModified(false) { DBG_CTOR(SfxViewShell, 0); diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 14c6528..d3e99d6 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -152,6 +152,7 @@ public: sal_Bool mbLastPage; sal_Bool mbReversePageOrder; sal_Bool mbPapersizeFromSetup; + sal_Bool mbPrinterModified; view::PrintableState meJobState; vcl::PrinterController::MultiPageSetup maMultiPage; @@ -186,6 +187,7 @@ public: mbLastPage( sal_False ), mbReversePageOrder( sal_False ), mbPapersizeFromSetup( sal_False ), + mbPrinterModified( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), mpProgress( NULL ), mnDefaultPaperBin( -1 ), @@ -818,7 +820,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // whatever happens to be the current page // (but only if the printer config has changed, otherwise // don't override printer page auto-detection - tdf#91362) - if (!mpImplData->mpPrinter->IsDefPrinter()) + if (getPrinterModified()) { resetPaperToLastConfigured(); } @@ -1377,6 +1379,16 @@ bool PrinterController::getPapersizeFromSetup() const return mpImplData->mbPapersizeFromSetup; } +void PrinterController::setPrinterModified( bool i_bPrinterModified ) +{ + mpImplData->mbPrinterModified = i_bPrinterModified; +} + +bool PrinterController::getPrinterModified() const +{ + return mpImplData->mbPrinterModified; +} + Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const { boost::unordered_set< OUString, OUStringHash > aMergeSet; commit 8775f656ff60e2685147272d33799d8664fac72a Author: Katarina Behrens <katarina.behr...@cib.de> Date: Wed Jun 24 17:31:32 2015 +0200 tdf#91362: Don't override printer page autodetection if printer settings haven't been modified Reviewed-on: https://gerrit.libreoffice.org/16454 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit 07602e5a8b869be1c45158cf71d6015d17a5f797) Conflicts: include/vcl/print.hxx vcl/generic/print/prtsetup.cxx vcl/generic/print/prtsetup.hxx Change-Id: I68b0096ce6fa0f9e50db640a0acb3039ff7e66b5 diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 24112e2..4fa9740 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -288,11 +288,12 @@ public: virtual void Error(); - const OUString& GetName() const { return maPrinterName; } - const OUString& GetDriverName() const { return maDriver; } - sal_Bool IsDefPrinter() const { return mbDefPrinter; } - sal_Bool IsDisplayPrinter() const { return mpDisplayDev != NULL; } - sal_Bool IsValid() const { return !IsDisplayPrinter(); } + const OUString& GetName() const { return maPrinterName; } + const OUString& GetDriverName() const { return maDriver; } + bool IsDefPrinter() const { return mbDefPrinter; } + void SetDefPrinter(bool bDef) { mbDefPrinter = bDef; } + bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; } + bool IsValid() const { return !IsDisplayPrinter(); } sal_uLong GetCapabilities( sal_uInt16 nType ) const; sal_Bool HasSupport( PrinterSupport eFeature ) const; diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index 5ee4958..d15dd13 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -311,6 +311,7 @@ IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) } if( pKey ) { + m_pParent->SetDataModified( true ); PPDValue* pValue = (PPDValue*)pBox->GetEntryData( pBox->GetSelectEntryPos() ); m_pParent->m_aJobData.m_aContext.setValue( pKey, pValue ); @@ -480,6 +481,7 @@ IMPL_LINK( RTSDevicePage, SelectHdl, ListBox*, pBox ) FillValueBox( pKey ); } } + m_pParent->SetDataModified( true ); return 0; } @@ -815,10 +817,12 @@ extern "C" { int nRet = 0; RTSDialog aDialog( rJobData, rJobData.m_aPrinterName, false ); + // return 0 if cancel was pressed or if the data + // weren't modified, 1 otherwise if( aDialog.Execute() ) { rJobData = aDialog.getSetup(); - nRet = 1; + nRet = aDialog.GetDataModified() ? 1 : 0; } return nRet; diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx index efc2170..ae80614 100644 --- a/padmin/source/prtsetup.hxx +++ b/padmin/source/prtsetup.hxx @@ -69,6 +69,8 @@ class RTSDialog : public TabDialog // some resources OUString m_aInvalidString; + bool mbDataModified; + DECL_LINK( ActivatePage, TabControl* ); DECL_LINK( ClickButton, Button* ); @@ -79,6 +81,9 @@ public: ~RTSDialog(); const ::psp::PrinterInfo& getSetup() const { return m_aJobData; } + + void SetDataModified( bool bModified ) { mbDataModified = bModified; } + bool GetDataModified() const { return mbDataModified; } }; class RTSPaperPage : public TabPage diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index a22d34a..14c6528 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -816,7 +816,12 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // reset paper size back to last configured size, not // whatever happens to be the current page - resetPaperToLastConfigured(); + // (but only if the printer config has changed, otherwise + // don't override printer page auto-detection - tdf#91362) + if (!mpImplData->mpPrinter->IsDefPrinter()) + { + resetPaperToLastConfigured(); + } // call driver setup bRet = mpImplData->mpPrinter->Setup( i_pParent ); @@ -845,6 +850,8 @@ bool PrinterController::setupPrinter( Window* i_pParent ) { mpImplData->maPageCache.invalidate(); } + // Settings have been modified (i.e. this printer is no longer default ) + mpImplData->mpPrinter->SetDefPrinter( false ); } else { commit 61a4fa6754c1f9607bfb3616e8747602fd755586 Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Fri Aug 14 08:56:07 2015 +0200 Revert "Patch von Lanedo für #11826 integriert." This reverts commit cf644323043d5439b350371965d5cdffb82c9bf7. in tdf91362 there's a better solution implemented diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 11bb8ee..a544515 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -1438,11 +1438,7 @@ private: else if (rInfo.maPageSize.Width() < rInfo.maPageSize.Height()) rInfo.meOrientation = ORIENTATION_LANDSCAPE; - Size aPaperSize (rInfo.mpPrinter->GetPaperSize()); - // In Draw, use paper size set in page format - if (mpOptions->IsDraw()) - aPaperSize = rInfo.maPageSize; - + const Size aPaperSize (rInfo.mpPrinter->GetPaperSize()); if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE && (aPaperSize.Width() < aPaperSize.Height())) || @@ -1507,21 +1503,10 @@ private: if (mpOptions->IsTime()) aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( Time( Time::SYSTEM ), sal_False, sal_False ); - - // In Draw, use paper size set in page format - if (mpOptions->IsDraw()) - { - aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PK_STANDARD)->GetSize(); - maPrintSize = awt::Size(aInfo.maPrintSize.Width(), - aInfo.maPrintSize.Height()); - } - else - { - aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize(); - maPrintSize = awt::Size( - aInfo.mpPrinter->GetPaperSize().Width(), - aInfo.mpPrinter->GetPaperSize().Height()); - } + aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize(); + maPrintSize = awt::Size( + aInfo.mpPrinter->GetPaperSize().Width(), + aInfo.mpPrinter->GetPaperSize().Height()); switch (mpOptions->GetOutputQuality()) { commit edb2f7751e6172424caf2ed6422181bee6d59e1b Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Thu Aug 13 10:00:43 2015 +0200 Revert "Auswahl von PapiergröÃe und -orientierung deaktiviert (Trac #11826)" This reverts commit 22a99b059a0d7655e74b65441c706102be8d6896. This patch has caused trac#15629 and there's a better solution in master. So we revert this patch. diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index b07f3be..5ee4958 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -206,7 +206,6 @@ RTSPaperPage::RTSPaperPage(RTSDialog* pParent) { get(m_pPaperText, "paperft"); get(m_pPaperBox, "paperlb"); - get(m_pOrientText, "label4"); get(m_pOrientBox, "orientlb"); get(m_pDuplexText, "duplexft"); get(m_pDuplexBox, "duplexlb"); @@ -248,8 +247,6 @@ void RTSPaperPage::update() // orientation m_pOrientBox->SelectEntryPos( m_pParent->m_aJobData.m_eOrientation == orientation::Portrait ? 0 : 1); - m_pOrientBox->Enable( sal_False ); - m_pOrientText->Enable( sal_False ); // duplex if( m_pParent->m_aJobData.m_pParser && @@ -268,8 +265,6 @@ void RTSPaperPage::update() (pKey = m_pParent->m_aJobData.m_pParser->getKey( String( "PageSize" ) )) ) { m_pParent->insertAllPPDValues( *m_pPaperBox, m_pParent->m_aJobData.m_pParser, pKey ); - m_pPaperBox->Enable( sal_False ); - m_pPaperText->Enable( sal_False ); } else { @@ -295,26 +290,25 @@ void RTSPaperPage::update() IMPL_LINK( RTSPaperPage, SelectHdl, ListBox*, pBox ) { const PPDKey* pKey = NULL; - /*if( pBox == m_pPaperBox ) + if( pBox == m_pPaperBox ) { if( m_pParent->m_aJobData.m_pParser ) pKey = m_pParent->m_aJobData.m_pParser->getKey( String( "PageSize" ) ); } - else */ - if( pBox == m_pDuplexBox ) + else if( pBox == m_pDuplexBox ) { if( m_pParent->m_aJobData.m_pParser ) pKey = m_pParent->m_aJobData.m_pParser->getKey( String( "Duplex" ) ); - } else - if( pBox == m_pSlotBox ) + } + else if( pBox == m_pSlotBox ) { if( m_pParent->m_aJobData.m_pParser ) pKey = m_pParent->m_aJobData.m_pParser->getKey( String( "InputSlot" ) ); } - /*else if( pBox == m_pOrientBox ) + else if( pBox == m_pOrientBox ) { m_pParent->m_aJobData.m_eOrientation = m_pOrientBox->GetSelectEntryPos() == 0 ? orientation::Portrait : orientation::Landscape; - }*/ + } if( pKey ) { PPDValue* pValue = diff --git a/padmin/source/prtsetup.hxx b/padmin/source/prtsetup.hxx index 69e7b70..efc2170 100644 --- a/padmin/source/prtsetup.hxx +++ b/padmin/source/prtsetup.hxx @@ -88,7 +88,6 @@ class RTSPaperPage : public TabPage FixedText* m_pPaperText; ListBox* m_pPaperBox; - FixedText* m_pOrientText; ListBox* m_pOrientBox; FixedText* m_pDuplexText; commit c55cd2ed57b419536355c738a231136e0db97677 Author: Christoph Lutz <christoph.lutz...@cib.de> Date: Thu Aug 13 09:59:12 2015 +0200 Revert "Handle fixed page size printer option." This reverts commit b002226b5c9a970960de39be535e97e861860866. It didn't solve the basic problem. There's now a better solution in master that we want to cherry-pick here. diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index cb534c8..6326b98 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -162,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. @@ -782,7 +779,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 ) @@ -803,9 +799,6 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // 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(); // reset paper size back to last configured size, not // whatever happens to be the current page @@ -822,7 +815,7 @@ bool PrinterController::setupPrinter( Window* i_pParent ) // configured to use the driver papersize if (aNewPaperSize != mpImplData->maDefaultPageSize) { - mpImplData->maFixedPageSize = aNewPaperSize; + mpImplData->maDefaultPageSize = aNewPaperSize; bInvalidateCache = getPapersizeFromSetup(); } @@ -838,11 +831,6 @@ bool PrinterController::setupPrinter( Window* i_pParent ) { mpImplData->maPageCache.invalidate(); } - - if( aNewPaperSize != aPaperSize || nNewPaperBin != nPaperBin ) - { - mpImplData->maPageCache.invalidate(); - } } else { @@ -927,14 +915,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(); } commit 17b50306f2dc637ec704996e205bf3029ebe70c1 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Thu Aug 13 13:38:29 2015 +0200 tdf#92256: Don't force CalcA1 syntax on all !Microsoft xlsx docs in other words, don't override user's configuration of string ref syntax Change-Id: I58e6d1fbc67ce11299dd0a61d8057d39652a1bb6 diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 91be590..d8f9cb0 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -514,18 +514,6 @@ Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, b // private -------------------------------------------------------------------- -namespace { - -formula::FormulaGrammar::AddressConvention getConvention(css::uno::Reference<XDocumentProperties> xDocProps) -{ - if (xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft")) - return formula::FormulaGrammar::CONV_XL_A1; - - return formula::FormulaGrammar::CONV_OOO; -} - -} - void WorkbookGlobals::initialize( bool bWorkbookFile ) { maCellStyles = "CellStyles"; @@ -544,9 +532,13 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY); Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties(); - ScCalcConfig aCalcConfig = rDoc.GetCalcConfig(); - aCalcConfig.SetStringRefSyntax( getConvention(xDocProps) ); - rDoc.SetCalcConfig(aCalcConfig); + + if (xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft")) + { + ScCalcConfig aCalcConfig = rDoc.GetCalcConfig(); + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_A1 ) ; + rDoc.SetCalcConfig(aCalcConfig); + } mxFormulaBuffer.reset( new FormulaBuffer( *this ) ); mxWorkbookSettings.reset( new WorkbookSettings( *this ) ); commit d63d83f95c36d4db3817ea78bf5d0cd3e687de58 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Thu Aug 13 13:33:55 2015 +0200 tdf#92256: Save ref syntax when different from native one that is, CalcA1 for ODF and ExcelA1 for OOXML Change-Id: Ibbfd58aad7513bc9e946be26d4aec685c5896708 diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index aaa6a29..81cd99d 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -824,8 +824,11 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) const ScCalcConfig& rCalcConfig = GetDoc().GetCalcConfig(); - // don't write if it hasn't been read or explicitly changed - if ( rCalcConfig.mbHasStringRefSyntax ) + // write if it has been read|imported or explicitly changed + // or if ref syntax isn't what would be native for our file format + // i.e. ExcelA1 in this case + if ( rCalcConfig.mbHasStringRefSyntax || + (rCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_XL_A1) ) { XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), rCalcConfig.meStringRefAddressSyntax )) ); diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 66bf738..abcbdbc 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -460,9 +460,12 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr { ScCalcConfig aCalcConfig = pDoc->GetCalcConfig(); - // if it hasn't been read or explicitly changed, don't write it - if ( aCalcConfig.mbHasStringRefSyntax ) - { + // write if it has been read|imported or explicitly changed + // or if ref syntax isn't what would be native for our file format + // i.e. CalcA1 in this case + if ( aCalcConfig.mbHasStringRefSyntax || + (aCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_OOO) ) + { formula::FormulaGrammar::AddressConvention aConv = aCalcConfig.meStringRefAddressSyntax; switch (aConv) commit 48940f96532febfd8985bc0811d48942d4b990a7 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Thu Aug 13 13:25:14 2015 +0200 tdf#92256: Make sure ref syntax of Excel docs gets saved SetStringRefSyntax guarantees that, as it sets also ScCalcConfig -> mbHasStringRefSyntax to true Change-Id: Ibe7ec017dcaedbd5f7d6e02e2774be5046439c36 diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index c999241..91be590 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -545,7 +545,7 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY); Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties(); ScCalcConfig aCalcConfig = rDoc.GetCalcConfig(); - aCalcConfig.meStringRefAddressSyntax = getConvention(xDocProps); + aCalcConfig.SetStringRefSyntax( getConvention(xDocProps) ); rDoc.SetCalcConfig(aCalcConfig); mxFormulaBuffer.reset( new FormulaBuffer( *this ) ); commit eedb1608870a74af2570a061b88ae0b2d602c5df Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue May 19 02:24:30 2015 +0200 use XL_A1 as ref string syntax for excel produced documents Conflicts: sc/inc/document.hxx sc/source/filter/oox/workbookhelper.cxx Change-Id: Ieed3521674ef713d9c09313cd41d1edd6ba3dcc5 diff --git a/sc/source/filter/oox/workbookhelper.cxx b/sc/source/filter/oox/workbookhelper.cxx index 691887a..c999241 100644 --- a/sc/source/filter/oox/workbookhelper.cxx +++ b/sc/source/filter/oox/workbookhelper.cxx @@ -34,6 +34,8 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <osl/thread.h> #include "oox/drawingml/theme.hxx" #include "oox/helper/progressbar.hxx" @@ -512,6 +514,18 @@ Reference< XStyle > WorkbookGlobals::createStyleObject( OUString& orStyleName, b // private -------------------------------------------------------------------- +namespace { + +formula::FormulaGrammar::AddressConvention getConvention(css::uno::Reference<XDocumentProperties> xDocProps) +{ + if (xDocProps->getGenerator().startsWithIgnoreAsciiCase("Microsoft")) + return formula::FormulaGrammar::CONV_XL_A1; + + return formula::FormulaGrammar::CONV_OOO; +} + +} + void WorkbookGlobals::initialize( bool bWorkbookFile ) { maCellStyles = "CellStyles"; @@ -526,6 +540,13 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) // the spreadsheet document mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY ); OSL_ENSURE( mxDoc.is(), "WorkbookGlobals::initialize - no spreadsheet document" ); + ScDocument& rDoc = getScDocument(); + + Reference< XDocumentPropertiesSupplier > xPropSupplier( mxDoc, UNO_QUERY); + Reference< XDocumentProperties > xDocProps = xPropSupplier->getDocumentProperties(); + ScCalcConfig aCalcConfig = rDoc.GetCalcConfig(); + aCalcConfig.meStringRefAddressSyntax = getConvention(xDocProps); + rDoc.SetCalcConfig(aCalcConfig); mxFormulaBuffer.reset( new FormulaBuffer( *this ) ); mxWorkbookSettings.reset( new WorkbookSettings( *this ) ); @@ -548,7 +569,6 @@ void WorkbookGlobals::initialize( bool bWorkbookFile ) mxPageSettConverter.reset( new PageSettingsConverter( *this ) ); // initialise edit engine - ScDocument& rDoc = getScDocument(); mxEditEngine.reset( new ScEditEngineDefaulter( rDoc.GetEnginePool() ) ); mxEditEngine->SetRefMapMode( MAP_100TH_MM ); mxEditEngine->SetEditTextObjectPool( rDoc.GetEditPool() ); commit ecaa5447d6f52fa231883bed33582148464615df Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Feb 23 02:19:32 2015 +0100 import the document properties before the document That allows us to potentially change the import depending on the producer of the document. This becomes necessary to handle MSO 2007 chart drawingml streams correctly. Conflicts: sc/source/filter/oox/excelfilter.cxx Change-Id: I9be8b019fae69cd206203591982a89648965692f diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx index b54d09c..9936eb0 100644 --- a/sc/source/filter/oox/excelfilter.cxx +++ b/sc/source/filter/oox/excelfilter.cxx @@ -113,11 +113,7 @@ bool ExcelFilter::importDocument() throw() if( aWorkbookPath.isEmpty() ) return false; - /* Construct the WorkbookGlobals object referred to by every instance of - the class WorkbookHelper, and execute the import filter by constructing - an instance of WorkbookFragment and loading the file. */ - WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals( *this ); - if ( xBookGlob.get() && importFragment( new WorkbookFragment( *xBookGlob, aWorkbookPath ) ) ) + try { try { @@ -127,8 +123,23 @@ bool ExcelFilter::importDocument() throw() { SAL_WARN("sc", "exception when importing document properties " << e.Message); } - return true; + catch( ... ) + { + SAL_WARN("sc", "exception when importing document properties"); + } + /* Construct the WorkbookGlobals object referred to by every instance of + the class WorkbookHelper, and execute the import filter by constructing + an instance of WorkbookFragment and loading the file. */ + WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals(*this); + if (xBookGlob.get() && importFragment(new WorkbookFragment(*xBookGlob, aWorkbookPath))) + { + return true; + } + } + catch (...) + { } + return false; } commit 020e1590d4837ca1044ecc37318300754bb8ebef Merge: f7b619b 55bbc58 Author: Jan-Marek Glogowski <glo...@fbihome.de> Date: Tue Aug 4 14:48:21 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+backports' into private/jmux/libreoffice-4-1-6+all commit 55bbc5883a05e51bbedc5740d0bf58d064e5423a Author: Henry Castro <hcas...@collabora.com> Date: Fri Apr 24 16:55:01 2015 -0400 Resolves tdf#67712 form controls and draw objects anchored to cell but changes position after reopening Also included tdf#68797 "FILEOPEN lost position of lines anchored to cell". It was marked as duplicate but the step to reproduce are different. Conflicts: sc/qa/unit/subsequent_filters-test.cxx Conflicts: sc/qa/unit/subsequent_export-test.cxx Reviewed-on: https://gerrit.libreoffice.org/15523 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit 487880b6882ec01c1b4679eae60bec484272a86b) Conflicts: sc/qa/unit/subsequent_export-test.cxx (cherry picked from commit b1f1c77687e301c99e81631d33298e44bdb5ca84) Conflicts: svx/source/svdraw/svdoashp.cxx Change-Id: Ia1c4010f118749256077a0ecad6ca16b867d22f7 diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index fccbbda..82909c7 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/datatransfer/XTransferable.hpp> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "scitems.hxx" #include <editeng/eeitem.hxx> @@ -119,6 +120,14 @@ void ScUndoObjData::Undo() pData->maStart = aOldStt; pData->maEnd = aOldEnd; } + + // Undo also an untransformed anchor + pData = ScDrawLayer::GetNonRotatedObjData( pObj ); + if (pData) + { + pData->maStart = aOldStt; + pData->maEnd = aOldEnd; + } } void ScUndoObjData::Redo() @@ -130,6 +139,14 @@ void ScUndoObjData::Redo() pData->maStart = aNewStt; pData->maEnd = aNewEnd; } + + // Redo also an untransformed anchor + pData = ScDrawLayer::GetNonRotatedObjData( pObj ); + if (pData) + { + pData->maStart = aNewStt; + pData->maEnd = aNewEnd; + } } // ----------------------------------------------------------------------- @@ -505,6 +522,15 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC { if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() ) pData->maStart.PutInOrder( pData->maEnd ); + + // Update also an untransformed anchor thats what we stored ( and still do ) to xml + ScDrawObjData* pNoRotatedAnchor = GetNonRotatedObjData( pObj, false ); + if ( pNoRotatedAnchor ) + { + pNoRotatedAnchor->maStart = pData->maStart; + pNoRotatedAnchor->maEnd = pData->maEnd; + } + AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) ); RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos ); } @@ -769,6 +795,39 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati ScDrawObjData& rNoRotatedAnchor = *GetNonRotatedObjData( pObj, true ); if (rData.maLastRect.IsEmpty()) { + // Every shape it is saved with an negative offset relative to cell + if (ScDrawLayer::GetAnchorType(*pObj) == SCA_CELL) + { + double fRotate(0.0); + double fShearX(0.0); + + Point aPoint; + Rectangle aRect; + + basegfx::B2DTuple aScale; + basegfx::B2DTuple aTranslate; + basegfx::B2DPolyPolygon aPolyPolygon; + basegfx::B2DHomMatrix aOriginalMatrix; + + aRect = pDoc->GetMMRect(nCol1, nRow1, nCol1 , nRow1, nTab1); + + if (bNegativePage) + aPoint.X() = aRect.Right(); + else + aPoint.X() = aRect.Left(); + aPoint.Y() = aRect.Top(); + + pObj->TRGetBaseGeometry(aOriginalMatrix, aPolyPolygon); + aOriginalMatrix.decompose(aScale, aTranslate, fRotate, fShearX); + aTranslate += ::basegfx::B2DTuple(aPoint.X(), aPoint.Y()); + aOriginalMatrix = basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aScale, + fShearX, + fRotate, + aTranslate); + pObj->TRSetBaseGeometry(aOriginalMatrix, aPolyPolygon); + } + // It's confusing ( but blame that we persist the anchor in terms of unrotated shape ) // that the initial anchor we get here is in terms of an unrotated shape ( if the shape is rotated ) // we need to save the old anchor ( for persisting ) and also track any resize or repositions that happen. diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index babab98..91466ba 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -2985,6 +2985,7 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, } // reset object shear and rotations + fObjectRotation = 0.0; aGeo.nDrehWink = 0; aGeo.RecalcSinCos(); aGeo.nShearWink = 0; commit 0fa5a941f9e872e5230d4bff609ead0706c51479 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon Jul 27 15:12:26 2015 +0200 tdf#92256: Improved interop of INDIRECT function, OOXML part Change-Id: I46bb65fb620c376d43d8a53396c7b0bab1c00c7a diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index fe222d9..65fc78b 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -138,7 +138,8 @@ namespace "http://schemas.openxmlformats.org/markup-compatibility/2006", "http://schemas.openxmlformats.org/spreadsheetml/2006/main/v2", "http://schemas.microsoft.com/office/drawing/2008/diagram", - "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" + "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main", + "http://schemas.libreoffice.org/" }; static const sal_Int32 namespaceIds[] = { @@ -162,7 +163,8 @@ namespace NMSP_mce, NMSP_mceTest, NMSP_dsp, - NMSP_xlsExtLst + NMSP_xlsExtLst, + NMSP_loext }; Sequence< beans::Pair< OUString, sal_Int32 > > aRet(STATIC_ARRAY_SIZE(namespaceIds)); diff --git a/oox/source/token/namespaces.hxx.tail b/oox/source/token/namespaces.hxx.tail index b684ea5..4f674b5 100644 --- a/oox/source/token/namespaces.hxx.tail +++ b/oox/source/token/namespaces.hxx.tail @@ -52,6 +52,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return nToken & NMSP_MASK; } #define VMLPPT_TOKEN( token ) OOX_TOKEN( vmlPowerpoint, token ) #define DSP_TOKEN( token ) OOX_TOKEN( dsp, token ) #define LC_TOKEN( token ) OOX_TOKEN( dmlLockedCanvas, token ) +#define LOEXT_TOKEN( token ) OOX_TOKEN( loext, token ) // ============================================================================ diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt index 78ba6ba..0fdc572 100644 --- a/oox/source/token/namespaces.txt +++ b/oox/source/token/namespaces.txt @@ -77,3 +77,5 @@ mceTest http://schemas.openxmlformats.org/spreadsheetml/2006/mai # xlsExtLst for features introduced by excel 2010 xlsExtLst http://schemas.microsoft.com/office/spreadsheetml/2009/9/main +# LibreOffice's own extensions +loext http://schemas.libreoffice.org/ diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt index 94644b4..d41df36 100644 --- a/oox/source/token/tokens.txt +++ b/oox/source/token/tokens.txt @@ -69,6 +69,8 @@ BroadcastTitle Broadcaster Button CF +CalcA1 +CalcA1ExcelA1 Camera Cancel Caption @@ -141,6 +143,8 @@ Editor ElectronicSource Embed EnhancedMetaFile +ExcelA1 +ExcelR1C1 Extend Extension External @@ -391,6 +395,7 @@ True Type Types UIObj +Unspecified URI URL UpdateMode @@ -2094,6 +2099,7 @@ exp explosion expression ext +extCalcPr extLst extend extendable @@ -3109,6 +3115,7 @@ lockWindows locked lockedCanvas lockrotationcenter +loext log logBase lon @@ -4881,6 +4888,7 @@ strikeH strikeTLBR strikeV string +stringRefSyntax stringValue1 stringValue2 stripedRightArrow diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 7c64d47..aaa6a29 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -822,6 +822,17 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm ) if( pExpChangeTrack ) pExpChangeTrack->WriteXml( rStrm ); + const ScCalcConfig& rCalcConfig = GetDoc().GetCalcConfig(); + + // don't write if it hasn't been read or explicitly changed + if ( rCalcConfig.mbHasStringRefSyntax ) + { + XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) ); + xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), rCalcConfig.meStringRefAddressSyntax )) ); + xExtLst->SaveXml(rStrm); + } + + rWorkbook->endElement( XML_workbook ); rWorkbook.reset(); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index 58594fe..94fc2da 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -203,6 +203,51 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElementNS( XML_x14, XML_conditionalFormatting ); } +XclExpExtCalcPr::XclExpExtCalcPr( const XclExpRoot& rRoot, formula::FormulaGrammar::AddressConvention eConv ): + XclExpExt( rRoot ), + meConv( eConv ) +{ + maURI = OString("{7626C862-2A13-11E5-B345-FEFF819CDC9F}"); + + switch (meConv) + { + case formula::FormulaGrammar::CONV_OOO: + maSyntax = OString("CalcA1"); + break; + case formula::FormulaGrammar::CONV_XL_A1: + maSyntax = OString("ExcelA1"); + break; + case formula::FormulaGrammar::CONV_XL_R1C1: + maSyntax = OString("ExcelR1C1"); + break; + case formula::FormulaGrammar::CONV_A1_XL_A1: + maSyntax = OString("CalcA1ExcelA1"); + break; + case formula::FormulaGrammar::CONV_UNSPECIFIED: + case formula::FormulaGrammar::CONV_ODF: + case formula::FormulaGrammar::CONV_XL_OOX: + case formula::FormulaGrammar::CONV_LOTUS_A1: + case formula::FormulaGrammar::CONV_LAST: + maSyntax = OString("Unspecified"); + break; + } +} + +void XclExpExtCalcPr::SaveXml( XclExpXmlStream& rStrm ) +{ + sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); + rWorksheet->startElement( XML_ext, + FSNS( XML_xmlns, XML_loext ), "http://schemas.libreoffice.org/", + XML_uri, maURI.getStr(), + FSEND ); + + rWorksheet->singleElementNS( XML_loext, XML_extCalcPr, + XML_stringRefSyntax, maSyntax.getStr(), + FSEND ); + + rWorksheet->endElement( XML_ext ); +} + XclExpExtCondFormat::XclExpExtCondFormat( const XclExpRoot& rRoot ): XclExpExt( rRoot ) { diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx index c982f10..322ae0a 100644 --- a/sc/source/filter/inc/extlstcontext.hxx +++ b/sc/source/filter/inc/extlstcontext.hxx @@ -9,6 +9,7 @@ #include "excelhandlers.hxx" #include "worksheetfragment.hxx" +#include "workbookfragment.hxx" namespace oox { namespace xls { @@ -77,6 +78,27 @@ protected: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); }; +class ExtGlobalWorkbookContext : public WorkbookContextBase +{ +public: + explicit ExtGlobalWorkbookContext( WorkbookContextBase& rFragment ); + +protected: + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; + virtual void onStartElement( const AttributeList& rAttribs ) SAL_OVERRIDE; + +private: +}; + +class ExtLstGlobalWorkbookContext : public WorkbookContextBase +{ +public: + explicit ExtLstGlobalWorkbookContext( WorkbookFragment& rFragment ); + +protected: + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; +}; + } //namespace xls } //namespace oox diff --git a/sc/source/filter/inc/xeextlst.hxx b/sc/source/filter/inc/xeextlst.hxx index c32e23e..6a49431 100644 --- a/sc/source/filter/inc/xeextlst.hxx +++ b/sc/source/filter/inc/xeextlst.hxx @@ -14,12 +14,14 @@ #include "xeroot.hxx" #include "colorscale.hxx" +#include "formulaopt.hxx" #include <boost/scoped_ptr.hpp> enum XclExpExtType { - XclExpExtDataBarType + XclExpExtDataBarType, + XclExpExtDataFooType }; /** @@ -128,6 +130,19 @@ private: XclExpRecordList< XclExpExtConditionalFormatting > maCF; }; +class XclExpExtCalcPr : public XclExpExt +{ +public: + XclExpExtCalcPr( const XclExpRoot& rRoot, formula::FormulaGrammar::AddressConvention eConv ); + virtual void SaveXml( XclExpXmlStream& rStrm ); + + virtual XclExpExtType GetType() SAL_OVERRIDE { return XclExpExtDataFooType; } + +private: + formula::FormulaGrammar::AddressConvention meConv; + OString maSyntax; +}; + class XclExtLst : public XclExpRecordBase, public XclExpRoot { public: diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 52a9e36..f26ec87 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -12,6 +12,8 @@ #include <oox/core/contexthandler.hxx> #include "colorscale.hxx" #include "condformatbuffer.hxx" +#include "calcconfig.hxx" +#include "document.hxx" using ::oox::core::ContextHandlerRef; @@ -156,6 +158,60 @@ ContextHandlerRef ExtLstGlobalContext::onCreateContext( sal_Int32 nElement, cons return this; } +ExtGlobalWorkbookContext::ExtGlobalWorkbookContext( WorkbookContextBase& rFragment ): + WorkbookContextBase(rFragment) +{ +} + +ContextHandlerRef ExtGlobalWorkbookContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) +{ + if (nElement == LOEXT_TOKEN(extCalcPr)) + { + ScDocument* pDoc = &getScDocument(); + sal_Int32 nToken = rAttribs.getToken( XML_stringRefSyntax, XML_CalcA1 ); + ScCalcConfig aCalcConfig = pDoc->GetCalcConfig(); + + switch( nToken ) + { + case XML_CalcA1: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_OOO ); + break; + case XML_ExcelA1: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_A1 ); + break; + case XML_ExcelR1C1: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_R1C1 ); + break; + case XML_CalcA1ExcelA1: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_A1_XL_A1 ); + break; + default: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_UNSPECIFIED); + break; + } + pDoc->SetCalcConfig(aCalcConfig); + } + + return this; +} + +void ExtGlobalWorkbookContext::onStartElement( const AttributeList& /*rAttribs*/ ) +{ +} + +ExtLstGlobalWorkbookContext::ExtLstGlobalWorkbookContext( WorkbookFragment& rFragment ): + WorkbookContextBase(rFragment) +{ +} + +ContextHandlerRef ExtLstGlobalWorkbookContext::onCreateContext( sal_Int32 nElement, const AttributeList& ) +{ + if (nElement == XLS_TOKEN( ext )) + return new ExtGlobalWorkbookContext( *this ); + + return this; +} + } //namespace oox } //namespace xls diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 5fad0fd..af6ad1d 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -33,6 +33,7 @@ #include "connectionsfragment.hxx" #include "externallinkbuffer.hxx" #include "externallinkfragment.hxx" +#include "extlstcontext.hxx" #include "pivotcachebuffer.hxx" #include "sharedstringsbuffer.hxx" #include "sharedstringsfragment.hxx" @@ -101,6 +102,8 @@ ContextHandlerRef WorkbookFragment::onCreateContext( sal_Int32 nElement, const A case XLS_TOKEN( workbookPr ): getWorkbookSettings().importWorkbookPr( rAttribs ); break; case XLS_TOKEN( calcPr ): getWorkbookSettings().importCalcPr( rAttribs ); break; case XLS_TOKEN( oleSize ): getViewSettings().importOleSize( rAttribs ); break; + + case XLS_TOKEN( extLst ): return new ExtLstGlobalWorkbookContext( *this ); } break; commit b469180dc07d4b0bbd3c303fc2160cb0e2dd4171 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Mon Jul 27 13:36:34 2015 +0200 tdf#92256: Improved interop of INDIRECT function backport of core/interpreter changes and ODF export/import Change-Id: Ibac7aed67edaf524e5c594d12aa0abefe465baea diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx index 75556d5..eaa77c2 100644 --- a/include/formula/grammar.hxx +++ b/include/formula/grammar.hxx @@ -44,7 +44,11 @@ public: CONV_LOTUS_A1, /* external? 3d? A1.B2 <placeholder/> */ - CONV_LAST /* for loops, must always be last */ + CONV_LAST, /* for loops, must always be last */ + + // not a real address convention, a special case for INDIRECT function interpretation + // only -> try using CONV_OOO, failing that CONV_XL_A1 + CONV_A1_XL_A1 }; //! CONV_UNSPECIFIED is a negative value! diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index 8bcfda0..eac500e 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -28,11 +28,13 @@ struct SC_DLLPUBLIC ScCalcConfig { formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax; bool mbEmptyStringAsZero:1; + bool mbHasStringRefSyntax:1; ScCalcConfig(); void reset(); void MergeDocumentSpecific( const ScCalcConfig& r ); + void SetStringRefSyntax( formula::FormulaGrammar::AddressConvention eConv ); bool operator== (const ScCalcConfig& r) const; bool operator!= (const ScCalcConfig& r) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 79ef79c..eac06f7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1974,9 +1974,8 @@ public: */ bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const; - - void SetCalcConfig( const ScCalcConfig& rConfig ); - const ScCalcConfig& GetCalcConfig() const; + SC_DLLPUBLIC void SetCalcConfig( const ScCalcConfig& rConfig ); + SC_DLLPUBLIC const ScCalcConfig& GetCalcConfig() const; private: // CLOOK-Impl-methods diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index b688cdd3..b1a12be 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -937,9 +937,10 @@ #define SCSTR_FORMULA_SYNTAX_CALC_A1 (STR_START + 409) #define SCSTR_FORMULA_SYNTAX_XL_A1 (STR_START + 410) #define SCSTR_FORMULA_SYNTAX_XL_R1C1 (STR_START + 411) +#define SCSTR_FORMULA_SYNTAX_A1_XL_A1 (STR_START + 412) -#define SCSTR_FIELDSEP_TAB (STR_START + 412) -#define SCSTR_FIELDSEP_SPACE (STR_START + 413) +#define SCSTR_FIELDSEP_TAB (STR_START + 413) +#define SCSTR_FIELDSEP_SPACE (STR_START + 414) #define STR_END (SCSTR_FIELDSEP_SPACE) diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 1a34e6d..5179f95 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -507,6 +507,7 @@ #define SC_UNO_ISCHANGEREADONLYENABLED "IsChangeReadOnlyEnabled" #define SC_UNO_REFERENCEDEVICE "ReferenceDevice" #define SC_UNO_CODENAME "CodeName" +#define SC_UNO_SYNTAXSTRINGREF "SyntaxStringRef" // document properties from FormModel #define SC_UNO_APPLYFMDES "ApplyFormDesignMode" diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ef7f102..d665b2c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1469,9 +1469,10 @@ void testFuncINDIRECT(ScDocument* pDoc) pDoc->CalcAll(); { - // Default is to use the current formula syntax, which is Calc A1. + // Default is to use compatibility mode, accept both Calc A1 and + // Excel A1 syntax const OUString* aChecks[] = { - &aTest, &aRefErr, &aRefErr, &aTest + &aTest, &aTest, &aRefErr, &aTest }; for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) @@ -1482,8 +1483,8 @@ void testFuncINDIRECT(ScDocument* pDoc) } ScCalcConfig aConfig; - aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_OOO; - pDoc->SetCalcConfig(aConfig) + aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_OOO ); + pDoc->SetCalcConfig(aConfig); pDoc->CalcAll(); { // Explicit Calc A1 syntax @@ -1498,8 +1499,8 @@ void testFuncINDIRECT(ScDocument* pDoc) } } - aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_A1; - pDoc->SetCalcConfig(aConfig) + aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_A1 ); + pDoc->SetCalcConfig(aConfig); pDoc->CalcAll(); { // Excel A1 syntax @@ -1514,8 +1515,8 @@ void testFuncINDIRECT(ScDocument* pDoc) } } - aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_R1C1; - pDoc->SetCalcConfig(aConfig) + aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_R1C1 ); + pDoc->SetCalcConfig(aConfig); pDoc->CalcAll(); { // Excel R1C1 syntax diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 0177c78..8104aa1 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -708,4 +708,14 @@ void ScDocument::RebuildFormulaGroups() maTabs[nTab]->RebuildFormulaGroups(); } +void ScDocument::SetCalcConfig( const ScCalcConfig& rConfig ) +{ + maCalcConfig = rConfig; +} + +const ScCalcConfig& ScDocument::GetCalcConfig() const +{ + return maCalcConfig; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index 0a238ef..a668cfd 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -11,7 +11,8 @@ ScCalcConfig::ScCalcConfig() : meStringRefAddressSyntax(formula::FormulaGrammar::CONV_UNSPECIFIED), - mbEmptyStringAsZero(false) {} + mbEmptyStringAsZero(false), + mbHasStringRefSyntax(false) {} void ScCalcConfig::reset() { @@ -20,17 +21,23 @@ void ScCalcConfig::reset() void ScCalcConfig::MergeDocumentSpecific( const ScCalcConfig& r ) { - // String conversion options are per document. - meStringConversion = r.meStringConversion; mbEmptyStringAsZero = r.mbEmptyStringAsZero; // INDIRECT ref syntax is per document. meStringRefAddressSyntax = r.meStringRefAddressSyntax; + mbHasStringRefSyntax = r.mbHasStringRefSyntax; +} + +void ScCalcConfig::SetStringRefSyntax( formula::FormulaGrammar::AddressConvention eConv ) +{ + meStringRefAddressSyntax = eConv; + mbHasStringRefSyntax = true; } bool ScCalcConfig::operator== (const ScCalcConfig& r) const { return meStringRefAddressSyntax == r.meStringRefAddressSyntax && - mbEmptyStringAsZero == r.mbEmptyStringAsZero; + mbEmptyStringAsZero == r.mbEmptyStringAsZero && + mbHasStringRefSyntax == r.mbHasStringRefSyntax; } bool ScCalcConfig::operator!= (const ScCalcConfig& r) const diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index a54d7fe..9c0a8c7 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7835,17 +7835,27 @@ void ScInterpreter::ScIndirect() // Use the current address syntax if unspecified. eConv = pDok->GetAddressConvention(); + // either CONV_A1_XL_A1 was explicitly configured, or nothing at all + // was configured + bool bTryXlA1 = (eConv == FormulaGrammar::CONV_A1_XL_A1 || + !maCalcConfig.mbHasStringRefSyntax); + if (nParamCount == 2 && 0.0 == ::rtl::math::approxFloor( GetDouble())) { // Overwrite the config and try Excel R1C1. eConv = FormulaGrammar::CONV_XL_R1C1; + bTryXlA1 = false; } - const ScAddress::Details aDetails( eConv, aPos ); + + const ScAddress::Details aDetails( bTryXlA1 ? FormulaGrammar::CONV_OOO : eConv, aPos ); + const ScAddress::Details aDetailsXlA1( FormulaGrammar::CONV_XL_A1, aPos ); SCTAB nTab = aPos.Tab(); String sRefStr( GetString() ); ScRefAddress aRefAd, aRefAd2; ScAddress::ExternalInfo aExtInfo; - if (ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo)) + if ( ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || + ( bTryXlA1 && ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, + aRefAd2, aDetailsXlA1, &aExtInfo) ) ) { if (aExtInfo.mbExternal) { @@ -7858,7 +7868,9 @@ void ScInterpreter::ScIndirect() PushDoubleRef( aRefAd.Col(), aRefAd.Row(), aRefAd.Tab(), aRefAd2.Col(), aRefAd2.Row(), aRefAd2.Tab() ); } - else if (ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo)) + else if ( ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) || + ( bTryXlA1 && ConvertSingleRef (pDok, sRefStr, nTab, aRefAd, + aDetailsXlA1, &aExtInfo) ) ) { if (aExtInfo.mbExternal) { diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 427e6af..ed19310 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -54,6 +54,8 @@ formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos) return formula::FormulaGrammar::CONV_XL_A1; case 3: return formula::FormulaGrammar::CONV_XL_R1C1; + case 4: + return formula::FormulaGrammar::CONV_A1_XL_A1; case 0: default: ; @@ -80,6 +82,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(Window* pParent, const ScCalcConfig& rC maCalcA1(ScResId(SCSTR_FORMULA_SYNTAX_CALC_A1).toString()), maExcelA1(ScResId(SCSTR_FORMULA_SYNTAX_XL_A1).toString()), maExcelR1C1(ScResId(SCSTR_FORMULA_SYNTAX_XL_R1C1).toString()), + maCalcA1ExcelR1C1(ScResId(SCSTR_FORMULA_SYNTAX_A1_XL_A1).toString()), maCaptionStringRefSyntax(ScResId(STR_STRING_REF_SYNTAX_CAPTION).toString()), maDescStringRefSyntax(ScResId(STR_STRING_REF_SYNTAX_DESC).toString()), maUseFormulaSyntax(ScResId(STR_USE_FORMULA_SYNTAX).toString()), @@ -161,6 +164,7 @@ void ScCalcOptionsDialog::SelectionChanged() maLbOptionEdit.InsertEntry(maCalcA1); maLbOptionEdit.InsertEntry(maExcelA1); maLbOptionEdit.InsertEntry(maExcelR1C1); + maLbOptionEdit.InsertEntry(maCalcA1ExcelR1C1); switch (maConfig.meStringRefAddressSyntax) { case formula::FormulaGrammar::CONV_OOO: @@ -172,6 +176,9 @@ void ScCalcOptionsDialog::SelectionChanged() case formula::FormulaGrammar::CONV_XL_R1C1: maLbOptionEdit.SelectEntryPos(3); break; + case formula::FormulaGrammar::CONV_A1_XL_A1: + maLbOptionEdit.SelectEntryPos(4); + break; case formula::FormulaGrammar::CONV_UNSPECIFIED: default: maLbOptionEdit.SelectEntryPos(0); @@ -213,7 +220,7 @@ void ScCalcOptionsDialog::ListOptionValueChanged() { // Formula syntax for INDIRECT function. sal_uInt16 nPos = maLbOptionEdit.GetSelectEntryPos(); - maConfig.meStringRefAddressSyntax = toAddressConvention(nPos); + maConfig.SetStringRefSyntax(toAddressConvention(nPos)); maLbSettings.SetUpdateMode(false); @@ -272,6 +279,8 @@ OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConventio return maExcelA1; case formula::FormulaGrammar::CONV_XL_R1C1: return maExcelR1C1; + case formula::FormulaGrammar::CONV_A1_XL_A1: + return maCalcA1ExcelR1C1; case formula::FormulaGrammar::CONV_UNSPECIFIED: default: ; diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx index 38a9958..2eef667 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.hxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx @@ -57,6 +57,7 @@ private: OUString maCalcA1; OUString maExcelA1; OUString maExcelR1C1; + OUString maCalcA1ExcelR1C1; OUString maCaptionStringRefSyntax; OUString maDescStringRefSyntax; diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index c15288d..c27497e 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -839,6 +839,11 @@ String SCSTR_FORMULA_SYNTAX_XL_R1C1 Text [ en-US ] = "Excel R1C1"; }; +String SCSTR_FORMULA_SYNTAX_A1_XL_A1 +{ + Text [ en-US ] = "Calc A1 | Excel A1"; +}; + String SCSTR_COL_LABEL { Text [ en-US ] = "Range contains column la~bels" ; diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index a6aa332..66bf738 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -28,8 +28,10 @@ #include "viewopti.hxx" #include "docpool.hxx" #include "sc.hrc" +#include "document.hxx" #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <formula/grammar.hxx> #include <sfx2/printer.hxx> #include <xmloff/xmluconv.hxx> #include <rtl/ustrbuf.hxx> @@ -77,6 +79,7 @@ static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap() {MAP_CHAR_LEN(SC_UNO_SHAREDOC), 0, &getBooleanCppuType(), 0, 0}, {MAP_CHAR_LEN(SC_UNO_MODIFYPASSWORDINFO), 0, &getCppuType((uno::Sequence< beans::PropertyValue >*)0), 0, 0}, {MAP_CHAR_LEN(SC_UNO_EMBED_FONTS), 0, &getBooleanCppuType(), 0, 0}, + {MAP_CHAR_LEN(SC_UNO_SYNTAXSTRINGREF), 0, &getCppuType((sal_Int16*)0), 0, 0}, {0,0,0,0,0,0} }; return aConfigPropertyMap_Impl; @@ -289,6 +292,29 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( pDoc->SetIsUsingEmbededFonts(bVal); } } + else if ( aPropertyName.compareToAscii( SC_UNO_SYNTAXSTRINGREF ) == 0 ) + { + ScCalcConfig aCalcConfig = pDoc->GetCalcConfig(); + sal_Int16 nUno = 0; + + if( aValue >>= nUno ) + { + switch (nUno) + { + case 0: // CONV_OOO + case 2: // CONV_XL_A1 + case 3: // CONV_XL_R1C1 + case 7: // CONV_A1_XL_A1 + aCalcConfig.SetStringRefSyntax( static_cast<formula::FormulaGrammar::AddressConvention>( nUno ) ); + break; + default: + aCalcConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_UNSPECIFIED ); + break; + + } + pDoc->SetCalcConfig( aCalcConfig ); + } + } else { @@ -430,6 +456,34 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr { aRet <<= pDoc->IsUsingEmbededFonts(); } + else if ( aPropertyName.compareToAscii( SC_UNO_SYNTAXSTRINGREF ) == 0 ) + { + ScCalcConfig aCalcConfig = pDoc->GetCalcConfig(); + + // if it hasn't been read or explicitly changed, don't write it + if ( aCalcConfig.mbHasStringRefSyntax ) + { + formula::FormulaGrammar::AddressConvention aConv = aCalcConfig.meStringRefAddressSyntax; + + switch (aConv) + { + case formula::FormulaGrammar::CONV_OOO: + case formula::FormulaGrammar::CONV_XL_A1: + case formula::FormulaGrammar::CONV_XL_R1C1: + case formula::FormulaGrammar::CONV_A1_XL_A1: + aRet <<= static_cast<sal_Int16>( aConv ); + break; + + case formula::FormulaGrammar::CONV_UNSPECIFIED: + case formula::FormulaGrammar::CONV_ODF: + case formula::FormulaGrammar::CONV_XL_OOX: + case formula::FormulaGrammar::CONV_LOTUS_A1: + case formula::FormulaGrammar::CONV_LAST: + aRet <<= sal_Int16(9999); + break; + } + } + } else { commit 5f366715a0cb8b23d025515db44733702ef19486 Author: Eike Rathke <er...@redhat.com> Date: Fri Mar 14 23:00:25 2014 +0100 some formula interpreter options are document specific Ideally they'd even be stored as document options. Future work? Conflicts: sc/inc/document.hxx sc/qa/unit/ucalc.cxx sc/qa/unit/ucalc_formula.cxx sc/source/core/data/documen2.cxx sc/source/core/data/document10.cxx sc/source/core/tool/interpr4.cxx sc/source/core/tool/interpr5.cxx Change-Id: Ida126a441ca88c35406fb66ea3722d6335e6e8e2 diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index 96eabcc..8bcfda0 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -32,6 +32,7 @@ struct SC_DLLPUBLIC ScCalcConfig ScCalcConfig(); void reset(); + void MergeDocumentSpecific( const ScCalcConfig& r ); bool operator== (const ScCalcConfig& r) const; bool operator!= (const ScCalcConfig& r) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index d6ba9f9..79ef79c 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include "typedstrdata.hxx" #include "compressedarray.hxx" +#include "calcconfig.hxx" #include <tools/fract.hxx> #include <tools/gen.hxx> @@ -236,6 +237,8 @@ private: rtl::Reference<ScPoolHelper> xPoolHelper; + ScCalcConfig maCalcConfig; + SfxUndoManager* mpUndoManager; ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper @@ -1971,6 +1974,10 @@ public: */ bool HasBroadcaster( SCTAB nTab, SCCOL nCol ) const; + + void SetCalcConfig( const ScCalcConfig& rConfig ); + const ScCalcConfig& GetCalcConfig() const; + private: // CLOOK-Impl-methods /** diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0bda2a4..ef7f102 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1483,7 +1483,7 @@ void testFuncINDIRECT(ScDocument* pDoc) ScCalcConfig aConfig; aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_OOO; - ScInterpreter::SetGlobalConfig(aConfig); + pDoc->SetCalcConfig(aConfig) pDoc->CalcAll(); { // Explicit Calc A1 syntax @@ -1499,7 +1499,7 @@ void testFuncINDIRECT(ScDocument* pDoc) } aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_A1; - ScInterpreter::SetGlobalConfig(aConfig); + pDoc->SetCalcConfig(aConfig) pDoc->CalcAll(); { // Excel A1 syntax @@ -1515,7 +1515,7 @@ void testFuncINDIRECT(ScDocument* pDoc) } aConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_XL_R1C1; - ScInterpreter::SetGlobalConfig(aConfig); + pDoc->SetCalcConfig(aConfig) pDoc->CalcAll(); { // Excel R1C1 syntax @@ -2176,7 +2176,7 @@ void Test::testFuncParam() // With "Empty string as zero" option. aConfig.mbEmptyStringAsZero = true; - ScInterpreter::SetGlobalConfig(aConfig); + m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); m_pDoc->GetValue(0, 0, 0, val); CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); @@ -2189,7 +2189,7 @@ void Test::testFuncParam() // Without "Empty string as zero" option. aConfig.mbEmptyStringAsZero = false; - ScInterpreter::SetGlobalConfig(aConfig); + m_pDoc->SetCalcConfig(aConfig); m_pDoc->CalcAll(); aVal = m_pDoc->GetString( 0, 0, 0); CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index dcdae98..c73857e 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -87,6 +87,7 @@ #include "cell.hxx" #include "formulacell.hxx" #include "clipcontext.hxx" +#include "interpre.hxx" using namespace com::sun::star; @@ -115,10 +116,10 @@ private: }; // STATIC DATA ----------------------------------------------------------- - ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : xServiceManager( ::comphelper::getProcessServiceFactory() ), + maCalcConfig( ScInterpreter::GetGlobalConfig()), mpUndoManager( NULL ), pEditEngine( NULL ), pNoteEngine( NULL ), diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 582df8b..f1b6e68 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -137,6 +137,7 @@ private: static ScTokenStack* pGlobalStack; static bool bGlobalStackInUse; + ScCalcConfig maCalcConfig; formula::FormulaTokenIterator aCode; ScAddress aPos; ScTokenArray& rArr; @@ -169,6 +170,10 @@ private: VolatileType meVolatileType; + + /// Merge global and document specific settings. + void MergeCalcConfig(); + // nMust <= nAct <= nMax ? ok : PushError inline bool MustHaveParamCount( short nAct, short nMust ); inline bool MustHaveParamCount( short nAct, short nMust, short nMax ); diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx index b194ade..0a238ef 100644 --- a/sc/source/core/tool/calcconfig.cxx +++ b/sc/source/core/tool/calcconfig.cxx @@ -18,6 +18,15 @@ void ScCalcConfig::reset() *this = ScCalcConfig(); } +void ScCalcConfig::MergeDocumentSpecific( const ScCalcConfig& r ) +{ + // String conversion options are per document. + meStringConversion = r.meStringConversion; + mbEmptyStringAsZero = r.mbEmptyStringAsZero; + // INDIRECT ref syntax is per document. + meStringRefAddressSyntax = r.meStringRefAddressSyntax; +} + bool ScCalcConfig::operator== (const ScCalcConfig& r) const { return meStringRefAddressSyntax == r.meStringRefAddressSyntax && diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fd684ee..a54d7fe 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3455,7 +3455,7 @@ void ScInterpreter::ScNumberValue() } if ( aInputString.isEmpty() ) { - if ( GetGlobalConfig().mbEmptyStringAsZero ) + if ( maCalcConfig.mbEmptyStringAsZero ) PushDouble( 0.0 ); else PushNoValue(); @@ -7830,7 +7830,7 @@ void ScInterpreter::ScIndirect() if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { // Reference address syntax for INDIRECT is configurable. - FormulaGrammar::AddressConvention eConv = GetGlobalConfig().meStringRefAddressSyntax; + FormulaGrammar::AddressConvention eConv = maCalcConfig.meStringRefAddressSyntax; if (eConv == FormulaGrammar::CONV_UNSPECIFIED) // Use the current address syntax if unspecified. eConv = pDok->GetAddressConvention(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 7d7e5b9..755014b 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -236,7 +236,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr ) return fValue; } - if (GetGlobalConfig().mbEmptyStringAsZero) + if (maCalcConfig.mbEmptyStringAsZero) { // The number scanner does not accept empty strings or strings // containing only spaces, be on par in these cases with what was @@ -3737,6 +3737,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc, meVolatileType(r.IsRecalcModeAlways() ? VOLATILE : NOT_VOLATILE) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" ); + MergeCalcConfig(); if(pMyFormulaCell) { @@ -3782,6 +3783,13 @@ const ScCalcConfig& ScInterpreter::GetGlobalConfig() return maGlobalConfig; } +void ScInterpreter::MergeCalcConfig() +{ + maCalcConfig = maGlobalConfig; + if (pDok) + maCalcConfig.MergeDocumentSpecific( pDok->GetCalcConfig()); +} + void ScInterpreter::GlobalExit() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GlobalExit" ); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 182eb6e..6af94af 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2110,7 +2110,14 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) pRet->Put( ScTpDefaultsItem( SID_SCDEFAULTSOPTIONS, GetDefaultsOptions() ) ); // TP_FORMULA - pRet->Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, GetFormulaOptions() ) ); + ScFormulaOptions aOptions = GetFormulaOptions(); + if (pDocSh) + { + ScCalcConfig aConfig( aOptions.GetCalcConfig()); + aConfig.MergeDocumentSpecific( pDocSh->GetDocument()->GetCalcConfig()); + aOptions.SetCalcConfig( aConfig); + } + pRet->Put( ScTpFormulaItem( SID_SCFORMULAOPTIONS, aOptions ) ); } return pRet; } diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 283fe42..1a43856 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -492,6 +492,14 @@ void ScDocShell::SetFormulaOptions(const ScFormulaOptions& rOpt ) // Global interpreter settings. ScInterpreter::SetGlobalConfig(rOpt.GetCalcConfig()); + + // Per document interpreter settings. + SetCalcConfig( rOpt.GetCalcConfig()); +} + +void ScDocShell::SetCalcConfig( const ScCalcConfig& rConfig ) +{ + aDocument.SetCalcConfig( rConfig); } void ScDocShell::CheckConfigOptions() diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index d761f7f..96a33d8 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -322,6 +322,7 @@ public: sal_Bool ReloadTabLinks(); void SetFormulaOptions(const ScFormulaOptions& rOpt ); + void SetCalcConfig( const ScCalcConfig& rConfig ); virtual void CheckConfigOptions(); void PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos ); commit f7b619b9157b1dc7c892481e26925662a09f71ff Merge: fe77e6c 1cee96a Author: Juergen Funk <juergen.funk...@cib.de> Date: Tue Jul 14 10:29:40 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+backports' into private/jmux/libreoffice-4-1-6+all commit 1cee96a08f73f31d25d61e432e2c8867c4e61b8a Author: Michael Stahl <mst...@redhat.com> Date: Mon Aug 11 22:24:54 2014 +0200 fdo#81995: fix Outline numbering tab page The "ParentNumbering" property is not a string. (regression from 97eb8a6e0eb830f37dcba64a51d725aab4c5ff53) Change-Id: Ib33e95847b388bb1126a63812e128c96a0c00730 (cherry picked from commit 4d3c9ed257e51af55f358d2b44d5fc2e341c7202) diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 2e50fe8..fad1e2c 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -1606,7 +1606,7 @@ Any OutlineNumbering::getByIndex( sal_Int32 nIndex ) pValues[4].Name = "BulletFontName"; pValues[4].Value <<= OUString::createFromAscii(pTemp->sBulletFontName); pValues[5].Name = "ParentNumbering"; - pValues[5].Value <<= OUString::number(pTemp->nParentNumbering); + pValues[5].Value <<= pTemp->nParentNumbering; pValues[6].Name = "LeftMargin"; pValues[6].Value <<= pTemp->nLeftMargin; pValues[7].Name = "SymbolTextDistance"; commit fe77e6c5b9a6ce7ec1da5e92c3095473349148a5 Merge: d61e16a 04209b2 Author: Juergen Funk <juergen.funk...@cib.de> Date: Fri Jul 3 11:19:07 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+backports' into private/jmux/libreoffice-4-1-6+all commit 04209b2396aa142d79e945dace7e70fd9e112d32 Author: Juergen Funk <juergen.funk...@cib.de> Date: Fri Jul 3 08:33:03 2015 +0200 tdf#92517 KDE4-FileDialog: "Save as" has wrong Filter Fixing follow - The order of calling: first should be set the filter, after that can be set the current filter - change the function from "setCurrentFilter" to "setCurrentItem" When you set the filter over "setCurrentFilter" you need the full search string "extention|description" e.g. "*.docx|Microsoft Word.." - Not need the escape of slash (with that can not find "Microsoft Word 2007/2010 XML (.docx))" Change-Id: Ie4f7d6fd619b391487ee944c3e745c855600ee54 diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx index ec5a66f..3a258a6 100644 --- a/vcl/unx/kde4/KDE4FilePicker.cxx +++ b/vcl/unx/kde4/KDE4FilePicker.cxx @@ -233,6 +233,10 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute() _dialog->clearFilter(); _dialog->setFilter(_filter); + + if(!_currentFilter.isNull()) + _dialog->filterWidget()->setCurrentItem(_currentFilter); + _dialog->filterWidget()->setEditable(false); VCLKDEApplication::preDialogSetup(); @@ -357,9 +361,7 @@ void SAL_CALL KDE4FilePicker::setCurrentFilter( const OUString &title ) return Q_EMIT setCurrentFilterSignal( title ); } - QString t = toQString(title); - t.replace("/", "\\/"); - _dialog->filterWidget()->setCurrentFilter(t); + _currentFilter = toQString(title); } OUString SAL_CALL KDE4FilePicker::getCurrentFilter() @@ -606,6 +608,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) } _filter.clear(); + _currentFilter.clear(); // parameter checking uno::Any arg; diff --git a/vcl/unx/kde4/KDE4FilePicker.hxx b/vcl/unx/kde4/KDE4FilePicker.hxx index b746191..168d79a 100644 --- a/vcl/unx/kde4/KDE4FilePicker.hxx +++ b/vcl/unx/kde4/KDE4FilePicker.hxx @@ -66,6 +66,8 @@ protected: //running filter string to add to dialog QString _filter; + // string to set the current filter + QString _currentFilter; //mapping of SAL control ID's to created custom controls QHash<sal_Int16, QWidget*> _customWidgets; commit d61e16a16aba98c78854bfcdc166b51a3013f11f Merge: 64c66ca e1d9c31 Author: Juergen Funk <juergen.funk...@cib.de> Date: Fri Jul 3 11:01:00 2015 +0200 Merge branch 'private/jmux/libreoffice-4-1-6+lhm' into private/jmux/libreoffice-4-1-6+all commit e1d9c313b2cdf631341b0867cc72fd18d746ea20 Author: Juergen Funk <juergen.funk...@cib.de> Date: Fri Jul 3 10:51:31 2015 +0200 version bump: 4.1.6.21.0+ --> 4.1.6.22.0+ reflects internal LO 4.1.6.22 Change-Id: I58145787535077d45d7cf6ddb346bf7c906bed12 ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits